From 87855248f1fab83caf002418196a34051d359f2c Mon Sep 17 00:00:00 2001 From: jimblandy Date: Mon, 5 Apr 2010 19:40:17 +0000 Subject: [PATCH] Breakpad symbol dumper: Move Linux dumping classes into src/common. The Linux symbol dumper's classes are reasonably portable, and should be usable for the Mac dumper as well. Move them to src/common, along with their unit tests. Update #include directives and Makefile. a=jimblandy, r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@567 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/{linux => }/dump_stabs.cc | 2 +- src/common/{linux => }/dump_stabs.h | 4 ++-- src/common/{linux => }/dump_stabs_unittest.cc | 2 +- src/common/{linux => }/dwarf_cfi_to_module.cc | 2 +- src/common/{linux => }/dwarf_cfi_to_module.h | 2 +- .../{linux => }/dwarf_cfi_to_module_unittest.cc | 2 +- src/common/{linux => }/dwarf_cu_to_module.cc | 4 ++-- src/common/{linux => }/dwarf_cu_to_module.h | 4 ++-- .../{linux => }/dwarf_cu_to_module_unittest.cc | 4 ++-- src/common/{linux => }/dwarf_line_to_module.cc | 2 +- src/common/{linux => }/dwarf_line_to_module.h | 2 +- .../{linux => }/dwarf_line_to_module_unittest.cc | 2 +- src/common/{linux => }/language.cc | 2 +- src/common/{linux => }/language.h | 0 src/common/linux/dump_symbols.cc | 12 ++++++------ src/common/{linux => }/module.cc | 2 +- src/common/{linux => }/module.h | 0 src/common/{linux => }/module_unittest.cc | 2 +- src/common/{linux => }/stabs_reader.cc | 2 +- src/common/{linux => }/stabs_reader.h | 0 src/common/{linux => }/stabs_reader_unittest.cc | 14 +++++++------- .../{linux => }/testdata/func-line-pairing.h | 0 .../testdata/stabs_reader_unittest.input1 | 0 .../testdata/stabs_reader_unittest.input2 | 0 .../testdata/stabs_reader_unittest.input3 | 0 .../testdata/stabs_reader_unittest.input4 | 0 .../testdata/stabs_reader_unittest.input5 | 0 .../testdata/stabs_reader_unittest.input6 | 0 src/tools/linux/dump_syms/Makefile | 8 +++++--- 29 files changed, 38 insertions(+), 36 deletions(-) rename src/common/{linux => }/dump_stabs.cc (99%) rename src/common/{linux => }/dump_stabs.h (98%) rename src/common/{linux => }/dump_stabs_unittest.cc (99%) rename src/common/{linux => }/dwarf_cfi_to_module.cc (99%) rename src/common/{linux => }/dwarf_cfi_to_module.h (99%) rename src/common/{linux => }/dwarf_cfi_to_module_unittest.cc (99%) rename src/common/{linux => }/dwarf_cu_to_module.cc (99%) rename src/common/{linux => }/dwarf_cu_to_module.h (99%) rename src/common/{linux => }/dwarf_cu_to_module_unittest.cc (99%) rename src/common/{linux => }/dwarf_line_to_module.cc (99%) rename src/common/{linux => }/dwarf_line_to_module.h (99%) rename src/common/{linux => }/dwarf_line_to_module_unittest.cc (99%) rename src/common/{linux => }/language.cc (98%) rename src/common/{linux => }/language.h (100%) rename src/common/{linux => }/module.cc (99%) rename src/common/{linux => }/module.h (100%) rename src/common/{linux => }/module_unittest.cc (99%) rename src/common/{linux => }/stabs_reader.cc (99%) rename src/common/{linux => }/stabs_reader.h (100%) rename src/common/{linux => }/stabs_reader_unittest.cc (97%) rename src/common/{linux => }/testdata/func-line-pairing.h (100%) rename src/common/{linux => }/testdata/stabs_reader_unittest.input1 (100%) rename src/common/{linux => }/testdata/stabs_reader_unittest.input2 (100%) rename src/common/{linux => }/testdata/stabs_reader_unittest.input3 (100%) rename src/common/{linux => }/testdata/stabs_reader_unittest.input4 (100%) rename src/common/{linux => }/testdata/stabs_reader_unittest.input5 (100%) rename src/common/{linux => }/testdata/stabs_reader_unittest.input6 (100%) diff --git a/src/common/linux/dump_stabs.cc b/src/common/dump_stabs.cc similarity index 99% rename from src/common/linux/dump_stabs.cc rename to src/common/dump_stabs.cc index 6842eae6..436b6215 100644 --- a/src/common/linux/dump_stabs.cc +++ b/src/common/dump_stabs.cc @@ -37,7 +37,7 @@ #include #include -#include "common/linux/dump_stabs.h" +#include "common/dump_stabs.h" namespace google_breakpad { diff --git a/src/common/linux/dump_stabs.h b/src/common/dump_stabs.h similarity index 98% rename from src/common/linux/dump_stabs.h rename to src/common/dump_stabs.h index e6ea1d54..e5c34409 100644 --- a/src/common/linux/dump_stabs.h +++ b/src/common/dump_stabs.h @@ -43,8 +43,8 @@ #include #include -#include "common/linux/module.h" -#include "common/linux/stabs_reader.h" +#include "common/module.h" +#include "common/stabs_reader.h" namespace google_breakpad { diff --git a/src/common/linux/dump_stabs_unittest.cc b/src/common/dump_stabs_unittest.cc similarity index 99% rename from src/common/linux/dump_stabs_unittest.cc rename to src/common/dump_stabs_unittest.cc index 382c4f5f..7d27cb88 100644 --- a/src/common/linux/dump_stabs_unittest.cc +++ b/src/common/dump_stabs_unittest.cc @@ -34,7 +34,7 @@ #include #include "breakpad_googletest_includes.h" -#include "common/linux/dump_stabs.h" +#include "common/dump_stabs.h" using google_breakpad::DumpStabsHandler; using google_breakpad::Module; diff --git a/src/common/linux/dwarf_cfi_to_module.cc b/src/common/dwarf_cfi_to_module.cc similarity index 99% rename from src/common/linux/dwarf_cfi_to_module.cc rename to src/common/dwarf_cfi_to_module.cc index 603acc0e..49a6d852 100644 --- a/src/common/linux/dwarf_cfi_to_module.cc +++ b/src/common/dwarf_cfi_to_module.cc @@ -36,7 +36,7 @@ #include -#include "common/linux/dwarf_cfi_to_module.h" +#include "common/dwarf_cfi_to_module.h" namespace google_breakpad { diff --git a/src/common/linux/dwarf_cfi_to_module.h b/src/common/dwarf_cfi_to_module.h similarity index 99% rename from src/common/linux/dwarf_cfi_to_module.h rename to src/common/dwarf_cfi_to_module.h index 9df796f5..002fc90f 100644 --- a/src/common/linux/dwarf_cfi_to_module.h +++ b/src/common/dwarf_cfi_to_module.h @@ -43,7 +43,7 @@ #include #include -#include "common/linux/module.h" +#include "common/module.h" #include "common/dwarf/dwarf2reader.h" namespace google_breakpad { diff --git a/src/common/linux/dwarf_cfi_to_module_unittest.cc b/src/common/dwarf_cfi_to_module_unittest.cc similarity index 99% rename from src/common/linux/dwarf_cfi_to_module_unittest.cc rename to src/common/dwarf_cfi_to_module_unittest.cc index d7b08aef..516b9784 100644 --- a/src/common/linux/dwarf_cfi_to_module_unittest.cc +++ b/src/common/dwarf_cfi_to_module_unittest.cc @@ -32,7 +32,7 @@ // dwarf_cfi_to_module_unittest.cc: Tests for google_breakpad::DwarfCFIToModule. #include "breakpad_googletest_includes.h" -#include "common/linux/dwarf_cfi_to_module.h" +#include "common/dwarf_cfi_to_module.h" using google_breakpad::Module; using google_breakpad::DwarfCFIToModule; diff --git a/src/common/linux/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc similarity index 99% rename from src/common/linux/dwarf_cu_to_module.cc rename to src/common/dwarf_cu_to_module.cc index 59efebc4..3ac833ff 100644 --- a/src/common/linux/dwarf_cu_to_module.cc +++ b/src/common/dwarf_cu_to_module.cc @@ -34,8 +34,8 @@ #include #include -#include "common/linux/dwarf_cu_to_module.h" -#include "common/linux/dwarf_line_to_module.h" +#include "common/dwarf_cu_to_module.h" +#include "common/dwarf_line_to_module.h" namespace google_breakpad { diff --git a/src/common/linux/dwarf_cu_to_module.h b/src/common/dwarf_cu_to_module.h similarity index 99% rename from src/common/linux/dwarf_cu_to_module.h rename to src/common/dwarf_cu_to_module.h index 8d8a0b2c..6f0baeae 100644 --- a/src/common/linux/dwarf_cu_to_module.h +++ b/src/common/dwarf_cu_to_module.h @@ -43,8 +43,8 @@ #include #include -#include "common/linux/language.h" -#include "common/linux/module.h" +#include "common/language.h" +#include "common/module.h" #include "common/dwarf/bytereader.h" #include "common/dwarf/dwarf2diehandler.h" #include "common/dwarf/dwarf2reader.h" diff --git a/src/common/linux/dwarf_cu_to_module_unittest.cc b/src/common/dwarf_cu_to_module_unittest.cc similarity index 99% rename from src/common/linux/dwarf_cu_to_module_unittest.cc rename to src/common/dwarf_cu_to_module_unittest.cc index 1cfbee69..f0686de3 100644 --- a/src/common/linux/dwarf_cu_to_module_unittest.cc +++ b/src/common/dwarf_cu_to_module_unittest.cc @@ -34,7 +34,7 @@ #include #include "breakpad_googletest_includes.h" -#include "common/linux/dwarf_cu_to_module.h" +#include "common/dwarf_cu_to_module.h" using std::vector; @@ -828,7 +828,7 @@ struct Situation { uncovered_functions, uncovered_lines }, Situation situations[] = { -#include "common/linux/testdata/func-line-pairing.h" +#include "common/testdata/func-line-pairing.h" }; #undef PAIRING diff --git a/src/common/linux/dwarf_line_to_module.cc b/src/common/dwarf_line_to_module.cc similarity index 99% rename from src/common/linux/dwarf_line_to_module.cc rename to src/common/dwarf_line_to_module.cc index c740fa30..75afd93c 100644 --- a/src/common/linux/dwarf_line_to_module.cc +++ b/src/common/dwarf_line_to_module.cc @@ -32,7 +32,7 @@ // dwarf_line_to_module.cc: Implementation of DwarfLineToModule class. // See dwarf_line_to_module.h for details. -#include "common/linux/dwarf_line_to_module.h" +#include "common/dwarf_line_to_module.h" // Trying to support Windows paths in a reasonable way adds a lot of // variations to test; it would be better to just put off dealing with diff --git a/src/common/linux/dwarf_line_to_module.h b/src/common/dwarf_line_to_module.h similarity index 99% rename from src/common/linux/dwarf_line_to_module.h rename to src/common/dwarf_line_to_module.h index 7ff466d7..49b3eb35 100644 --- a/src/common/linux/dwarf_line_to_module.h +++ b/src/common/dwarf_line_to_module.h @@ -38,7 +38,7 @@ #ifndef COMMON_LINUX_DWARF_LINE_TO_MODULE_H #define COMMON_LINUX_DWARF_LINE_TO_MODULE_H -#include "common/linux/module.h" +#include "common/module.h" #include "common/dwarf/dwarf2reader.h" namespace google_breakpad { diff --git a/src/common/linux/dwarf_line_to_module_unittest.cc b/src/common/dwarf_line_to_module_unittest.cc similarity index 99% rename from src/common/linux/dwarf_line_to_module_unittest.cc rename to src/common/dwarf_line_to_module_unittest.cc index 54411591..3b8a1360 100644 --- a/src/common/linux/dwarf_line_to_module_unittest.cc +++ b/src/common/dwarf_line_to_module_unittest.cc @@ -32,7 +32,7 @@ // dwarf_line_to_module.cc: Unit tests for google_breakpad::DwarfLineToModule. #include "breakpad_googletest_includes.h" -#include "common/linux/dwarf_line_to_module.h" +#include "common/dwarf_line_to_module.h" using google_breakpad::DwarfLineToModule; using google_breakpad::Module; diff --git a/src/common/linux/language.cc b/src/common/language.cc similarity index 98% rename from src/common/linux/language.cc rename to src/common/language.cc index 5e6473a1..3d8d9708 100644 --- a/src/common/linux/language.cc +++ b/src/common/language.cc @@ -32,7 +32,7 @@ // language.cc: Subclasses and singletons for google_breakpad::Language. // See language.h for details. -#include "common/linux/language.h" +#include "common/language.h" namespace google_breakpad { diff --git a/src/common/linux/language.h b/src/common/language.h similarity index 100% rename from src/common/linux/language.h rename to src/common/language.h diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc index eecacd59..ea55cc7b 100644 --- a/src/common/linux/dump_symbols.cc +++ b/src/common/linux/dump_symbols.cc @@ -48,14 +48,14 @@ #include "common/dwarf/bytereader-inl.h" #include "common/dwarf/dwarf2diehandler.h" -#include "common/linux/dump_stabs.h" +#include "common/dump_stabs.h" #include "common/linux/dump_symbols.h" -#include "common/linux/dwarf_cfi_to_module.h" -#include "common/linux/dwarf_cu_to_module.h" -#include "common/linux/dwarf_line_to_module.h" +#include "common/dwarf_cfi_to_module.h" +#include "common/dwarf_cu_to_module.h" +#include "common/dwarf_line_to_module.h" #include "common/linux/file_id.h" -#include "common/linux/module.h" -#include "common/linux/stabs_reader.h" +#include "common/module.h" +#include "common/stabs_reader.h" // This namespace contains helper functions. namespace { diff --git a/src/common/linux/module.cc b/src/common/module.cc similarity index 99% rename from src/common/linux/module.cc rename to src/common/module.cc index f6373895..fd36f3f9 100644 --- a/src/common/linux/module.cc +++ b/src/common/module.cc @@ -34,7 +34,7 @@ #include #include -#include "common/linux/module.h" +#include "common/module.h" namespace google_breakpad { diff --git a/src/common/linux/module.h b/src/common/module.h similarity index 100% rename from src/common/linux/module.h rename to src/common/module.h diff --git a/src/common/linux/module_unittest.cc b/src/common/module_unittest.cc similarity index 99% rename from src/common/linux/module_unittest.cc rename to src/common/module_unittest.cc index 771d91e5..07903411 100644 --- a/src/common/linux/module_unittest.cc +++ b/src/common/module_unittest.cc @@ -40,7 +40,7 @@ #include #include "breakpad_googletest_includes.h" -#include "common/linux/module.h" +#include "common/module.h" using google_breakpad::Module; using std::string; diff --git a/src/common/linux/stabs_reader.cc b/src/common/stabs_reader.cc similarity index 99% rename from src/common/linux/stabs_reader.cc rename to src/common/stabs_reader.cc index a536144f..7c2b1cc4 100644 --- a/src/common/linux/stabs_reader.cc +++ b/src/common/stabs_reader.cc @@ -36,7 +36,7 @@ #include #include -#include "common/linux/stabs_reader.h" +#include "common/stabs_reader.h" namespace google_breakpad { diff --git a/src/common/linux/stabs_reader.h b/src/common/stabs_reader.h similarity index 100% rename from src/common/linux/stabs_reader.h rename to src/common/stabs_reader.h diff --git a/src/common/linux/stabs_reader_unittest.cc b/src/common/stabs_reader_unittest.cc similarity index 97% rename from src/common/linux/stabs_reader_unittest.cc rename to src/common/stabs_reader_unittest.cc index 88fcfe67..a22d9d0e 100644 --- a/src/common/linux/stabs_reader_unittest.cc +++ b/src/common/stabs_reader_unittest.cc @@ -45,7 +45,7 @@ #include #include "breakpad_googletest_includes.h" -#include "common/linux/stabs_reader.h" +#include "common/stabs_reader.h" using std::istream; using std::istringstream; @@ -569,7 +569,7 @@ TEST(StabsReader, MockStabsInput) { ASSERT_TRUE(ApplyHandlerToMockStabsData( &mock_handler, - "common/linux/testdata/stabs_reader_unittest.input1")); + "common/testdata/stabs_reader_unittest.input1")); } TEST(StabsReader, AbruptCU) { @@ -587,7 +587,7 @@ TEST(StabsReader, AbruptCU) { ASSERT_TRUE(ApplyHandlerToMockStabsData( &mock_handler, - "common/linux/testdata/stabs_reader_unittest.input2")); + "common/testdata/stabs_reader_unittest.input2")); } TEST(StabsReader, AbruptFunction) { @@ -609,7 +609,7 @@ TEST(StabsReader, AbruptFunction) { ASSERT_TRUE(ApplyHandlerToMockStabsData( &mock_handler, - "common/linux/testdata/stabs_reader_unittest.input3")); + "common/testdata/stabs_reader_unittest.input3")); } TEST(StabsReader, NoCU) { @@ -622,7 +622,7 @@ TEST(StabsReader, NoCU) { ASSERT_TRUE(ApplyHandlerToMockStabsData( &mock_handler, - "common/linux/testdata/stabs_reader_unittest.input4")); + "common/testdata/stabs_reader_unittest.input4")); } @@ -646,7 +646,7 @@ TEST(StabsReader, NoCUEnd) { ASSERT_TRUE(ApplyHandlerToMockStabsData( &mock_handler, - "common/linux/testdata/stabs_reader_unittest.input5")); + "common/testdata/stabs_reader_unittest.input5")); } @@ -677,7 +677,7 @@ TEST(StabsReader, MultipleCUs) { ASSERT_TRUE(ApplyHandlerToMockStabsData( &mock_handler, - "common/linux/testdata/stabs_reader_unittest.input6")); + "common/testdata/stabs_reader_unittest.input6")); } // name duplication diff --git a/src/common/linux/testdata/func-line-pairing.h b/src/common/testdata/func-line-pairing.h similarity index 100% rename from src/common/linux/testdata/func-line-pairing.h rename to src/common/testdata/func-line-pairing.h diff --git a/src/common/linux/testdata/stabs_reader_unittest.input1 b/src/common/testdata/stabs_reader_unittest.input1 similarity index 100% rename from src/common/linux/testdata/stabs_reader_unittest.input1 rename to src/common/testdata/stabs_reader_unittest.input1 diff --git a/src/common/linux/testdata/stabs_reader_unittest.input2 b/src/common/testdata/stabs_reader_unittest.input2 similarity index 100% rename from src/common/linux/testdata/stabs_reader_unittest.input2 rename to src/common/testdata/stabs_reader_unittest.input2 diff --git a/src/common/linux/testdata/stabs_reader_unittest.input3 b/src/common/testdata/stabs_reader_unittest.input3 similarity index 100% rename from src/common/linux/testdata/stabs_reader_unittest.input3 rename to src/common/testdata/stabs_reader_unittest.input3 diff --git a/src/common/linux/testdata/stabs_reader_unittest.input4 b/src/common/testdata/stabs_reader_unittest.input4 similarity index 100% rename from src/common/linux/testdata/stabs_reader_unittest.input4 rename to src/common/testdata/stabs_reader_unittest.input4 diff --git a/src/common/linux/testdata/stabs_reader_unittest.input5 b/src/common/testdata/stabs_reader_unittest.input5 similarity index 100% rename from src/common/linux/testdata/stabs_reader_unittest.input5 rename to src/common/testdata/stabs_reader_unittest.input5 diff --git a/src/common/linux/testdata/stabs_reader_unittest.input6 b/src/common/testdata/stabs_reader_unittest.input6 similarity index 100% rename from src/common/linux/testdata/stabs_reader_unittest.input6 rename to src/common/testdata/stabs_reader_unittest.input6 diff --git a/src/tools/linux/dump_syms/Makefile b/src/tools/linux/dump_syms/Makefile index 76cbf2c1..7a5673c9 100644 --- a/src/tools/linux/dump_syms/Makefile +++ b/src/tools/linux/dump_syms/Makefile @@ -96,7 +96,7 @@ clean:: dump_syms.o: dump_syms.cc -VPATH += $(SRC)/common/linux +VPATH += $(SRC)/common dwarf_cfi_to_module.o: dwarf_cfi_to_module.cc COVERAGE_SOURCES += dwarf_cfi_to_module.cc dwarf_cu_to_module.o: dwarf_cu_to_module.cc @@ -105,14 +105,16 @@ dwarf_line_to_module.o: dwarf_line_to_module.cc COVERAGE_SOURCES += dwarf_line_to_module.cc dump_stabs.o: dump_stabs.cc COVERAGE_SOURCES += dump_stabs.cc -dump_symbols.o: dump_symbols.cc -file_id.o: file_id.cc language.o: language.cc module.o: module.cc COVERAGE_SOURCES += module.cc stabs_reader.o: stabs_reader.cc COVERAGE_SOURCES += stabs_reader.cc +VPATH += $(SRC)/common/linux +dump_symbols.o: dump_symbols.cc +file_id.o: file_id.cc + VPATH += $(SRC)/common/dwarf bytereader.o: bytereader.cc COVERAGE_SOURCES += bytereader.cc