This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [PATCH v2] [PR symtab/17391] gdb internal error: assertion fails in regcache.c:178


On 08/18/2015 01:26 AM, Doug Evans wrote:

>   > More like for those I left it wasn't clear to me how to fix them.
>   > e.g., rs6000-tdep.c:rs6000_dwarf2_reg_to_regnum.
>   > I'm certainly not making things worse by leaving them alone.
>   >

OK.  Neither rs6000 spu look like cases that
returns num_regs + num_pseudo_regs for bad registers, as suggested
here, though:

+	/* If there's no corresponding GDB register, ignore it.
+	   Some targets return num_regs (+ num_pseudo_regs) for bad registers.
+	   Handle them until they are fixed.  */
  	if (regnum < 0 || regnum >= num_regs)
  	  continue;

IMO, as written, this is the sort of comment that ends up staying
stale forever even after all such targets stop returning num_regs+num_pseudo_regs
specifically (they may still return bogus register numbers higher
than that).  After your supplemental patch, I think we can just drop it
or say "Protect against a target returning a bad register" or some such?

> I missed a few obvious cases.
> The main remaining cases that I can think of are rs6000 and spu.
> Plus this supplemental patch makes stabs and ecoff more robust.
> Stabs was using num_arch + num_pseudo to denote "bad reg",
> but some targets use the same reg_to_regnum function for both
> stabs and dwarf, so that's asking for trouble (since dwarf uses -1).
> This patch makes stabs handle negative regnos too.
> 
> If it's too hard to review this apart from the original patch
> I can resubmit the entire thing.

Looks good to me.

Thanks,
Pedro Alves


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