Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Randolph Chung <randolph@tausq.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch] Fix a few bugs in hppa-linux-nat
Date: Fri, 07 May 2004 14:40:00 -0000	[thread overview]
Message-ID: <409B9FD0.8070003@gnu.org> (raw)
In-Reply-To: <20040429061207.GW3965@tausq.org>

> These have been sitting in my system for a few days...  when i submitted
> the hppa-linux-nat code initially these weren't quite working. Finally
> managed to track down the bugs. Ok to commit?
> 
> Fixes thread_db handling and some corefile stuff.

Just some tweaks before committing.

> 2004-04-28  Randolph Chung  <tausq@debian.org>
> 
> 	* hppa-linux-nat.c (fetch_register, store_register): Define.
> 	(fetch_inferior_registers, store_inferior_registers): Define.
> 	(supply_gregset): Add comment and clean up some unneeded code.
> 	(fill_gregset): Add comment and fix so that it saves registers in
> 	the right place in the gregset.
> 	(fill_fpregset): Fix buffer overrun problem.
> 	* config/pa/nm-linux.h (FETCH_INFERIOR_REGISTERS): Define.

Don't forget Makefile.in, and mention those extra #includes.

> Index: hppa-linux-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/hppa-linux-nat.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 hppa-linux-nat.c
> --- hppa-linux-nat.c	29 Apr 2004 03:36:49 -0000	1.1
> +++ hppa-linux-nat.c	29 Apr 2004 05:49:59 -0000
> @@ -22,8 +22,10 @@
>  #include "gdbcore.h"
>  #include "regcache.h"
>  #include "gdb_string.h"
> +#include "inferior.h"
>  
>  #include <sys/procfs.h>
> +#include <sys/ptrace.h>
>  #include <string.h>
>  #include <asm/offsets.h>
>  
> @@ -199,6 +201,99 @@ static const int greg_map[] =
>      CCR_REGNUM, EIEM_REGNUM,
>    };
>  
> +
> +
> +/* Fetch one register.  */
> +
> +static void
> +fetch_register (int regno)
> +{
> +  int tid;
> +  int val;
> +
> +  if (CANNOT_FETCH_REGISTER (regno))
> +    {
> +      supply_register (regno, NULL);
> +      return;
> +    }
> +
> +  /* GNU/Linux LWP ID's are process ID's.  */
> +  tid = TIDGET (inferior_ptid);
> +  if (tid == 0)
> +    tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
> +
> +  errno = 0;
> +  val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0);
> +  if (errno != 0)
> +    error ("Couldn't read register %s (#%d): %s.", REGISTER_NAME (regno),
> +	   regno, safe_strerror (errno));
> +
> +  supply_register (regno, &val);

use regcache_raw_supply.instead.

> +}
> +
> +/* Store one register. */
> +
> +static void
> +store_register (int regno)
> +{
> +  int tid;
> +  int val;
> +
> +  if (CANNOT_STORE_REGISTER (regno))
> +    return;
> +
> +  /* GNU/Linux LWP ID's are process ID's.  */
> +  tid = TIDGET (inferior_ptid);
> +  if (tid == 0)
> +    tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
> +
> +  errno = 0;
> +  regcache_collect (regno, &val);

use regcache_raw_collect instead.

Andrew



  parent reply	other threads:[~2004-05-07 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-29  6:12 Randolph Chung
2004-05-04 15:05 ` Randolph Chung
2004-05-07 14:40 ` Andrew Cagney [this message]
2004-05-08  3:28   ` Randolph Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=409B9FD0.8070003@gnu.org \
    --to=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=randolph@tausq.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox