[PATCH] gdb/disassembly: Update to handle non-statement addresses

Andrew Burgess andrew.burgess@embecosm.com
Thu Jul 23 08:48:01 GMT 2020


* Simon Marchi <simark@simark.ca> [2020-07-22 16:30:59 -0400]:

> On 2020-07-22 1:56 p.m., Andrew Burgess wrote:
> > After the introduction of support for non-statement addresses in the
> > line table, the output for 'disassemble /m' can be broken in some
> > cases.
> > 
> > With the /m format disassembly GDB associates a set of addresses with
> > each line, these addresses are then sorted and printed for each line.
> > 
> > When the non-statement support was added GDB was incorrectly told to
> > ignore non-statement instructions, and not add these to the result
> > table.  This means that these instructions are completely missing from
> > the output.
> > 
> > This commit removes the code that caused non-statement lines to be
> > ignored.
> > 
> > A result of this change is that GDB will now potentially include new
> > line numbers in the 'disassembly /m' output, lines that previously
> 
> disassembly -> disassemble
> 
> > were only in the line table as non-statement lines will now appear in
> > the disassembly output.  This feels like an improvement though.
> 
> disassemble's /m switch is considered deprecated, because it's useless
> (it shows the assembly in source line order).  The /s switch is the
> "newer" one.  So I'd recommend testing with the /s switch, if not with
> both switches.
> 
> I haven't looked at the patch itself and won't have time before next week.
> But I see that Pedro looked at it already, so I can assume it's fine :).

I'll extend the test case, but the bug and fix is only in the /m path
as it's a flaw in the logic for how instructions are associated with
lines.

FYI, I don't really consider /m "deprecated".  We don't have any plan
for how we could ever remove /m from GDB, so it's probably going to
live on forever.  That doesn't really feel like something that's
deprecated to me, just something that got known issues.

FYI(2), I only use /s myself because /m is junk :)

Thanks,
Andrew


More information about the Gdb-patches mailing list