aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/module.h12
-rw-r--r--src/common/module_unittest.cc6
2 files changed, 13 insertions, 5 deletions
diff --git a/src/common/module.h b/src/common/module.h
index 7a44d4ab..92012249 100644
--- a/src/common/module.h
+++ b/src/common/module.h
@@ -153,8 +153,14 @@ class Module {
// for functions and lines will be written to the Breakpad symbol
// file as offsets from this address. Construction initializes this
// module's load address to zero: addresses written to the symbol
- // file will be the same as they appear in the File and Line
- // structures.
+ // file will be the same as they appear in the Function, Line, and
+ // StackFrameEntry structures.
+ //
+ // Note that this member function has no effect on addresses stored
+ // in the data added to this module; the Write member function
+ // simply subtracts off the load address from addresses before it
+ // prints them. Only the last load address given before calling
+ // Write is used.
void SetLoadAddress(Address load_address);
// Add FUNCTION to the module.
@@ -223,7 +229,7 @@ class Module {
// established by SetLoadAddress.
bool Write(FILE *stream);
-private:
+ private:
// Report an error that has occurred writing the symbol file, using
// errno to find the appropriate cause. Return false.
diff --git a/src/common/module_unittest.cc b/src/common/module_unittest.cc
index 07903411..dab0dac3 100644
--- a/src/common/module_unittest.cc
+++ b/src/common/module_unittest.cc
@@ -140,8 +140,6 @@ TEST(Write, RelativeLoadAddress) {
FILE *f = checked_tmpfile();
Module m(MODULE_NAME, MODULE_OS, MODULE_ARCH, MODULE_ID);
- m.SetLoadAddress(0x2ab698b0b6407073LL);
-
// Some source files. We will expect to see them in lexicographic order.
Module::File *file1 = m.FindFile("filename-b.cc");
Module::File *file2 = m.FindFile("filename-a.cc");
@@ -174,6 +172,10 @@ TEST(Write, RelativeLoadAddress) {
entry->rule_changes[0x30f9e5c83323973eULL]["Mister"] = "Death";
m.AddStackFrameEntry(entry);
+ // Set the load address. Doing this after adding all the data to
+ // the module must work fine.
+ m.SetLoadAddress(0x2ab698b0b6407073LL);
+
m.Write(f);
checked_fflush(f);
rewind(f);