* PA64 shared library problems with gdb-5.2 (hpux)
@ 2002-07-12 3:20 ross.alexander
2002-08-12 11:17 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: ross.alexander @ 2002-07-12 3:20 UTC (permalink / raw)
To: gdb, binutils
I'm trying to debug PA64 program with relies on shared libraries.
I keep getting problems with pa64_solib_add. I have created a simple
program with uses dlopen to show the problem.
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char *argv[])
{
void *v;
int i, count;
void **handle;
if (argc < 2)
{
printf("%s: <filename>\n", argv[0]);
}
handle = calloc(sizeof(void*), argc);
for (i = 1; i < argc; i++)
{
if ((handle[count] = dlopen(argv[i], RTLD_GLOBAL|RTLD_NOW)) == NULL)
printf("dlopen: %s\n", dlerror());
else
count++;
}
struct load_module_desc mod;
for (i = -1; ; i++)
{
if (dlget(i, &mod, sizeof(mod)))
{
char *name = dlgetname(&mod, sizeof(mod), NULL, 0, 0);
printf("Have index %d %s\n", i, name ? name : "<No name>");
}
else
break;
}
printf("\n");
for (i = 1; ; i++)
{
if (dlgetmodinfo(i, &mod, sizeof(mod), NULL, 0, 0)
{
char *name = dlgetname(&mod, sizeof(mod), NULL, 0, 0);
printf("Have index %d %s\n", i, name ? name : "<No name>");
}
else
break;
}
for (i = 0; i < count; i++)
dlclose(handle[i]);
return 0;
}
./dltest /usr/lib/pa20_64/libm.2
Have index -1 /usr/lib/pa20_64/dld.sl
Have index 0 ./dltest
Have index 1 /lib/pa20_64/libdl.1
Have index 2 /lib/pa20_64/libc.2
Have index 3 /usr/lib/pa20_64/libm.2
Have index 1 /lib/pa20_64/libdl.1
Have index 2 /lib/pa20_64/libc.2
Have index 3 /usr/lib/pa20_64/libm.2
GNU gdb 5.2
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "hppa64-hp-hpux11.00"...
(gdb) run /usr/pa20_64/libm.2
Starting program: /home/ralexand/dltest/dltest /usr/pa20_64/libm.2
dlopen: Unable to find library '/usr/pa20_64/libm.2'.
Have index -1 /usr/lib/pa20_64/dld.sl
Have index 0 /home/ralexand/dltest/dltest
Have index 1 /lib/pa20_64/libdl.1
Have index 2 /lib/pa20_64/libc.2
Have index 1 /lib/pa20_64/libdl.1
Have index 2 /lib/pa20_64/libc.2
Program exited normally.
(gdb) run /usr/lib/pa20_64/libm.2
Starting program: /home/ralexand/dltest/dltest /usr/lib/pa20_64/libm.2
pa64_solib_add, unable to read shared library path.
(gdb) cont
Continuing.
pa64_solib_add, unable to read shared library path.
(gdb)
Continuing.
Have index -1 /usr/lib/pa20_64/dld.sl
Have index 0 /home/ralexand/dltest/dltest
Have index 1 /lib/pa20_64/libdl.1
Have index 2 /lib/pa20_64/libc.2
Have index 3 /usr/lib/pa20_64/libm.2
Have index 1 /lib/pa20_64/libdl.1
Have index 2 /lib/pa20_64/libc.2
Have index 3 /usr/lib/pa20_64/libm.2
Program exited normally.
(gdb) quit
I'm also getting some "found in psymtab but not in symtab" errors, but
they are very difficult to duplicate. I noticed a while back H.J Lu was
reporting something very similar. One thing at a time though.
Cheers,
Ross
---------------------------------------------------------------------------------
Ross Alexander "He knows no more about his
MIS - NEC Europe Limited destiny than a tea leaf knows
Work ph: +44 20 8752 3394 the history of East India Company"
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: PA64 shared library problems with gdb-5.2 (hpux)
2002-07-12 3:20 PA64 shared library problems with gdb-5.2 (hpux) ross.alexander
@ 2002-08-12 11:17 ` Jeff Law
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2002-08-12 11:17 UTC (permalink / raw)
To: ross.alexander; +Cc: gdb, binutils
In message <OF35E93CD6.ADFC4642-ON80256BF4.0033D184@uk.neceur.com>, ross.alexan
der@uk.neceur.com writes:
>I'm trying to debug PA64 program with relies on shared libraries.
>I keep getting problems with pa64_solib_add. I have created a simple
>program with uses dlopen to show the problem.
[ ... ]
This happens when dlgetname returns an error.
Unfortunately, dlgetname is a routine provided by HP, so it may be very
difficult to figure out why it's returning an error.
It might be interesting to know which index it's choking on so that we
can try to guess which library dlgetname is unhappy about.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PA64 shared library problems with gdb-5.2 (hpux)
@ 2002-08-13 9:12 ross.alexander
2002-08-13 10:46 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: ross.alexander @ 2002-08-13 9:12 UTC (permalink / raw)
To: law; +Cc: binutils, gdb
I have a rinky-dinky test program which works fine.
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char *argv[])
{
void *v;
int i, count;
void **handle;
if (argc < 2)
{
printf("%s: <filename>\n", argv[0]);
}
handle = calloc(sizeof(void*), argc);
for (i = 1; i < argc; i++)
{
if ((handle[count] = dlopen(argv[i], RTLD_GLOBAL|RTLD_NOW)) == NULL)
printf("dlopen: %s\n", dlerror());
else
count++;
}
struct load_module_desc mod;
for (i = -1; ; i++)
{
if (dlget(i, &mod, sizeof(mod)))
{
char *name = dlgetname(&mod, sizeof(mod), NULL, 0, 0);
printf("Have index %d %s\n", i, name ? name : "<No name>");
}
else
break;
}
printf("\n");
for (i = 1; ; i++)
{
if (dlgetmodinfo(i, &mod, sizeof(mod), NULL, 0, 0))
{
char *name = dlgetname(&mod, sizeof(mod), NULL, 0, 0);
printf("Have index %d %s\n", i, name ? name : "<No name>");
}
else
break;
}
for (i = 0; i < count; i++)
dlclose(handle[i]);
return 0;
}
for example
ralexand@styx 16:40:33 $./dltest /opt/gtk+-2.0/lib/libgtk-x11-2.0.sl
Have index -1 /usr/lib/pa20_64/dld.sl
Have index 0 ./dltest
Have index 1 /lib/pa20_64/libdl.1
Have index 2 /lib/pa20_64/libc.2
Have index 3 /opt/gtk+-2.0/lib/libgtk-x11-2.0.sl
Have index 4 /opt/gtk+-2.0/lib/libgdk_pixbuf-2.0.sl.0
Have index 5 /opt/gtk+-2.0/lib/libgdk-x11-2.0.sl.0
Have index 6 /opt/gtk+-2.0/lib/libpangox-1.0.sl.0
Have index 7 /opt/gtk+-2.0/lib/libpango-1.0.sl.0
Have index 8 /opt/gtk+-2.0/lib/libatk-1.0.sl.0
Have index 9 /opt/gtk+-2.0/lib/libgobject-2.0.sl.0
Have index 10 /opt/gtk+-2.0/lib/libgmodule-2.0.sl.0
Have index 11 /opt/gtk+-2.0/lib/libglib-2.0.sl.0
Have index 12 /lib/pa20_64/libm.2
Have index 13 /opt/dev64/lib/libintl.sl.2
Have index 14 /opt/dev64/lib/libiconv.sl.3
Have index 15 /opt/dev64/lib/libXext.sl.6.4
Have index 16 /opt/dev64/lib/libX11.sl.6.1
Have index 1 /lib/pa20_64/libdl.1
Have index 2 /lib/pa20_64/libc.2
Have index 3 /opt/gtk+-2.0/lib/libgtk-x11-2.0.sl
Have index 4 /opt/gtk+-2.0/lib/libgdk_pixbuf-2.0.sl.0
Have index 5 /opt/gtk+-2.0/lib/libgdk-x11-2.0.sl.0
Have index 6 /opt/gtk+-2.0/lib/libpangox-1.0.sl.0
Have index 7 /opt/gtk+-2.0/lib/libpango-1.0.sl.0
Have index 8 /opt/gtk+-2.0/lib/libatk-1.0.sl.0
Have index 9 /opt/gtk+-2.0/lib/libgobject-2.0.sl.0
Have index 10 /opt/gtk+-2.0/lib/libgmodule-2.0.sl.0
Have index 11 /opt/gtk+-2.0/lib/libglib-2.0.sl.0
Have index 12 /lib/pa20_64/libm.2
Have index 13 /opt/dev64/lib/libintl.sl.2
Have index 14 /opt/dev64/lib/libiconv.sl.3
Have index 15 /opt/dev64/lib/libXext.sl.6.4
Have index 16 /opt/dev64/lib/libX11.sl.6.1
So it is something to do with the interaction with gdb's copy function.
The problem is I simply don't know enough about gdb internals
to start. I might try to cross build a 64bit version of gdb as a
32bit SOM exe, so I could then run that under a 32bit gdb,
but I'm not sure if that will actually work.
Many thanks
Ross
---------------------------------------------------------------------------------
Ross Alexander "He knows no more about his
MIS - NEC Europe Limited destiny than a tea leaf knows
Work ph: +44 20 8752 3394 the history of East India Company"
Jeff Law
<law@porcupine.slc. To: ross.alexander@uk.neceur.com
redhat.com> cc: gdb@sources.redhat.com, binutils@sources.redhat.com
Subject: Re: PA64 shared library problems with gdb-5.2 (hpux)
12/08/2002 19:20
Please respond to
law
In message <OF35E93CD6.ADFC4642-ON80256BF4.0033D184@uk.neceur.com>,
ross.alexan
der@uk.neceur.com writes:
>I'm trying to debug PA64 program with relies on shared libraries.
>I keep getting problems with pa64_solib_add. I have created a simple
>program with uses dlopen to show the problem.
[ ... ]
This happens when dlgetname returns an error.
Unfortunately, dlgetname is a routine provided by HP, so it may be very
difficult to figure out why it's returning an error.
It might be interesting to know which index it's choking on so that we
can try to guess which library dlgetname is unhappy about.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: PA64 shared library problems with gdb-5.2 (hpux)
2002-08-13 9:12 ross.alexander
@ 2002-08-13 10:46 ` Jeff Law
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2002-08-13 10:46 UTC (permalink / raw)
To: ross.alexander; +Cc: binutils, gdb
In message <OFDB2CC141.AC015F00-ON80256C14.0055FF4D@uk.neceur.com>,
ross.alexander@uk.neceur.com writes:
>So it is something to do with the interaction with gdb's copy function.
I'm not sure what you mean by "gdb's copy function".
There are some differences in how we call dlgetmodinfo and dlgetname
that you might investigate as well.
We also pass our own function for reading memory as well as the load
map we extracted from the dynamic linker earlier. Your testcode doesn't
do that. Who knows, maybe that's the problem.
As a test you could probably change gdb to not pass in a memory read
function or the load map and see if that changes GDB's behavior in a
positive way.
You might also download the lastest wildebeast sources from HP and see
how it handles building the shared library list. Note their code is
probably different in significant ways from the code that's officially
in GDB. HP stopped contributing their changes back to the GDB project
long ago.
>to start. I might try to cross build a 64bit version of gdb as a
>32bit SOM exe, so I could then run that under a 32bit gdb,
>but I'm not sure if that will actually work.
It will work, but only if you go find one or two magic libraries that
HP doesn't provide by default -- those libraries provide the
dlgetmodinfo/dlgetname routines as 32bit SOM objects, but which
read data from the 64bit loader. You may be able to get them from HP's
wildebeast source/objects on the web.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-08-13 17:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-12 3:20 PA64 shared library problems with gdb-5.2 (hpux) ross.alexander
2002-08-12 11:17 ` Jeff Law
2002-08-13 9:12 ross.alexander
2002-08-13 10:46 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox