Kevin Stallard(deleted)
12/06/2010 10:43 PM
post77537
|
I'm having some difficulty with GDB (ver 6.8 update 5). I'm remote debugging on my target via Eclipse.
I am debugging a shared library that does a dlopen(). Unfortunately, GDB is not detecting this and the shared library
that was loaded does not show up in GDB's list (info shared)
It shows up using pidin mem, but I can't get GDB to register that it is loaded.
Any ideas?
Thanks
Kevin
|
|
|
Kevin Stallard(deleted)
12/06/2010 10:52 PM
post77539
|
For kicks, I had the shared library loaded in main(). It doesn't show up, nor does GDB admit it is loaded.
-Kevin
|
|
|
Aleksandar Ristovski(deleted)
|
|
Aleksandar Ristovski(deleted)
12/06/2010 10:53 PM
post77540
|
This typically happens when there is a mismatch between libc on the
target and the one gdb uses on the host side.
To make sure you have matching libc-s, please double-check gdb log in
your IDE and search for "warning:" coming from gdb. If there is a
warning mentioning mismatch, then that would explain the problem.
Could you check that?
Thanks,
Aleksandar
On Mon, 2010-12-06 at 22:43 -0500, Kevin Stallard wrote:
> I'm having some difficulty with GDB (ver 6.8 update 5). I'm remote
> debugging on my target via Eclipse.
>
> I am debugging a shared library that does a dlopen(). Unfortunately,
> GDB is not detecting this and the shared library that was loaded does
> not show up in GDB's list (info shared)
>
> It shows up using pidin mem, but I can't get GDB to register that it
> is loaded.
>
> Any ideas?
>
> Thanks
> Kevin
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post77537
>
>
>
|
|
|
Kevin Stallard(deleted)
12/06/2010 10:59 PM
post77541
|
Thank you Aleksandar,
I don't see a warning, expect that it can't find 'xpt.c'. Here is the GDB log:
MsgNak received - resending
Remote target is big-endian
attach 245785
[New pid 245785 tid 1]
0xfe33ea48 in ?? ()
No source file named xpt.c.
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
Stopped due to shared library event
> This typically happens when there is a mismatch between libc on the
> target and the one gdb uses on the host side.
>
> To make sure you have matching libc-s, please double-check gdb log in
> your IDE and search for "warning:" coming from gdb. If there is a
> warning mentioning mismatch, then that would explain the problem.
>
> Could you check that?
>
> Thanks,
>
> Aleksandar
>
>
> On Mon, 2010-12-06 at 22:43 -0500, Kevin Stallard wrote:
> > I'm having some difficulty with GDB (ver 6.8 update 5). I'm remote
> > debugging on my target via Eclipse.
> >
> > I am debugging a shared library that does a dlopen(). Unfortunately,
> > GDB is not detecting this and the shared library that was loaded does
> > not show up in GDB's list (info shared)
> >
> > It shows up using pidin mem, but I can't get GDB to register that it
> > is loaded.
> >
> > Any ideas?
> >
> > Thanks
> > Kevin
> >
> >
> >
> >
> > _______________________________________________
> >
> > General
> > http://community.qnx.com/sf/go/post77537
> >
> >
> >
>
|
|
|
Elena Laskavaia
12/06/2010 11:05 PM
post77542
|
Check this FAQ
http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/DebuggerFAQ
(it about IDE but it is applicable for command line too with some minor
changes)'
On 06/12/2010 10:59 PM, Kevin Stallard wrote:
> Thank you Aleksandar,
>
> I don't see a warning, expect that it can't find 'xpt.c'. Here is the GDB log:
>
> MsgNak received - resending
> Remote target is big-endian
> attach 245785
> [New pid 245785 tid 1]
> 0xfe33ea48 in ?? ()
> No source file named xpt.c.
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
>
>
>> This typically happens when there is a mismatch between libc on the
>> target and the one gdb uses on the host side.
>>
>> To make sure you have matching libc-s, please double-check gdb log in
>> your IDE and search for "warning:" coming from gdb. If there is a
>> warning mentioning mismatch, then that would explain the problem.
>>
>> Could you check that?
>>
>> Thanks,
>>
>> Aleksandar
>>
>>
>> On Mon, 2010-12-06 at 22:43 -0500, Kevin Stallard wrote:
>>> I'm having some difficulty with GDB (ver 6.8 update 5). I'm remote
>>> debugging on my target via Eclipse.
>>>
>>> I am debugging a shared library that does a dlopen(). Unfortunately,
>>> GDB is not detecting this and the shared library that was loaded does
>>> not show up in GDB's list (info shared)
>>>
>>> It shows up using pidin mem, but I can't get GDB to register that it
>>> is loaded.
>>>
>>> Any ideas?
>>>
>>> Thanks
>>> Kevin
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> General
>>> http://community.qnx.com/sf/go/post77537
>>>
>>>
>>>
>
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post77541
>
|
|
|
Kevin Stallard(deleted)
12/06/2010 11:10 PM
post77546
|
Thanks Elena,
I hope you are doing well.
I'm not having trouble getting symbols to load, it that the shared library won't even show up in the list.
Unless there was something else in the FAQ that I missed that you were wanting me to see....
Thanks
Kevin
|
|
|
Elena Laskavaia
12/06/2010 11:14 PM
post77548
|
Do you check return code of dlopen? Did it actually succeed?
On 06/12/2010 11:10 PM, Kevin Stallard wrote:
> Thanks Elena,
>
> I hope you are doing well.
>
> I'm not having trouble getting symbols to load, it that the shared library won't even show up in the list.
>
> Unless there was something else in the FAQ that I missed that you were wanting me to see....
>
> Thanks
> Kevin
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post77546
>
|
|
|
Kevin Stallard(deleted)
12/06/2010 11:17 PM
post77549
|
Yeah...it's succeeds. pidin mem shows it there and associated with the process being debugged....
|
|
|
Aleksandar Ristovski(deleted)
|
|
Aleksandar Ristovski(deleted)
12/06/2010 11:25 PM
post77551
|
What is the QNX version you are running?
On Mon, 2010-12-06 at 23:17 -0500, Kevin Stallard wrote:
> Yeah...it's succeeds. pidin mem shows it there and associated with
> the process being debugged....
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post77549
>
>
>
|
|
|
Kevin Stallard(deleted)
12/06/2010 11:32 PM
post77552
|
6.3.2
One other item of interest. As I sit here muttering to myself, I realized that earlier today, it was showing up just
fine. I'm trying to figure out what I may have changed since then. But it was working at one point.
Kevin
|
|
|
Aleksandar Ristovski(deleted)
|
|
Aleksandar Ristovski(deleted)
12/06/2010 11:34 PM
post77554
|
What flags do you pass to dlopen?
Actually, maybe it's better if you could attach your test-case.
Thanks,
Aleksandar
On Mon, 2010-12-06 at 23:32 -0500, Kevin Stallard wrote:
> 6.3.2
>
> One other item of interest. As I sit here muttering to myself, I
> realized that earlier today, it was showing up just fine. I'm trying
> to figure out what I may have changed since then. But it was working
> at one point.
>
> Kevin
>
>
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post77552
>
>
>
|
|
|
Kevin Stallard(deleted)
12/06/2010 11:37 PM
post77556
|
Here's main.
int main(int argc, char *argv[])
{
ThreadCtl( _NTO_TCTL_IO, 0 );
void *dll = dlopen( "io-blk_g.so", RTLD_NOW );
TAILQ_INIT(&sd_ctrl.m_hlist);
sd_ctrl.m_nhba = 0;
return cam_configure(&sim_module, 1, argc, argv);
}
I moved the dlopen to main so I could eliminate the possibility that the problem stems from dlopen being called from
another dll.
As for attaching a test case, the io-blk and cam code I have is now protected, so I probably shouldn't post it all in
public....
Kevin
|
|
|
Kevin Stallard(deleted)
12/06/2010 11:40 PM
post77557
|
I've also renamed io-blk_g.so to io-blk.so, re-built my image, and changed main() to dlopen io-blk.so (as opposed to io-
blk_g.so).
Kevin
|
|
|
Aleksandar Ristovski(deleted)
|
|
Aleksandar Ristovski(deleted)
12/06/2010 11:06 PM
post77543
|
What is the version you are running on the target?
If you do
(gdb) info sharedlibrary
in gdb window, after dlopen, what does it output?
On Mon, 2010-12-06 at 22:59 -0500, Kevin Stallard wrote:
> Thank you Aleksandar,
>
> I don't see a warning, expect that it can't find 'xpt.c'. Here is the
> GDB log:
>
> MsgNak received - resending
> Remote target is big-endian
> attach 245785
> [New pid 245785 tid 1]
> 0xfe33ea48 in ?? ()
> No source file named xpt.c.
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
> Stopped due to shared library event
>
>
> > This typically happens when there is a mismatch between libc on the
> > target and the one gdb uses on the host side.
> >
> > To make sure you have matching libc-s, please double-check gdb log
> in
> > your IDE and search for "warning:" coming from gdb. If there is a
> > warning mentioning mismatch, then that would explain the problem.
> >
> > Could you check that?
> >
> > Thanks,
> >
> > Aleksandar
> >
> >
> > On Mon, 2010-12-06 at 22:43 -0500, Kevin Stallard wrote:
> > > I'm having some difficulty with GDB (ver 6.8 update 5). I'm
> remote
> > > debugging on my target via Eclipse.
> > >
> > > I am debugging a shared library that does a dlopen().
> Unfortunately,
> > > GDB is not detecting this and the shared library that was loaded
> does
> > > not show up in GDB's list (info shared)
> > >
> > > It shows up using pidin mem, but I can't get GDB to register that
> it
> > > is loaded.
> > >
> > > Any ideas?
> > >
> > > Thanks
> > > Kevin
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > >
> > > General
> > > http://community.qnx.com/sf/go/post77537
> > >
> > >
> > >
> >
>
>
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post77541
>
>
>
|
|
|
Kevin Stallard(deleted)
12/06/2010 11:07 PM
post77544
|
info shared
From To Syms Read Shared Object Library
0xfe378000 0xfe3a4480 Yes C:\home\Kevin\Projects\IDDAerospace\IDDAerospace\Code\changes\cam\cam\ppc\so.be.g/
libcam_g.so.2
0xfe3a5000 0xfe3c78a0 Yes C:/QNX632/target/qnx6/ppcbe/lib/libm.so.2
0xfe300000 0xfe377eac Yes C:/QNX632/target/qnx6/ppcbe/lib/libc.so.2
Thanks
-Kevin
|
|
|
Kevin Stallard(deleted)
12/06/2010 11:09 PM
post77545
|
io-blk is the missing shared library.
|
|
|
Kevin Stallard(deleted)
12/06/2010 11:50 PM
post77558
|
In thinking about this, I guess the question to ask is
1. Is the dynamic linker notifying GDB? Does it do this through pdebug, or directly through qconn?
2. Is there something I could look at to determine if the load event is being sent? Do you think I could use wireshark
to see if the event is being sent?
3. If the event is getting to GDB, why is it ignoring it?
Comments?
|
|
|
Aleksandar Ristovski(deleted)
|
|
Aleksandar Ristovski(deleted)
12/06/2010 11:54 PM
post77559
|
1) Yes, indirectly. It goes through pdebug.
2) I can say for sure GDB is receiving shared library events (as per the
log you posted). It also sees the loaded shared object, as per your
'info sharedlibrary'.
3) I don't know. Is io-blk something you built? If so, I would examine
carefully if all is as expected with it, e.g., you could post output
from
ntoppc-readelf -d io-blk.so
^^^^^^^^^
the one you built.
On Mon, 2010-12-06 at 23:50 -0500, Kevin Stallard wrote:
> In thinking about this, I guess the question to ask is
> 1. Is the dynamic linker notifying GDB? Does it do this through
> pdebug, or directly through qconn?
>
> 2. Is there something I could look at to determine if the load event
> is being sent? Do you think I could use wireshark to see if the event
> is being sent?
>
> 3. If the event is getting to GDB, why is it ignoring it?
>
> Comments?
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post77558
>
>
>
|
|
|
Kevin Stallard(deleted)
12/07/2010 12:06 AM
post77560
|
> 2) I can say for sure GDB is receiving shared library events (as per the
> log you posted). It also sees the loaded shared object, as per your
> 'info sharedlibrary'.
Actually, the shared object I'm loading doesn't show up in the list. cam is there, but not io-blk. Since it wasn't
showing up, I was wondering if perhaps the load library event for that dlopen() call was getting missed somehow.
Below is the output and yes, it is a custom io-blk build.
Dynamic segment at offset 0x2a998 contains 18 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.2]
0x0000000e (SONAME) Library soname: [io-blk_g.so]
0x00000010 (SYMBOLIC) 0x0
0x0000000c (INIT) 0x28ff0
0x0000000d (FINI) 0x29010
0x00000004 (HASH) 0xb4
0x00000005 (STRTAB) 0x2774
0x00000006 (SYMTAB) 0xbc4
0x0000000a (STRSZ) 5686 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000003 (PLTGOT) 0x2bea8
0x00000002 (PLTRELSZ) 1596 (bytes)
0x00000014 (PLTREL) RELA
0x00000017 (JMPREL) 0x54b0
0x00000007 (RELA) 0x3dac
0x00000008 (RELASZ) 7536 (bytes)
0x00000009 (RELAENT) 12 (bytes)
0x00000000 (NULL) 0x0
> 1) Yes, indirectly. It goes through pdebug.
>
> 2) I can say for sure GDB is receiving shared library events (as per the
> log you posted). It also sees the loaded shared object, as per your
> 'info sharedlibrary'.
>
> 3) I don't know. Is io-blk something you built? If so, I would examine
> carefully if all is as expected with it, e.g., you could post output
> from
> ntoppc-readelf -d io-blk.so
> ^^^^^^^^^
> the one you built.
>
>
>
> On Mon, 2010-12-06 at 23:50 -0500, Kevin Stallard wrote:
> > In thinking about this, I guess the question to ask is
> > 1. Is the dynamic linker notifying GDB? Does it do this through
> > pdebug, or directly through qconn?
> >
> > 2. Is there something I could look at to determine if the load event
> > is being sent? Do you think I could use wireshark to see if the event
> > is being sent?
> >
> > 3. If the event is getting to GDB, why is it ignoring it?
> >
> > Comments?
> >
> >
> >
> > _______________________________________________
> >
> > General
> > http://community.qnx.com/sf/go/post77558
> >
> >
> >
>
|
|
|
Kevin Stallard(deleted)
12/07/2010 12:32 AM
post77561
|
It looks like profiling may have been the problem.
I realized I had it turned on, I turned it off and rebuilt the application, now io-blk shows up. Something to do with
the profiling library perhaps?
I really appreciate all your help tonight. If this is a known issue and there is a work around, I'd be grateful to know
.
Thanks
Kevin
|
|
|
Aleksandar Ristovski(deleted)
|
|
Aleksandar Ristovski(deleted)
12/07/2010 9:29 AM
post77598
|
On Tue, 2010-12-07 at 00:32 -0500, Kevin Stallard wrote:
> It looks like profiling may have been the problem.
> I realized I had it turned on, I turned it off and rebuilt the
> application, now io-blk shows up. Something to do with the profiling
> library perhaps?
>
> I really appreciate all your help tonight. If this is a known issue
> and there is a work around, I'd be grateful to know.
Could you try a debug session from command line? (and with the
problematic combination of profiled binaries)?
Thanks,
Aleksandar
|
|
|
Kevin Stallard(deleted)
12/07/2010 1:34 PM
post77653
|
Same...here's the output...io-blk was loaded, but did not show up in the symbol table.
>ntoppc-gdb ppc/o.be.g/devb-sd_g
GNU gdb 6.8 qnx-nto update 5 (rev. 398)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i386-mingw32msvc --target=powerpc-unknown-nto-qnx6.3.0"...
(gdb) target qnx 192.168.200.10:8000
Remote debugging using 192.168.200.10:8000
MsgNak received - resending
Remote target is big-endian
(gdb) attach 335896
Attaching to pid 335896 tid 0
[New pid 335896 tid 1]
0xfe33ea48 in ?? ()
(gdb) b main
Breakpoint 1 at 0x4804d594: file C:/home/Kevin/Projects/IDDAerospace/IDDAerospace/Code/changes/devb-sd/devb-sd.c, line
63.
(gdb) c
Continuing.
Error while mapping shared library sections:
libcam_g.so.2: No such file or directory.
Breakpoint 1, main (argc=1, argv=0x4803feb4) at C:/home/Kevin/Projects/IDDAerospace/IDDAerospace/Code/changes/devb-sd/
devb-sd.c:63
63 ThreadCtl( _NTO_TCTL_IO, 0 );
(gdb) s
64 void *dll = dlopen( "/proc/boot/io-blk_g.so", RTLD_NOW );
(gdb) s
65 TAILQ_INIT(&sd_ctrl.m_hlist);
(gdb) info shared
From To Syms Read Shared Object Library
No libcam_g.so.2
0xfe3a5000 0xfe3c78a0 Yes C:/QNX632/target/qnx6/ppcbe/lib/libm.so.2
0xfe300000 0xfe377eac Yes C:/QNX632/target/qnx6/ppcbe/lib/libc.so.2
(gdb) print dll
$1 = (void *) 0x48079060
(gdb)
|
|
|
Elena Laskavaia
12/07/2010 1:37 PM
post77654
|
Hmm. Any directories with spaces on the host involved in this?
On 07/12/10 01:34 PM, Kevin Stallard wrote:
> Same...here's the output...io-blk was loaded, but did not show up in the symbol table.
|
|
|
Kevin Stallard(deleted)
12/07/2010 1:47 PM
post77655
|
I've been careful to avoid spaces. I don't think this is the case...
Thanks
Kevin
|
|
|
|