kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: objdump -S for a different dir.
Date: Fri, 9 Dec 2011 23:46:26 -0800	[thread overview]
Message-ID: <CABi1daFLTLovGhNngLmYAt0Y-pvqO7q+2xcGvJNFhig-nbZpag@mail.gmail.com> (raw)
In-Reply-To: <CAJfuBxxSeL3xm1CXw3DEvB93GW6D6H931-D==Fj+kOG0fr7WvA@mail.gmail.com>

Hi Jim,

On Fri, Dec 9, 2011 at 10:59 PM, Jim Cromie <jim.cromie@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 

  reply	other threads:[~2011-12-10  7:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10  6:59 objdump -S for a different dir Jim Cromie
2011-12-10  7:46 ` Dave Hylands [this message]
2011-12-13  4:28   ` Jim Cromie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABi1daFLTLovGhNngLmYAt0Y-pvqO7q+2xcGvJNFhig-nbZpag@mail.gmail.com \
    --to=dhylands@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).