From 9e6b619ad084c58af9fb8983b1a646192adb3835 Mon Sep 17 00:00:00 2001 From: jimblandy Date: Mon, 5 Apr 2010 19:35:10 +0000 Subject: Breakpad Linux Dumper: Disable warnings about unpaired functions and lines by default. In the process of pairing up DWARF source lines with the functions they belong to, the dumper detects and warns about regions of functions that have no source line information, and vice versa. However, this seems to occur in real code frequently enough (although not often) that the warnings may obscure more serious problems. This patch makes those warnings disabled by default in DwarfCUToModule::WarningReporter. It does not add a way for the dump_syms user to enable them. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@566 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/linux/dwarf_cu_to_module_unittest.cc | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'src/common/linux/dwarf_cu_to_module_unittest.cc') diff --git a/src/common/linux/dwarf_cu_to_module_unittest.cc b/src/common/linux/dwarf_cu_to_module_unittest.cc index 7553c533..1cfbee69 100644 --- a/src/common/linux/dwarf_cu_to_module_unittest.cc +++ b/src/common/linux/dwarf_cu_to_module_unittest.cc @@ -1633,5 +1633,69 @@ TEST_F(Errors, BadCURootDIETag) { no_attrs)); } +// Tests for DwarfCUToModule::Reporter. These just produce (or fail to +// produce) output, so their results need to be checked by hand. +struct Reporter: public Test { + Reporter() + : reporter("filename", 0x123456789abcdef0ULL) { + 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; + line.number = 93400201; + } + + DwarfCUToModule::WarningReporter reporter; + Module::Function function; + Module::File file; + Module::Line line; +}; + +TEST_F(Reporter, UnknownSpecification) { + reporter.UnknownSpecification(0x123456789abcdef1ULL, 0x323456789abcdef2ULL); +} + +TEST_F(Reporter, UnknownAbstractOrigin) { + reporter.UnknownAbstractOrigin(0x123456789abcdef1ULL, 0x323456789abcdef2ULL); +} + +TEST_F(Reporter, MissingSection) { + reporter.MissingSection("section name"); +} + +TEST_F(Reporter, BadLineInfoOffset) { + reporter.BadLineInfoOffset(0x123456789abcdef1ULL); +} + +TEST_F(Reporter, UncoveredFunctionDisabled) { + reporter.UncoveredFunction(function); + EXPECT_FALSE(reporter.uncovered_warnings_enabled()); +} + +TEST_F(Reporter, UncoveredFunctionEnabled) { + reporter.set_uncovered_warnings_enabled(true); + reporter.UncoveredFunction(function); + EXPECT_TRUE(reporter.uncovered_warnings_enabled()); +} + +TEST_F(Reporter, UncoveredLineDisabled) { + reporter.UncoveredLine(line); + EXPECT_FALSE(reporter.uncovered_warnings_enabled()); +} + +TEST_F(Reporter, UncoveredLineEnabled) { + reporter.set_uncovered_warnings_enabled(true); + reporter.UncoveredLine(line); + EXPECT_TRUE(reporter.uncovered_warnings_enabled()); +} + // Would be nice to also test: // - overlapping lines, functions -- cgit v1.2.1