[objdump Question] How to sort assembly code by each line number ?

Taeung Song treeze.taeung@gmail.com
Tue Feb 21 06:01:00 GMT 2017


Hi all :)

I'm modifying perf-annotate (that are Linux kernel : tools/perf)
a perf tool use objdump with -d and -l or -S.

By the way,
If objdump has the option sorting assembly code according to line numbers,
I want to use the option.

For example,
I want to sort the below output.
(especially parts of assembly code of line number 34)

--

Disassembly of section .text:

0000000000400966 <get_cond_maxprice>:
get_cond_maxprice():

...

/home/taeung/workspace/perf-test/old_pack_knapsack.c:32
   40098d:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%rbp)
/home/taeung/workspace/perf-test/old_pack_knapsack.c:34
   400994:	c7 45 ec 01 00 00 00 	movl   $0x1,-0x14(%rbp)
   40099b:	eb 4d                	jmp    4009ea <get_cond_maxprice+0x84>
/home/taeung/workspace/perf-test/old_pack_knapsack.c:37
   40099d:	8b 55 dc             	mov    -0x24(%rbp),%edx

...

/home/taeung/workspace/perf-test/old_pack_knapsack.c:34 (discriminator 2)
   4009e6:	83 45 ec 01          	addl   $0x1,-0x14(%rbp)
/home/taeung/workspace/perf-test/old_pack_knapsack.c:34 (discriminator 1)
   4009ea:	8b 45 ec             	mov    -0x14(%rbp),%eax
   4009ed:	3b 45 f4             	cmp    -0xc(%rbp),%eax
   4009f0:	76 ab                	jbe    40099d

...

If there isn't the option for it, I'd manually parse the output from 
'objdump -dl'..

Thanks,
Taeung



More information about the Binutils mailing list