This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: Any option to objdump just one function ?


Hi, Nick.
Thank you very much for your reply.

> Essentially yes. ?You can restrict disassembly to a range of addresses by
> using the --start-address= and --stop-address= options, but you would need
> to work out the addresses before hand.
>
> Alternatively if you have compiled your application with gcc's
> -ffunction-section option then you can use objdump's --section= option to
> restrict disassembly to just that section. ?But I doubt if you have built
> your kernel image that way.
>

yes, I think with this option, it can work. But I don't know if this
option is useful
in the kernel.

> Of course you can always pipe the output from objdump into a file and then
> use various tools (sed/perl/awk) to cut out the parts that you do not need.
>

yes, so I added the following command to do the job.
The following example is to get the parts of the main function in the
helloworld file.
i=`nm -S --size-sort /tmp/helloworld | grep "\<main\>"  | awk '{print
toupper($1),toupper($2)}'`;echo "$i" | while read line;do
start=${line%% *}; size=${line##* }; end=`echo "obase=16; ibase=16;
$start + $size" | bc -l` ; objdump -d --start-address="0x$start"
--stop-address="0x$end" /tmp/helloworld; done


Best Regards,
  robert


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