Victor Chen(deleted)
|
how to load shared libraries symbols automatically
|
Victor Chen(deleted)
05/30/2011 12:15 PM
post86269
|
how to load shared libraries symbols automatically
I'm having problem to load shared libraries symbols automatically on Momentics (4.7.0). The application that I'm
debugging depends on several shared libraries and the "Debug Configurations" is set to "Load shared library symbols
automatically".
However, each time when the GDB hit the entry point (main), I check loaded symbols by "info sharedlibrary" and it shows
all the symbols are not loaded. And if run the command "sharedlibrary" all symbols will be loaded manually. I also
checked "auto-solib-add", and it's set to autoloading on mode. Others such as "solib-search-ath" are also corerct.
Anybody can help me to figure out what's wrong here?
Thanks in advance,
Victor Chen
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
05/30/2011 1:09 PM
post86271
|
Re: how to load shared libraries symbols automatically
Check this
http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/DebuggerFAQ
On 05/30/2011 12:15 PM, Victor Chen wrote:
> I'm having problem to load shared libraries symbols automatically on Momentics (4.7.0). The application that I'm
debugging depends on several shared libraries and the "Debug Configurations" is set to "Load shared library symbols
automatically".
> However, each time when the GDB hit the entry point (main), I check loaded symbols by "info sharedlibrary" and it
shows all the symbols are not loaded. And if run the command "sharedlibrary" all symbols will be loaded manually. I also
checked "auto-solib-add", and it's set to autoloading on mode. Others such as "solib-search-ath" are also corerct.
> Anybody can help me to figure out what's wrong here?
>
> Thanks in advance,
> Victor Chen
>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86269
>
|
|
|
Victor Chen(deleted)
|
Re: how to load shared libraries symbols automatically
|
Victor Chen(deleted)
05/30/2011 5:58 PM
post86277
|
Re: how to load shared libraries symbols automatically
I tried to make sure the search directories of shared libraries and names are matching but these libraries symbols still
can't be loaded by GDB debugger automatically.
One thing makes me feel confusing here is: if I run "sharedlibraries" on GDB command window, these libraries symbols
will be loaded. But from "Modules" window they can't be loaded.
Also there is an error "mi_cmd_var_create: unable to create variable object" showed when GDB is started.
Thanks,
Victor
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
05/30/2011 8:20 PM
post86279
|
Re: how to load shared libraries symbols automatically
Loading shared libraries from IDE using Modules view is buggy - it does
not generate right command to gdb.
But it should have loaded them automatically if you have everything set
correctly. Did you set shared library path?
On 30/05/2011 5:58 PM, Victor Chen wrote:
> I tried to make sure the search directories of shared libraries and names are matching but these libraries symbols
still can't be loaded by GDB debugger automatically.
> One thing makes me feel confusing here is: if I run "sharedlibraries" on GDB command window, these libraries symbols
will be loaded. But from "Modules" window they can't be loaded.
> Also there is an error "mi_cmd_var_create: unable to create variable object" showed when GDB is started.
>
> Thanks,
> Victor
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86277
>
|
|
|
Victor Chen(deleted)
|
Re: how to load shared libraries symbols automatically
|
Victor Chen(deleted)
05/31/2011 1:58 PM
post86296
|
Re: how to load shared libraries symbols automatically
Yes, the shared library path is set correctly because I checked from GDB by "show solib-search-path".
My real trouble here is not to load symbols of shared libraries automatically at the beginnig of starting GDB, but to
load it in the middle of the code. The code is using "dlopen()" to load a specified shared library and the shared
library symbol is not loaded automatically there. Each time I have to set a break point there and do a manually loading
so that I can step in the shared library code to debug.
Is there any way to make GDB debug system to load it automatically?
Thanks again,
Victor
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
05/31/2011 2:15 PM
post86298
|
Re: how to load shared libraries symbols automatically
If everything set up correct it should load them automatically, do you have a checkbox checked "Load shared libraries
automatically" and "Stop on shared library events"?
Btw what IDE are you using? New IDE 4.8 has integration with new debugging framework which may work better.
On 05/31/2011 01:58 PM, Victor Chen wrote:
> Yes, the shared library path is set correctly because I checked from GDB by "show solib-search-path".
> My real trouble here is not to load symbols of shared libraries automatically at the beginnig of starting GDB, but to
load it in the middle of the code. The code is using "dlopen()" to load a specified shared library and the shared
library symbol is not loaded automatically there. Each time I have to set a break point there and do a manually loading
so that I can step in the shared library code to debug.
> Is there any way to make GDB debug system to load it automatically?
>
> Thanks again,
> Victor
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86296
>
|
|
|
Victor Chen(deleted)
|
Re: how to load shared libraries symbols automatically
|
Victor Chen(deleted)
05/31/2011 2:38 PM
post86299
|
Re: how to load shared libraries symbols automatically
These two options have been always checked on my side before starting GDB window.
I'm using 4.7.0 without any applying any patch. Could you tell me how can I upgrade to 4.8?
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
05/31/2011 3:04 PM
post86300
|
Re: how to load shared libraries symbols automatically
Is there spaces in path names by any chance? 4.8 (dev build) available here
http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/DownloadIDE4.8
On 05/31/2011 02:38 PM, Victor Chen wrote:
> These two options have been always checked on my side before starting GDB window.
> I'm using 4.7.0 without any applying any patch. Could you tell me how can I upgrade to 4.8?
>
>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86299
>
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
05/31/2011 3:09 PM
post86301
|
Re: how to load shared libraries symbols automatically
Btw there is neat feature called breakpoint actions, you can add actions to your breakpoints, for example
to load shared library then resume
On 05/31/2011 02:38 PM, Victor Chen wrote:
> These two options have been always checked on my side before starting GDB window.
> I'm using 4.7.0 without any applying any patch. Could you tell me how can I upgrade to 4.8?
>
>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86299
>
|
|
|
Victor Chen(deleted)
|
Re: how to load shared libraries symbols automatically
|
Victor Chen(deleted)
05/31/2011 3:44 PM
post86304
|
Re: how to load shared libraries symbols automatically
I tried Momentics IDE 4.8 but found it still can't load symbols automatically. Here I dumped settings of GDB:
show solib-search-path
The search path for loading non-absolute shared library symbol files is C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle
-v7\\usr\\lib\\graphics\\omap4430;C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib;C:\\p4_workplace\\qnx\\
platformQnx\\stage\\armle-v7\\lib;C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib\\dll.
show solib-absolute-prefix
The current system root is "c:/p4_workplace/qnx/platformQnx/stage".
show auto-solib-add
Autoloading of shared library symbols is on.
|
|
|
Victor Chen(deleted)
|
Re: how to load shared libraries symbols automatically
|
Victor Chen(deleted)
06/01/2011 12:47 PM
post86346
|
Re: how to load shared libraries symbols automatically
I tested another simple application which uses a shared library and looks IDE also can't load symbol automatically. I'm
using Momentics on windows XP. Do you want me send you GDB trace file?
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
06/01/2011 1:32 PM
post86348
|
Re: how to load shared libraries symbols automatically
Sure send the trace...
Checklist
* Set shared libraries path in Debug tab in Launch configuration
* Paths should not have spaces
* Have checkboxes for stop on shared library events and load symbols automatically checked
* Library SO version number and name must match exactly the one on the target
On 06/01/2011 12:47 PM, Victor Chen wrote:
>
> I tested another simple application which uses a shared library and looks IDE also can't load symbol automatically.
I'm using Momentics on windows XP. Do you want me send you GDB trace file?
>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86346
>
|
|
|
Victor Chen(deleted)
|
Re: how to load shared libraries symbols automatically
|
Victor Chen(deleted)
06/01/2011 2:21 PM
post86349
|
Re: how to load shared libraries symbols automatically
Please take a look the GDB traces. And here is the output of a manually loading symbols (I checked library search
directory and auto-load flag and the settings are correct) and manually loading is ok:
MsgNak received - resending
Remote target is little-endian
show solib-search-path
The search path for loading non-absolute shared library symbol files is C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle
-v7\\lib;C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib\\dll;C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-
v7\\usr\\lib;C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib\\graphics\\omap4430.
show auto-solib-add
Autoloading of shared library symbols is on.
info sharedlibrary
From To Syms Read Shared Object Library
0x78070000 0x78089608 No C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib/libscreen.so.1
0x01050000 0x010cc3b8 No C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib/libc.so.3
sharedlibrary
Reading symbols from C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib/libscreen.so.1...done.
Loaded symbols for C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib/libscreen.so.1
Reading symbols from C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib/libc.so.3...done.
Loaded symbols for C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib/libc.so.3
Thanks,
Victor
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
06/01/2011 3:15 PM
post86351
|
Re: how to load shared libraries symbols automatically
You libc does not match it will cause gdb not to stop on shared library events
On 06/01/2011 02:21 PM, Victor Chen wrote:
>
> Please take a look the GDB traces. And here is the output of a manually loading symbols (I checked library search
directory and auto-load flag and the settings are correct) and manually loading is ok:
>
> MsgNak received - resending
> Remote target is little-endian
>
> show solib-search-path
> The search path for loading non-absolute shared library symbol files is C:\\p4_workplace\\qnx\\platformQnx\\stage\\
armle-v7\\lib;C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib\\dll;C:\\p4_workplace\\qnx\\platformQnx\\stage\\
armle-v7\\usr\\lib;C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib\\graphics\\omap4430.
>
> show auto-solib-add
> Autoloading of shared library symbols is on.
>
> info sharedlibrary
> From To Syms Read Shared Object Library
> 0x78070000 0x78089608 No C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib/libscreen.so.1
> 0x01050000 0x010cc3b8 No C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib/libc.so.3
>
> sharedlibrary
> Reading symbols from C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib/libscreen.so.1...done.
> Loaded symbols for C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\usr\\lib/libscreen.so.1
> Reading symbols from C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib/libc.so.3...done.
> Loaded symbols for C:\\p4_workplace\\qnx\\platformQnx\\stage\\armle-v7\\lib/libc.so.3
>
>
> Thanks,
> Victor
>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86349
|
|
|
Victor Chen(deleted)
|
Re: how to load shared libraries symbols automatically
|
Victor Chen(deleted)
06/01/2011 4:09 PM
post86352
|
Re: how to load shared libraries symbols automatically
Thanks. I also noticed the warning there:
&"warning: Host file C:/QNX650/target/qnx6/armle-v7/usr/lib/ldqnx.so.2 does not match target\
file /usr/lib/ldqnx.so.2\n"
So Momentics by default is using libc from QNX install directory (C:/QNX650/target/qnx6/armle-v7/usr/lib/ldqnx.so.2)?
And can we override it by libc from stage directory so that it matches the target system?
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
06/01/2011 4:14 PM
post86353
|
Re: how to load shared libraries symbols automatically
back it up and copy one from stage into that location?
On 06/01/2011 04:09 PM, Victor Chen wrote:
>
> Thanks. I also noticed the warning there:
> &"warning: Host file C:/QNX650/target/qnx6/armle-v7/usr/lib/ldqnx.so.2 does not match target\
> file /usr/lib/ldqnx.so.2\n"
>
> So Momentics by default is using libc from QNX install directory (C:/QNX650/target/qnx6/armle-v7/usr/lib/ldqnx.so.2)?
And can we override it by libc from stage directory so that it matches the target system?
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86352
>
|
|
|
Victor Chen(deleted)
|
Re: how to load shared libraries symbols automatically
|
Victor Chen(deleted)
06/02/2011 2:41 PM
post86408
|
Re: how to load shared libraries symbols automatically
|
|
|
Ming Liu(deleted)
|
Re: how to load shared libraries symbols automatically
|
Ming Liu(deleted)
06/10/2011 12:10 PM
post86554
|
Re: how to load shared libraries symbols automatically
Hi, I've been seeing this issue as well, where shared library symbols aren't loaded automatically after dlopen(). I've
tried following the advice in this thread but I'm still seeing this issue.
At the breakpoint in main(), I've been checking the gdb settings (solib-search-path, auto-solib-add, stop-on-solib-
events), and the first two are correct (I then manually set stop-on-solib-events to 1, but it doesn't stop).
I'm using Momentics version 4.8.0 (build id 201105051724) with gdb version 6.8 rev 506.
The shared libraries are being built with debug info and with -Wl,-export-dynamic. The soname matches the library
filename. If I force symbols to load with "sha" it works, but not automatically.
Shared libraries are being uploaded without stripping debug information. Shared library paths are set (and verified with
solib-search-path). I've also tried setting the env var LD_LIBRARY_PATH to the upload path and QNX_TARGET to /. There
are no spaces in the path name.
I'm seeing a libc mismatch, but from the debugger FAQ it seems this might be tricky to fix.
I've attached gdb trace. Could you please tell me what I'm doing wrong? Thanks!
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
06/10/2011 1:19 PM
post86555
|
Re: how to load shared libraries symbols automatically
It is caused entirely by library mismatch. You have to fix that in order to get gdb stop on library events.
On 06/10/2011 12:10 PM, Ming Liu wrote:
> Hi, I've been seeing this issue as well, where shared library symbols aren't loaded automatically after dlopen(). I've
tried following the advice in this thread but I'm still seeing this issue.
>
> At the breakpoint in main(), I've been checking the gdb settings (solib-search-path, auto-solib-add, stop-on-solib-
events), and the first two are correct (I then manually set stop-on-solib-events to 1, but it doesn't stop).
>
> I'm using Momentics version 4.8.0 (build id 201105051724) with gdb version 6.8 rev 506.
>
> The shared libraries are being built with debug info and with -Wl,-export-dynamic. The soname matches the library
filename. If I force symbols to load with "sha" it works, but not automatically.
>
> Shared libraries are being uploaded without stripping debug information. Shared library paths are set (and verified
with solib-search-path). I've also tried setting the env var LD_LIBRARY_PATH to the upload path and QNX_TARGET to /.
There are no spaces in the path name.
>
> I'm seeing a libc mismatch, but from the debugger FAQ it seems this might be tricky to fix.
>
> I've attached gdb trace. Could you please tell me what I'm doing wrong? Thanks!
>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86554
|
|
|
Aleksandar Ristovski(deleted)
|
Re: how to load shared libraries symbols automatically
|
Aleksandar Ristovski(deleted)
06/10/2011 1:22 PM
post86556
|
Re: how to load shared libraries symbols automatically
I believe Elena has already suggested that you have a mismatch:
On 06/10/2011 12:10 PM, Ming Liu wrote:
> 701,560&"warning: Host file C:\\\\bbndk090\\\\target\\\\qnx6\\\\x86\\\\lib/libc.so.3 does not match\
> target file.\n"
you need exact version of the binaries. A way to obtain them is to check
them out from deckard-65x repository. Let me know if you need
instructions on how to do that.
|
|
|
Ming Liu(deleted)
|
Re: how to load shared libraries symbols automatically
|
Ming Liu(deleted)
06/10/2011 1:57 PM
post86558
|
Re: how to load shared libraries symbols automatically
Thank you for your responses. Yes, please send me instructions for getting the exact version.
|
|
|
Aleksandar Ristovski(deleted)
|
Re: how to load shared libraries symbols automatically
|
Aleksandar Ristovski(deleted)
06/10/2011 2:09 PM
post86559
|
Re: how to load shared libraries symbols automatically
Andy expressed interest to put instructions on a wiki page.
He will update this thread once the wiki is up.
---
Aleksandar
On 06/10/2011 01:57 PM, Ming Liu wrote:
> Thank you for your responses. Yes, please send me instructions for getting the exact version.
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86558
>
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
06/10/2011 2:20 PM
post86561
|
Re: how to load shared libraries symbols automatically
See "How to fix library mismatch"
http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/DebuggerFAQ
If you think there is another way please update the wiki
On 06/10/2011 02:09 PM, Aleksandar Ristovski wrote:
> Andy expressed interest to put instructions on a wiki page.
>
> He will update this thread once the wiki is up.
>
> ---
> Aleksandar
>
> On 06/10/2011 01:57 PM, Ming Liu wrote:
>> Thank you for your responses. Yes, please send me instructions for getting the exact version.
>>
>>
>>
>> _______________________________________________
>>
>> QNX Momentics Getting Started
>> http://community.qnx.com/sf/go/post86558
>>
>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86559
>
|
|
|
Aleksandar Ristovski(deleted)
|
Re: how to load shared libraries symbols automatically
|
Aleksandar Ristovski(deleted)
06/10/2011 2:23 PM
post86562
|
Re: how to load shared libraries symbols automatically
His problem is:
"If it is libc this is a lot more difficult ...."
On 06/10/2011 02:20 PM, Elena Laskavaia wrote:
> See "How to fix library mismatch"
> http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/DebuggerFAQ
>
> If you think there is another way please update the wiki
>
> On 06/10/2011 02:09 PM, Aleksandar Ristovski wrote:
>> Andy expressed interest to put instructions on a wiki page.
>>
>> He will update this thread once the wiki is up.
>>
>> ---
>> Aleksandar
>>
>> On 06/10/2011 01:57 PM, Ming Liu wrote:
>>> Thank you for your responses. Yes, please send me instructions for getting the exact version.
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> QNX Momentics Getting Started
>>> http://community.qnx.com/sf/go/post86558
>>>
>>
>>
>>
>>
>> _______________________________________________
>>
>> QNX Momentics Getting Started
>> http://community.qnx.com/sf/go/post86559
>>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86561
>
|
|
|
Elena Laskavaia
|
Re: how to load shared libraries symbols automatically
|
Elena Laskavaia
06/10/2011 2:25 PM
post86564
|
Re: how to load shared libraries symbols automatically
Is anything else we can add to this wiki?
On 06/10/2011 02:23 PM, Aleksandar Ristovski wrote:
> His problem is:
>
> "If it is libc this is a lot more difficult ...."
>
>
> On 06/10/2011 02:20 PM, Elena Laskavaia wrote:
>> See "How to fix library mismatch"
>> http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/DebuggerFAQ
>>
>> If you think there is another way please update the wiki
>>
>> On 06/10/2011 02:09 PM, Aleksandar Ristovski wrote:
>>> Andy expressed interest to put instructions on a wiki page.
>>>
>>> He will update this thread once the wiki is up.
>>>
>>> ---
>>> Aleksandar
>>>
>>> On 06/10/2011 01:57 PM, Ming Liu wrote:
>>>> Thank you for your responses. Yes, please send me instructions for getting the exact version.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>>
>>>> QNX Momentics Getting Started
>>>> http://community.qnx.com/sf/go/post86558
>>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> QNX Momentics Getting Started
>>> http://community.qnx.com/sf/go/post86559
>>>
>>
>>
>>
>> _______________________________________________
>>
>> QNX Momentics Getting Started
>> http://community.qnx.com/sf/go/post86561
>>
>
>
>
>
> _______________________________________________
>
> QNX Momentics Getting Started
> http://community.qnx.com/sf/go/post86562
>
|
|
|
|