From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Duffek To: kevinb@cygnus.com Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] osfsolib.c: support Tru64 5.x Date: Mon, 14 May 2001 18:34:00 -0000 Message-id: <200105150144.f4F1i2208435@rtl.cygnus.com> References: <1010513070637.ZM31193@ocotillo.lan> X-SW-Source: 2001-05/msg00321.html On 13-May-2001, Kevin Buettner wrote: >Is there any chance that osfsolib.c could be reworked into a solib.c >backend? Okay, I've just finished doing that. It's nice to delete so much duplicated code; the new file is 60% the size of the old one. Is there any pending gdbint.texinfo documentation on how to implement shared library support using solib.c? If not, I volunteer to write a brief explanation, while it's fresh in my mind. I ran into a couple of problems: 1. It's necessary for the target_so_ops.current_sos callback to zero at least the so_list.section field of each element it returns. Otherwise, solib_map_sections() passes a bogus pointer to build_section_table(), which frees the bogus pointer. What do you think about a patch like this? Index: gdb/solist.h =================================================================== diff -up gdb/solist.h gdb/solist.h --- gdb/solist.h Mon May 14 21:17:56 2001 +++ gdb/solist.h Mon May 14 21:17:46 2001 @@ -52,7 +52,9 @@ struct so_list /* The following fields of the structure are built from information gathered from the shared object file itself, and - are initialized when we actually add it to our symbol tables. */ + are set when we actually add it to our symbol tables. + + current_sos must initialize these fields to 0. */ bfd *abfd; char symbols_loaded; /* flag: symbols read in yet? */ 2. Because Tru64 doesn't use ELF binaries, "info sharedlibrary" incorrectly infers the address size to be 32 bits, so output address fields are too narrow: (gdb) inf shared From To Syms Read Shared Object Library 0x3ff800cd8100x3ff801ca290Yes /usr/shlib/libc.so (gdb) Some possible fixes: (a) Default to 64 instead of 32 bits. (b) Use something like bfd_arch_bits_per_address(exec_bfd) instead of or in addition to bfd_get_arch_size (exec_bfd). I'll post the new osfsolib.c patch as soon as I finish regression-testing it. Nick