objdump -S for a different dir.

Jim Cromie jim.cromie at gmail.com
Mon Dec 12 23:28:08 EST 2011


On Sat, Dec 10, 2011 at 12:46 AM, Dave Hylands <dhylands at gmail.com> wrote:
> 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


Thanks Dave,

Id have sworn that after I found -S to not work out-of-tree,
I built in-tree using same .config and -S did work.
But of course that in-tree build is gone and I cant verify.
(it interferes with continued out-of-tree builds, which end with 'run
make mrproper')

Anyway, its certainly working now.
It was probably a different config on a different box, built for a small CF.

thanks again



More information about the Kernelnewbies mailing list