This is the mail archive of the gdb@sources.redhat.com 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: The value of inferior_ptid for remote debugging targets


On Tue, Oct 08, 2002 at 06:32:01PM +0100, Dan Towner wrote:
> Hi all,
> 
> I am porting gdb so that it can be used to debug remote debugging 
> targets, which are embedded processors.  gdb communicates with the 
> remote target using a monitor program, running on the same machine as 
> gdb. Gdb invokes the monitor program using `serial_open', and uses pipes 
> to communicate with it.
> 
> I am encountering a problem when I try to use watchpoints.  Whenever I 
> set a watchpoint, the variable goes out of scope immediately I begin 
> continuing the program being debugged. I have determined that the cause 
> is the following code, which appears in blockframe.c:reinit_frame_cache
> 
>  /* FIXME: The inferior_ptid test is wrong if there is a corefile.  */
>  if (PIDGET (inferior_ptid) != 0)
>     {
>       select_frame (get_current_frame (), 0);
>     }
> 
> The inferior_ptid is 0 when this is called, hence the current frame is 
> never selected. This in turn means that the current scope cannot be 
> determined, and hence watchpoints don't work.
> 
> What is the correct value of inferior_ptid for remote targets, and why 
> shouldn't the above code be called when a remote target is active? 
> Should the inferior_ptid be setup so that the above code doesn't fail?
> 
> any help greatly appreciated...

Are you hitting the code in remote_open_1:
  /* Without this, some commands which require an active target (such
     as kill) won't work.  This variable serves (at least) double duty
     as both the pid of the target process (if it has such), and as a
     flag indicating that a target is active.  These functions should
     be split out into seperate variables, especially since GDB will
     someday have a notion of debugging several processes.  */

  inferior_ptid = pid_to_ptid (MAGIC_NULL_PID);
?

Or, it sounds like you're using your own remote protocol module.  If so
that's probably the bit you're missing.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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