This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00
- From: Josh Martin <Josh dot Martin at abq dot sc dot philips dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 9 Oct 2002 17:42:52 -0600 (MDT)
- Subject: Re: [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00
- Reply-to: Josh Martin <Josh dot Martin at abq dot sc dot philips dot com>
Here's the ChangeLog entry that I forgot to post. Unfortunately I cannot get
expect to work on my system, so I can neither create a test case for this bug,
nor verify other tests after this patch.
- Josh Martin
2002-09-28 Josh Martin <timeslice@iname.com>
* solib.c (info_sharedlibrary_command): Added catch for potential
dereference of NULL pointer (current_target_so_ops).
Fix PR gdb/769.
> For platforms that aren't covered by the gdb/solib-foo.c files and the gdbarch
> platform dependancy files the "info sharedlibrary" command will cause a
> segmentation fault by dereferencing a NULL pointer (current_target_so_ops) in
> gdb/solib.c:update_solib_list. The patch checks if current_target_so_ops is
> NULL, and if so it responds with a "command not implemented" message.
>
> What I really wanted to do was to implement support for HPUX 11.00 64-bit
w/GCC.
> It shouldn't be too difficult as 64-bit GCC in HPUX 11.00 uses GNU ld and the
> "standard" elf64hppa object format. Unfortunately I had no idea how to proceed
> or where to find the neccesary information, thus I stuck with this "band-aid"
> patch.
>
> What follows is a diff -up patch for gdb-5.2.1/gdb/solib.c
>
> - Josh Martin
>
>
> --- solib.c~ Tue Feb 26 18:40:35 2002
> +++ solib.c Sat Sep 28 08:43:03 2002
> @@ -619,6 +619,19 @@ info_sharedlibrary_command (char *ignore
> int addr_width;
> char *addr_fmt;
>
> + /*
> + This is usually defined in a platform specific solib-foo.c/.h
> + file. Eventually the definition should be migrated to the
> + gdbarch files. In the mean time keep this from core dumping on
> + platforms where there is no implementation.
> + */
> + if (current_target_so_ops == NULL)
> + {
> + printf_unfiltered("Shared library info is not yet implemented on this "
> + "platform\n");
> + return;
> + }
> +
> if (TARGET_PTR_BIT == 32)
> {
> addr_width = 8 + 4;
>