This is the mail archive of the
mailing list for the binutils project.
Re: [objdump Question] How to sort assembly code by each line number ?
- From: Nick Clifton <nickc at redhat dot com>
- To: Taeung Song <treeze dot taeung at gmail dot com>, binutils at sourceware dot org
- Date: Tue, 21 Feb 2017 09:53:27 +0000
- Subject: Re: [objdump Question] How to sort assembly code by each line number ?
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org>
> If objdump has the option sorting assembly code according to line numbers,
> I want to use the option.
Sorry - objdump has no such option.
> For example,
> I want to sort the below output.
> (especially parts of assembly code of line number 34)
The problem is that the same line of source code can appear in lots of places
in the assembler (for example because of macros, inline functions, templates, etc).
Plus compiler optimizations like loop unrolling can replicate the same line
of source code multiple times in the assembler output. So there really is no
easy way to produce *meaningful* disassembly sorted by line number.
> If there isn't the option for it, I'd manually parse the output from 'objdump -dl'..
You can of course write a script to perform this sorting for you, so that you
do not have to do it by hand every time.