aboutsummaryrefslogtreecommitdiff
path: root/src/common/dwarf_cu_to_module_unittest.cc
diff options
context:
space:
mode:
authorerikchen@chromium.org <erikchen@chromium.org>2015-01-27 01:20:59 +0000
committererikchen@chromium.org <erikchen@chromium.org>2015-01-27 01:20:59 +0000
commit7bebb27fb44920f189310985d96ed7801f59afbb (patch)
tree4488552decfc8604e6d4609ba5d56c81baa1e863 /src/common/dwarf_cu_to_module_unittest.cc
parentFix a source of memory corruption. (diff)
downloadbreakpad-7bebb27fb44920f189310985d96ed7801f59afbb.tar.xz
Fix some fragile code that is likely to cause future memory corruption
problems. - The ordering of keys in stl containers cannot change. Make the relevant members const to guarantee this assumption. - Add handling and logging for demangle errors. - Fix a potential double-delete bug if a function passed to AddFunction() is already present. BUG=chromium:449214 R=mark@chromium.org Review URL: https://breakpad.appspot.com/10704002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1415 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/dwarf_cu_to_module_unittest.cc')
-rw-r--r--src/common/dwarf_cu_to_module_unittest.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/common/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc
index 5f61a58e..9ff842c8 100644
--- a/src/common/dwarf_cu_to_module_unittest.cc
+++ b/src/common/dwarf_cu_to_module_unittest.cc
@@ -81,6 +81,7 @@ class MockWarningReporter: public DwarfCUToModule::WarningReporter {
MOCK_METHOD1(UncoveredFunction, void(const Module::Function &function));
MOCK_METHOD1(UncoveredLine, void(const Module::Line &line));
MOCK_METHOD1(UnnamedFunction, void(uint64 offset));
+ MOCK_METHOD2(DemangleError, void(const string &input, int error));
MOCK_METHOD2(UnhandledInterCUReference, void(uint64 offset, uint64 target));
};
@@ -1712,16 +1713,14 @@ TEST_F(CUErrors, BadCURootDIETag) {
// produce) output, so their results need to be checked by hand.
struct Reporter: public Test {
Reporter()
- : reporter("filename", 0x123456789abcdef0ULL) {
+ : reporter("filename", 0x123456789abcdef0ULL),
+ function("function name", 0x19c45c30770c1eb0ULL),
+ file("source file name") {
reporter.SetCUName("compilation-unit-name");
- function.name = "function name";
- function.address = 0x19c45c30770c1eb0ULL;
function.size = 0x89808a5bdfa0a6a3ULL;
function.parameter_size = 0x6a329f18683dcd51ULL;
- file.name = "source file name";
-
line.address = 0x3606ac6267aebeccULL;
line.size = 0x5de482229f32556aULL;
line.file = &file;