[binutils-gdb] gdb/linux-tdep: use builtin integer types
Simon Marchi via Gdb-cvs <[email protected]>
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9160fd147675e5a699eafa81970909024bae82aa commit 9160fd147675e5a699eafa81970909024bae82aa Author: Simon Marchi <[email protected]> Date: Tue Mar 10 13:34:45 2026 -0400 gdb/linux-tdep: use builtin integer types I noticed some spots creating new integer types, where I think we could use the builtin types created by create_gdbtypes_data instead. The old code to initialize `short_type` was actually passing the wrong bit length value, so I think this actually fixes a latent bug, although it goes away in a subsequent patch. Change-Id: I8fc71cb75f4450a42f48ba2af5c1163208e58d8c Approved-By: Tom Tromey <[email protected]> Diff: --- gdb/linux-tdep.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 36b7cc95b4e..921bcba9836 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -270,7 +270,7 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch, linux_siginfo_extra_fields extra_fields) { struct linux_gdbarch_data *linux_gdbarch_data; - struct type *int_type, *uint_type, *long_type, *void_ptr_type, *short_type; + struct type *void_ptr_type; struct type *uid_type, *pid_type; struct type *sigval_type, *clock_type; struct type *siginfo_type, *sifields_type; @@ -282,14 +282,12 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch, type_allocator alloc (gdbarch); - int_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch), - 0, "int"); - uint_type = init_integer_type (alloc, gdbarch_int_bit (gdbarch), - 1, "unsigned int"); - long_type = init_integer_type (alloc, gdbarch_long_bit (gdbarch), - 0, "long"); - short_type = init_integer_type (alloc, gdbarch_long_bit (gdbarch), - 0, "short"); + const struct builtin_type *builtin_types = builtin_type (gdbarch); + struct type *int_type = builtin_types->builtin_int; + struct type *uint_type = builtin_types->builtin_unsigned_int; + struct type *long_type = builtin_types->builtin_long; + struct type *short_type = builtin_types->builtin_short; + void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void); /* sival_t */ @@ -1671,9 +1669,7 @@ linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, gdb::unique_xmalloc_ptr<char> ¬e_data, int *note_size) { - type_allocator alloc (gdbarch); - struct type *long_type - = init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "long"); + struct type *long_type = builtin_type (gdbarch)->builtin_long; gdb_byte buf[sizeof (ULONGEST)]; auto_obstack data_obstack, filename_obstack; ULONGEST file_count = 0;