Re: How to handle different sizes of pointers in GDB?
Iru Cai via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CANL=iQRVsjvoQ619GcWq0An_uvaydhNNcGxp=OgL+Kv_n=ai3g@mail.gmail.com> |
Thanks for your help. On Mon, Aug 19, 2024 at 6:42 PM Luis Machado <[email protected]> wrote: > > From what I recall, you'll need to make sure your address class is correct > in DWARF for the > different pointer types. Assuming that is correct, have you also > implemented the 3 hooks > that deal with address classes? > > set_gdbarch_address_class_type_flags > set_gdbarch_address_class_type_flags_to_name > set_gdbarch_address_class_name_to_type_flags > > Now I'm using set_gdbarch_address_class_type_flags to make the DWARF reader set the instance_flags of the pointer types, and register a gdbarch_pointer_to_address method. I can see GDB can call my pointer_to_address for each pointer, and type->length() is still 8, but I can get the address class from type->instance_flags() and use it to know the pointer size. > Check the s390 code for some reference in gdb/s390-tdep.c > > Even with those set correct, gdb can still get confused with pointer sizes > depending on > which gdb subsystem is handling it. The type information sometimes gets > lost when we cross > some gdb internal boundaries, and then we fallback to the default pointer > size. > > I hope that helps some. >