* Re: [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00
@ 2002-10-09 16:43 Josh Martin
2002-11-25 15:08 ` Kevin Buettner
2002-12-05 16:56 ` Kevin Buettner
0 siblings, 2 replies; 6+ messages in thread
From: Josh Martin @ 2002-10-09 16:43 UTC (permalink / raw)
To: gdb-patches
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;
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00
2002-10-09 16:43 [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00 Josh Martin
@ 2002-11-25 15:08 ` Kevin Buettner
2002-12-05 16:56 ` Kevin Buettner
1 sibling, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2002-11-25 15:08 UTC (permalink / raw)
To: Josh Martin, gdb-patches
On Oct 9, 5:42pm, Josh Martin wrote:
> 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.
Josh,
Your patch looks reasonable. I think I'd prefer to see a call to error()
instead of printf_unfiltered() though:
> > + printf_unfiltered("Shared library info is not yet implemented on this "
> > + "platform\n");
Sorry for taking so long on this.
Kevin
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00
2002-10-09 16:43 [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00 Josh Martin
2002-11-25 15:08 ` Kevin Buettner
@ 2002-12-05 16:56 ` Kevin Buettner
1 sibling, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2002-12-05 16:56 UTC (permalink / raw)
To: Josh Martin, gdb-patches
On Oct 9, 5:42pm, Josh Martin wrote:
> 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.
I've been thinking about this patch some more.
What I'm wondering is why your hpux target uses solib.o without defining
an appropriate solib-hpux.c (or whatever) file?
Anyway, with regard to catching potential dereferences to a NULL
current_target_so_ops, I'm inclined to handle this either via
a gdb_assert() or an explicit check (perhaps in the TARGET_SO_* macros)
with a call to internal_error(). Because that's really what it is. We
shouldn't be in solib.c at all if an appropriate backend hasn't been
defined.
Kevin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00
@ 2002-12-09 18:56 Josh Martin
0 siblings, 0 replies; 6+ messages in thread
From: Josh Martin @ 2002-12-09 18:56 UTC (permalink / raw)
To: Josh.Martin, gdb-patches, kevinb
> On Oct 9, 5:42pm, Josh Martin wrote:
>
> > 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.
>
> Date: Thu, 5 Dec 2002 17:54:05 -0700
> From: Kevin Buettner <kevinb@redhat.com>
>
> I've been thinking about this patch some more.
>
> What I'm wondering is why your hpux target uses solib.o without defining
> an appropriate solib-hpux.c (or whatever) file?
>
> Anyway, with regard to catching potential dereferences to a NULL
> current_target_so_ops, I'm inclined to handle this either via
> a gdb_assert() or an explicit check (perhaps in the TARGET_SO_* macros)
> with a call to internal_error(). Because that's really what it is. We
> shouldn't be in solib.c at all if an appropriate backend hasn't been
> defined.
>
> Kevin
I'm not involved with the HPUX maintainance/port of GDB, so I'm not completely
sure, but I think there already is a backend for the HPUX libarary format (which
is in 32-bit), but on a 64-bit HP platform the libraries are written in a 64-bit
ELF format, at least with gcc and GNU ld, which goes through pa64solib.c. I
also noticed that GDB isn't reading the core files properly, it is still trying
to open them in the 32-bit format, but I'm not sure if this is a problem with
GDB, or the BFD libraries.
- Josh Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00
@ 2002-11-26 15:03 Josh Martin
0 siblings, 0 replies; 6+ messages in thread
From: Josh Martin @ 2002-11-26 15:03 UTC (permalink / raw)
To: Josh.Martin, gdb-patches, kevinb
I was not familiar with how gdb called errors, so I just looked at similar code
from that source file. If what I used was not the correct method then by all
means change the patch, or point me to the definition of error() so I can change
it appropriately.
- Josh Martin
> Date: Mon, 25 Nov 2002 16:08:20 -0700
> From: Kevin Buettner <kevinb@redhat.com>
> To: Josh Martin <Josh.Martin@abq.sc.philips.com>,
gdb-patches@sources.redhat.com
> Subject: Re: [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1
HPUX64 11.00
> MIME-Version: 1.0
>
> On Oct 9, 5:42pm, Josh Martin wrote:
>
> > 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.
>
> Josh,
>
> Your patch looks reasonable. I think I'd prefer to see a call to error()
> instead of printf_unfiltered() though:
>
> > > + printf_unfiltered("Shared library info is not yet implemented on
this "
> > > + "platform\n");
>
> Sorry for taking so long on this.
>
> Kevin
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00
@ 2002-09-28 10:23 Josh Martin
0 siblings, 0 replies; 6+ messages in thread
From: Josh Martin @ 2002-09-28 10:23 UTC (permalink / raw)
To: gdb-patches
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;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-12-10 2:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-09 16:43 [PATCH]: gdb/769 - segv fault on "info shared" on GDB 5.2.1 HPUX64 11.00 Josh Martin
2002-11-25 15:08 ` Kevin Buettner
2002-12-05 16:56 ` Kevin Buettner
-- strict thread matches above, loose matches on Subject: below --
2002-12-09 18:56 Josh Martin
2002-11-26 15:03 Josh Martin
2002-09-28 10:23 Josh Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox