Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - gdb code alignment problem: (3 Items)
   
gdb code alignment problem  
We have a customer that sends us core dumps that, when loaded into gdb, do not line up with our code listings.  When we 
do a 'where', it displays a stack that can't possibly exist.  Looking at variables is also not possible.  We have to 
drop down in to assembly code and make guesses to solve problems.  When we disassemble, we discover the problem (and it 
has not been stack corruption) but it is very time consuming.  Yes, we've used the exact code stream in gdb used to 
build the version the customer runs.

We've checked gcc, gdb and library versions used by our program and they all match between us and the customer.  The 
only difference is the customer uses 6.3.0 SP2 and we built on 6.3.0 SP3.
gcc 2.95.3
gdb 5.2.1qnx-nto
libsocket.so.2 => /lib/libsocket.so.2 (0xb8363000)
libm.so.2 => /lib/libm.so.2 (0xb8387000)
libcpp.so.3 => /lib/libcpp.so.3 (0xb83a3000)
librpc.so.2 => /usr/lib/librpc.so.2 (0xb8417000)
libc.so.2 => /usr/lib/ldqnx.so.2 (0xb0300000)


Any suggestions on how to figure out our problem?
Thanks,
Ed
Re: gdb code alignment problem  
Could you try with the latest gdb-6.7?
http://community.qnx.com/sf/frs/do/listReleases/projects.toolchain/frs.gdb

Thanks,

Aleksandar
Re: gdb code alignment problem  
After rereading your post, I don't think you can get any useful results the way you are trying to: it is highly likely 
that between SP2 and SP3 there were changes in shared libraries. It is sufficient to have one function changed and 
everything in the library can be shifted. 

Core is basically a memory dump. Therefore, even the slightest difference in binaries that generated the dump 
(executable + shared object) will make core next to unusable (in terms of debugging it with gdb). Example: core 
specifies current instruction pointer; gdb uses that to lookup binary it has (let's assume its somewhere within libc); 
if libraries differ, what gdb finds will not correspond to what was there on the target. The same applies to unwinding 
process, it will use stack pointer and memory dump from the core, but all addresses will be looked up in local shared 
libraries, in your case SP3 ones which will very likely have something unrelated at those addresses.

Therefore, what you absolutely need is *exactly* the same binareis. Luckily, you do not need to build everything on your
 machine, you can get all the shared libraries involved from your customers' machine, including core and the binary 
causing the core. Having all that in place, you should be able to get meaningful results even with gdb-5.2.1

Hope this helps,

Aleksandar