[PATCH 2/3] gdb: Don't reorder line table entries too much when sorting.

Tom Tromey tom@tromey.com
Fri Jan 24 17:40:00 GMT 2020


>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> Don't reorder line table entries for the same address when sorting the
Andrew> line table, maintain the compiler given line order.  Usually this will
Andrew> reflect the order in which lines are conceptually encountered at a
Andrew> given address.

Thanks for the long explanation and the patch.

I had a couple minor nits.

Andrew> -	  /* Like the pending blocks, the line table may be
Andrew> -	     scrambled in reordered executables.  Sort it if
Andrew> -	     OBJF_REORDERED is true.  */
Andrew> +	  const auto lte_is_less_than
Andrew> +	    = [] (const linetable_entry &ln1,
Andrew> +		  const linetable_entry &ln2)->bool

I'd put spaces around the "->".


Andrew> +	      {
Andrew> +		/* Note: this code does not assume that CORE_ADDRs can fit
Andrew> +		   in ints.  Please keep it that way.  */
Andrew> +		return (ln1.pc < ln2.pc);

I don't think this comment adds anything any more.  IMO it can just be
dropped.

Tom



More information about the Gdb-patches mailing list