objdump -S for a different dir.

Dave Hylands dhylands at gmail.com
Sat Dec 10 02:46:26 EST 2011


Hi Jim,

On Fri, Dec 9, 2011 at 10:59 PM, Jim Cromie <jim.cromie at gmail.com> wrote:

> hi folks,
>
> out of habit, I build my kernels to a build tree
> ie use make O=../build-foo just once,
> then cd ../build-foo, and thereafter run make there
>
> this doesnt play nice with objdump -S
> --source
>           Display source code intermixed with disassembly, if
> possible.  Implies -d.
>
> it seems its not possible unless the source and obj are in the same file.
> GDB manages to find the source, whats missing in objdump ?
>
> FWIW, Id love a micro-tutorial on this,
> anyone know how to display, dissect the obj file, debuginfo etc ?
> or can recommend some on-line tome that gets into it at some breadth and
> depth ?
> many many search hits are for quick Q&A that doesnt get deeper than a
> puddle.
>

So I normally do out of tree builds, but I always run make from the source
tree and specify the O= option.

I'm using 3.0.1, and in menuconfig, I went into "Kernel hacking", enabled
"Kernel debugging" and then "Compile the kernel with debug info".

The "Compile the kernel with debug info" option enables CONFIG_DEBUG_INFO
which cause the kernel source to be compiled with the -g option which adds
the debugging information needed to find the source from the objects.

I normally cross compile for the ARM, so I then cd'd into my build tree and
tried arm-linux-gnueabi-objdump -S on a few object files and they all gave
intermingled C and assembler listings.

I tried it using your method and it seemed to work fine for me as well.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111209/8a76be69/attachment.html 


More information about the Kernelnewbies mailing list