[3/4] GDB: Add support for 24 bit addresses

Message ID 20180829141845.26378-4-john@darrington.wattle.id.au
State New, archived
Headers

Commit Message

John Darrington Aug. 29, 2018, 2:18 p.m. UTC
  * gdb/dwarf2-frame.c (encoding_for_size): Deal with case 3.
                (read_encoded_value): Deal with case DW_EH_PE_udata3
---
 gdb/dwarf2-frame.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Tom Tromey Sept. 7, 2018, 10:04 p.m. UTC | #1
>>>>> "John" == John Darrington <john@darrington.wattle.id.au> writes:

John> * gdb/dwarf2-frame.c (encoding_for_size): Deal with case 3.
John>                 (read_encoded_value): Deal with case DW_EH_PE_udata3

This is ok; pending the dwarf2.h patch of course.

John>      default:
John> -      internal_error (__FILE__, __LINE__, _("Unsupported address size"));
John> +      internal_error (__FILE__, __LINE__, _("Unsupported address size %d"), size);

Thanks for doing that.

Tom
  

Patch

diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index f7dc820f4d..b329e34997 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1527,12 +1527,14 @@  encoding_for_size (unsigned int size)
     {
     case 2:
       return DW_EH_PE_udata2;
+    case 3:
+      return DW_EH_PE_udata3;
     case 4:
       return DW_EH_PE_udata4;
     case 8:
       return DW_EH_PE_udata8;
     default:
-      internal_error (__FILE__, __LINE__, _("Unsupported address size"));
+      internal_error (__FILE__, __LINE__, _("Unsupported address size %d"), size);
     }
 }
 
@@ -1605,6 +1607,9 @@  read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
     case DW_EH_PE_udata2:
       *bytes_read_ptr += 2;
       return (base + bfd_get_16 (unit->abfd, (bfd_byte *) buf));
+    case DW_EH_PE_udata3:
+      *bytes_read_ptr += 3;
+      return (base + bfd_get_24 (unit->abfd, (bfd_byte *) buf));
     case DW_EH_PE_udata4:
       *bytes_read_ptr += 4;
       return (base + bfd_get_32 (unit->abfd, (bfd_byte *) buf));