From 504280af60e3052d2ecaa9e003818886e651310f Mon Sep 17 00:00:00 2001 From: jimblandy Date: Wed, 28 Apr 2010 18:14:59 +0000 Subject: Breakpad Dumper: Move CFI register names to DwarfCFIToModule class. At the moment, the mappings from register numbers appearing in DWARF CFI and .eh_frame exception handling sections to the appropriate processor-specific names are in src/common/linux/dump_syms.cc. However, the numberings are (for the most part) the same on all platforms using DWARF, so there's no reason those tables shouldn't be shared between the Linux and Mac symbol dumpers. This patch moves the tables into a nested class of DwarfCFIToModule, so they the Mac dumper can use them when it is changed to use DwarfCFIToModule. a=jimblandy, r=thestig git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@575 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/dwarf_cfi_to_module_unittest.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/common/dwarf_cfi_to_module_unittest.cc') diff --git a/src/common/dwarf_cfi_to_module_unittest.cc b/src/common/dwarf_cfi_to_module_unittest.cc index 516b9784..9477296d 100644 --- a/src/common/dwarf_cfi_to_module_unittest.cc +++ b/src/common/dwarf_cfi_to_module_unittest.cc @@ -258,3 +258,31 @@ TEST_F(Rule, DefaultReturnAddressRuleLater) { EXPECT_THAT(entries[0]->rule_changes, ContainerEq(expected_changes)); } +TEST(RegisterNames, I386) { + vector names = DwarfCFIToModule::RegisterNames::I386(); + + EXPECT_EQ("$eax", names[0]); + EXPECT_EQ("$ecx", names[1]); + EXPECT_EQ("$esp", names[4]); + EXPECT_EQ("$eip", names[8]); +} + +TEST(RegisterNames, ARM) { + vector names = DwarfCFIToModule::RegisterNames::ARM(); + + EXPECT_EQ("r0", names[0]); + EXPECT_EQ("r10", names[10]); + EXPECT_EQ("sp", names[13]); + EXPECT_EQ("lr", names[14]); + EXPECT_EQ("pc", names[15]); +} + +TEST(RegisterNames, X86_64) { + vector names = DwarfCFIToModule::RegisterNames::X86_64(); + + EXPECT_EQ("$rax", names[0]); + EXPECT_EQ("$rdx", names[1]); + EXPECT_EQ("$rbp", names[6]); + EXPECT_EQ("$rsp", names[7]); + EXPECT_EQ("$rip", names[16]); +} -- cgit v1.2.1