This is the mail archive of the gdb-patches@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]

Re: [PATCH]: Make Linux use the new unified x86 watchpoint support


Mark, this change did in fact fix the problem.
Would you like to check it in?

				Thanks,
				Michael Snyder

Mark Kettenis wrote:
> 
>    Date: Mon, 26 Mar 2001 18:14:00 -0800
>    From: Michael Snyder <msnyder@cygnus.com>
> 
>    Mark Kettenis wrote:
>    >
>    > FYI, I checked this in.  HJ can finally be happy now (although things
>    > probably won't work correctly for multithreaded programs).
> 
>    Mark, this breaks remote i386 targets debugged from linux hosts.
>    STOPPED_BY_WATCHPOINT is unconditionally defined to a function in
>    i386-nat.c, but we may not be debugging a native target.
> 
> STOPPED_BY_WATCHPOINT always has been unconditionally defined.  The
> only difference I can see is that with the old stuff is that I now
> call perror_with_name if the ptrace call fails.
> 
> If I'm right, the attached patch should fix your problems.  I cannot
> test it right now (no access to a Linux/x86 box), but if it works for
> you, feel free to check it in.
> 
> More details in the reply to your other message.
> 
> Mark
> 
> Index: ChangeLog
> from  Mark Kettenis  <kettenis@gnu.org>
> 
>         * i386-linux-nat.c (i386_linux_dr_get): Return 0 if ptrace call
>         fails instead of calling perror_with_name.  This should fix
>         debugging remote i386 targets with a native Linux/x86 GDB.  Add
>         FIXME for this hack.
> 
> Index: i386-linux-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
> retrieving revision 1.24
> diff -u -r1.24 i386-linux-nat.c
> --- i386-linux-nat.c 2001/03/21 21:22:48 1.24
> +++ i386-linux-nat.c 2001/03/27 08:40:06
> @@ -712,11 +712,20 @@
>       one thread.  */
>    tid = PIDGET (inferior_pid);
> 
> +  /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
> +     ptrace call fails breaks debugging remote targets.  The correct
> +     way to fix this is to add the hardware breakpoint and watchpoint
> +     stuff to the target vectore.  For now, just return zero if the
> +     ptrace call fails.  */
>    errno = 0;
>    value = ptrace (PT_READ_U, tid,
>                   offsetof (struct user, u_debugreg[regnum]), 0);
>    if (errno != 0)
> +#if 0
>      perror_with_name ("Couldn't read debug register");
> +#else
> +    return 0;
> +#endif
> 
>    return value;
>  }


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