Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: Linux gdbserver: store register values with proper type
@ 2003-05-29  6:19 Jim Blandy
  2003-05-29 15:29 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2003-05-29  6:19 UTC (permalink / raw)
  To: gdb-patches


2003-05-29  Jim Blandy  <jimb@redhat.com>

	* linux-low.c (usr_store_inferior_registers): Transfer buf in
	PTRACE_XFER_TYPE-sized chunks, not int-sized chunks.  Otherwise,
	if 'int' is smaller than PTRACE_XFER_TYPE, you end up throwing
	away part of the register's value.

Index: gdb/gdbserver/linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.21
diff -c -r1.21 linux-low.c
*** gdb/gdbserver/linux-low.c	26 Mar 2003 16:36:41 -0000	1.21
--- gdb/gdbserver/linux-low.c	29 May 2003 06:15:58 -0000
***************
*** 976,982 ****
  	{
  	  errno = 0;
  	  ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
! 		  *(int *) (buf + i));
  	  if (errno != 0)
  	    {
  	      if ((*the_low_target.cannot_store_register) (regno) == 0)
--- 976,982 ----
  	{
  	  errno = 0;
  	  ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
! 		  *(PTRACE_XFER_TYPE *) (buf + i));
  	  if (errno != 0)
  	    {
  	      if ((*the_low_target.cannot_store_register) (regno) == 0)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFA: Linux gdbserver: store register values with proper type
  2003-05-29  6:19 RFA: Linux gdbserver: store register values with proper type Jim Blandy
@ 2003-05-29 15:29 ` Daniel Jacobowitz
  2003-05-29 19:05   ` Jim Blandy
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-05-29 15:29 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

On Thu, May 29, 2003 at 01:28:29AM -0500, Jim Blandy wrote:
> 
> 2003-05-29  Jim Blandy  <jimb@redhat.com>
> 
> 	* linux-low.c (usr_store_inferior_registers): Transfer buf in
> 	PTRACE_XFER_TYPE-sized chunks, not int-sized chunks.  Otherwise,
> 	if 'int' is smaller than PTRACE_XFER_TYPE, you end up throwing
> 	away part of the register's value.

This is almost OK.  Could you correct the other int reference in the
same block?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFA: Linux gdbserver: store register values with proper type
  2003-05-29 15:29 ` Daniel Jacobowitz
@ 2003-05-29 19:05   ` Jim Blandy
  2003-05-29 19:09     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2003-05-29 19:05 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches


Daniel Jacobowitz <drow@mvista.com> writes:
> This is almost OK.  Could you correct the other int reference in the
> same block?

*duh*

How's this?

gdbserver/ChangeLog:
2003-05-29  Jim Blandy  <jimb@redhat.com>

	* linux-low.c (usr_store_inferior_registers): Transfer buf in
	PTRACE_XFER_TYPE-sized chunks, not int-sized chunks.  Otherwise,
	if 'int' is smaller than PTRACE_XFER_TYPE, you end up throwing
	away part of the register's value.

Index: gdb/gdbserver/linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.21.14.2
diff -c -r1.21.14.2 linux-low.c
*** gdb/gdbserver/linux-low.c	29 May 2003 19:01:10 -0000	1.21.14.2
--- gdb/gdbserver/linux-low.c	29 May 2003 19:02:52 -0000
***************
*** 976,982 ****
  	{
  	  errno = 0;
  	  ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
! 		  *(int *) (buf + i));
  	  if (errno != 0)
  	    {
  	      if ((*the_low_target.cannot_store_register) (regno) == 0)
--- 976,982 ----
  	{
  	  errno = 0;
  	  ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
! 		  *(PTRACE_XFER_TYPE *) (buf + i));
  	  if (errno != 0)
  	    {
  	      if ((*the_low_target.cannot_store_register) (regno) == 0)
***************
*** 989,995 ****
  		  return;
  		}
  	    }
! 	  regaddr += sizeof (int);
  	}
      }
    else
--- 989,995 ----
  		  return;
  		}
  	    }
! 	  regaddr += sizeof (PTRACE_XFER_TYPE);
  	}
      }
    else


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFA: Linux gdbserver: store register values with proper type
  2003-05-29 19:05   ` Jim Blandy
@ 2003-05-29 19:09     ` Daniel Jacobowitz
  2003-05-29 23:00       ` Jim Blandy
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-05-29 19:09 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

On Thu, May 29, 2003 at 02:14:13PM -0500, Jim Blandy wrote:
> 
> Daniel Jacobowitz <drow@mvista.com> writes:
> > This is almost OK.  Could you correct the other int reference in the
> > same block?
> 
> *duh*
> 
> How's this?

Good by me, go ahead.

> 
> gdbserver/ChangeLog:
> 2003-05-29  Jim Blandy  <jimb@redhat.com>
> 
> 	* linux-low.c (usr_store_inferior_registers): Transfer buf in
> 	PTRACE_XFER_TYPE-sized chunks, not int-sized chunks.  Otherwise,
> 	if 'int' is smaller than PTRACE_XFER_TYPE, you end up throwing
> 	away part of the register's value.
> 
> Index: gdb/gdbserver/linux-low.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
> retrieving revision 1.21.14.2
> diff -c -r1.21.14.2 linux-low.c
> *** gdb/gdbserver/linux-low.c	29 May 2003 19:01:10 -0000	1.21.14.2
> --- gdb/gdbserver/linux-low.c	29 May 2003 19:02:52 -0000
> ***************
> *** 976,982 ****
>   	{
>   	  errno = 0;
>   	  ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
> ! 		  *(int *) (buf + i));
>   	  if (errno != 0)
>   	    {
>   	      if ((*the_low_target.cannot_store_register) (regno) == 0)
> --- 976,982 ----
>   	{
>   	  errno = 0;
>   	  ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
> ! 		  *(PTRACE_XFER_TYPE *) (buf + i));
>   	  if (errno != 0)
>   	    {
>   	      if ((*the_low_target.cannot_store_register) (regno) == 0)
> ***************
> *** 989,995 ****
>   		  return;
>   		}
>   	    }
> ! 	  regaddr += sizeof (int);
>   	}
>       }
>     else
> --- 989,995 ----
>   		  return;
>   		}
>   	    }
> ! 	  regaddr += sizeof (PTRACE_XFER_TYPE);
>   	}
>       }
>     else
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFA: Linux gdbserver: store register values with proper type
  2003-05-29 19:09     ` Daniel Jacobowitz
@ 2003-05-29 23:00       ` Jim Blandy
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Blandy @ 2003-05-29 23:00 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz <drow@mvista.com> writes:

> On Thu, May 29, 2003 at 02:14:13PM -0500, Jim Blandy wrote:
> > 
> > Daniel Jacobowitz <drow@mvista.com> writes:
> > > This is almost OK.  Could you correct the other int reference in the
> > > same block?
> > 
> > *duh*
> > 
> > How's this?
> 
> Good by me, go ahead.

Committed, thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-05-29 23:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-29  6:19 RFA: Linux gdbserver: store register values with proper type Jim Blandy
2003-05-29 15:29 ` Daniel Jacobowitz
2003-05-29 19:05   ` Jim Blandy
2003-05-29 19:09     ` Daniel Jacobowitz
2003-05-29 23:00       ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox