From b129eb0e566d53a2500d505cbb80e8ad4ad6f981 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 2 Sep 2010 22:35:18 +0000 Subject: * dwarf.c (init_dwarf_regnames_i386, init_dwarf_regnames_x86_64): New. (init_dwarf_regnames): Use them. * dwarf.h: Declare them. * objdump.c (dump_dwarf): Use bfd_get_arch + bfd_get_mach to set up the regnames, rather than using elf_machine_code. --- binutils/dwarf.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'binutils/dwarf.c') diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 84e22eb..1d2679b 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -3961,6 +3961,13 @@ static const char *const dwarf_regnames_i386[] = "tr", "ldtr" }; +void +init_dwarf_regnames_i386 (void) +{ + dwarf_regnames = dwarf_regnames_i386; + dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_i386); +} + static const char *const dwarf_regnames_x86_64[] = { "rax", "rdx", "rcx", "rbx", @@ -3984,20 +3991,25 @@ static const char *const dwarf_regnames_x86_64[] = }; void +init_dwarf_regnames_x86_64 (void) +{ + dwarf_regnames = dwarf_regnames_x86_64; + dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_x86_64); +} + +void init_dwarf_regnames (unsigned int e_machine) { switch (e_machine) { case EM_386: case EM_486: - dwarf_regnames = dwarf_regnames_i386; - dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_i386); + init_dwarf_regnames_i386 (); break; case EM_X86_64: case EM_L1OM: - dwarf_regnames = dwarf_regnames_x86_64; - dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_x86_64); + init_dwarf_regnames_x86_64 (); break; default: -- cgit v1.1