Create helper class for DWARF expressions.
This ensures we generate valid DWARF opcodes and
it slightly simplifies the debug info writer.
Change-Id: I2ef8a9222c9a129c58f500741acd209b67e2ecff
diff --git a/compiler/dwarf/debug_info_entry_writer.h b/compiler/dwarf/debug_info_entry_writer.h
index a551e4b..e5bbed3 100644
--- a/compiler/dwarf/debug_info_entry_writer.h
+++ b/compiler/dwarf/debug_info_entry_writer.h
@@ -22,6 +22,7 @@
#include "base/casts.h"
#include "dwarf/dwarf_constants.h"
+#include "dwarf/expression.h"
#include "dwarf/writer.h"
#include "leb128.h"
@@ -106,16 +107,16 @@
}
}
- void WriteBlock(Attribute attrib, const void* ptr, size_t num_bytes) {
+ void WriteBlock(Attribute attrib, const uint8_t* ptr, size_t num_bytes) {
AddAbbrevAttribute(attrib, DW_FORM_block);
this->PushUleb128(num_bytes);
this->PushData(ptr, num_bytes);
}
- void WriteExprLoc(Attribute attrib, const void* ptr, size_t num_bytes) {
+ void WriteExprLoc(Attribute attrib, const Expression& expr) {
AddAbbrevAttribute(attrib, DW_FORM_exprloc);
- this->PushUleb128(dchecked_integral_cast<uint32_t>(num_bytes));
- this->PushData(ptr, num_bytes);
+ this->PushUleb128(dchecked_integral_cast<uint32_t>(expr.size()));
+ this->PushData(expr.data());
}
void WriteData1(Attribute attrib, uint8_t value) {