From: Sam H. <sam...@gm...> - 2016-05-16 20:13:23
|
Thank you Ed! You're a swell guy, as they say in the 50's. I will reply to you next week, when I get a chance to actually perform these steps. --Sam On Mon, May 16, 2016 at 12:25 PM, Ed Maste <em...@fr...> wrote: > On 15 May 2016 at 22:05, Sam Habiel <sam...@gm...> wrote: >> >> Having said that though, I don't have enough experience in FreeBSD to >> be able to answer all your questions; and I never had to use gdb to >> debug a linked library before. Let me answer and ask in turns: > > Sorry about that - I wasn't sure how much or little detail to provide. > I'm happy to work through the details with you. > >> 1. I downloaded FreeBSD 10.3 and libelf came with the system without >> me installing anything. I presume then it's in the FreeBSD source tree >> since I didn't install that one from the ports tree, correct? > > That's correct. > > jkoshy@ and others developed the BSD-licensed libelf in FreeBSD > starting in the mid-2000s, and it's still that version that's in > FreeBSD 10. > > libelf and other tools moved from FreeBSD to the ELF Tool Chain > project out to ELF Tool Chain later on, and were reimported into > FreeBSD for FreeBSD 11. > >> 2. Where is the upstream version? And how can I compile it to replace >> the ones that my makefile grabs? (I think I can figure this one out, >> but a hint will help). > > You can get it here: > svn checkout svn://svn.code.sf.net/p/elftoolchain/code/trunk elftoolchain-code > A top level 'make' will build libelf, libdwarf, and ELF Tool Chain > versions of strip, nm, size, etc. > > Adding -L (and -I) options to CFLAGS when building your software > should be sufficient to pick it up. You mentioned that it works with a > libelf from ports, and the same scheme used to build against that one > should work for your own elftoolchain build. > >> 3. How do use gdb to step into such a library? Would just typing "s" >> take you into the code if everything else is in place? > > Yes. You can build the library with -g, and -O0 to make debugging work > better. E.g., with flags for 2. and 3.: > CFLAGS="-g -O0 -L/example/src/elftoolchain/libelf > -I/example/src/elftoolchain/libelf" make > > You can set a breakpoint on elf_update, and then step through to find > out where the error is returned. -- Sam Habiel, Pharm.D. VISTA Expertise Network |