[commit] Delete generic_target_read_pc

Andrew Cagney ac131313@redhat.com
Sat Jun 7 16:29:00 GMT 2003


Hello,

This deletes the function generic_target_read_pc().  It's replaced by 
explicit tests for TARGET_READ_PC and PC_REGNUM in read_pc_pid.

The intent here is to strip away the various nested function calls so 
that it is very clear where/how read_pc_pid() obtains a PC value.

committed,
Andrew

PS: Notice how read_pc_pid carefully swaps PTID and INFERIOR_PTID.

> CORE_ADDR
> read_pc_pid (ptid_t ptid)
> {
>   ptid_t saved_inferior_ptid;
>   CORE_ADDR pc_val;
> 
>   /* In case ptid != inferior_ptid. */
>   saved_inferior_ptid = inferior_ptid;
>   inferior_ptid = ptid;
> 
>   pc_val = TARGET_READ_PC (ptid);
> 
>   inferior_ptid = saved_inferior_ptid;
>   return pc_val;
> }

But check this is, the architecture specific TARGET_READ_PC vis:

> static CORE_ADDR
> d10v_read_pc (ptid_t ptid)
> {
>   ptid_t save_ptid;
>   CORE_ADDR pc;
>   CORE_ADDR retval;
> 
>   save_ptid = inferior_ptid;
>   inferior_ptid = ptid;
>   pc = (int) read_register (D10V_PC_REGNUM);
>   inferior_ptid = save_ptid;
>   retval = d10v_make_iaddr (pc);
>   return retval;
> }

is also trying to carefully swap the PTID and INFERIOR_PTID.  Left hand 
VS right hand.  Arrg!!
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20030607/13d1f2c9/attachment.ksh>


More information about the Gdb-patches mailing list