This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ensure correct symbol-file when attaching to a (remote) process


On 12-12-21 11:11 AM, Jan Kratochvil wrote:
On Fri, 21 Dec 2012 07:05:37 +0100, Raphael Zulliger wrote:
Is there really no such mechanism in GDB?

There is no such reliable mechanism in general.


One could verify build-id in the target, probably that the build-id note is at
the same VMA as present in the local symbol file.

But then also many binaries/compilers do not provide build-id by default (ld
option --build-id).

Interesting timing. I have just posted http://sourceware.org/ml/gdb-patches/2012-12/msg00776.html addressing this issue.


The check is not exhaustive, but for most practical purposes it should suffice. It verifies that in-memory elf header and pheaders match those found in the bfd.

Of course it will not detect difference in all cases, e.g. very small changes that do not affect loadable segment size. Example:

- static int foo;
- static int bar;
+ static int bar;
+ static int foo;

Still, it should be much better than no check at all.

---
Aleksandar


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]