foss-for-synopsys-dwc-arc-processors / binutils-gdb

A mirror of the upstream binutils-gdb repository for ARC specific work
GNU General Public License v2.0
13 stars 10 forks source link

GDB doesn't know about PC/PCL relations #71

Open shahab-vahedi opened 1 year ago

shahab-vahedi commented 1 year ago

When GDB loads ELF files into target it sets PC register to "start point" set in this point. For this it sends "P" packet to target and doesn't reread registers after set - register PC is assumed to be set, as long as gdbserver returned success status for P-packet. That means that PCL register is still displayed with it's previous value which is rather unfortunate and might confused a user. It will be nice to avoid that problem, but that is not critical.

On first look there are two ways to fix this:

  1. Update GDB to set PCL to new value when PC is being changed.
  2. Force GDB to refetch PC/PCL after PC is being changed. The latter might be more challenging, since I'm not sure it is possible to set register invalidation in a single place. Another problem would be that gdbserver should be aware of this dependency. For example OpenOCD for "P" packets might not update PC yet, but update it in the cache, so rereading PCL via JTAG will not fix the issue.

kolesov