This is the mail archive of the gdb-prs@sourceware.org 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: build/2534: Tiny fixes for gnu-nat and another enhancement


The following reply was made to PR build/2534; it has been noted by GNATS.

From: Thomas Schwinge <tschwinge@gnu.org>
To: gdb-gnats@sources.redhat.com, nobody@sources.redhat.com
Cc:  
Subject: Re: build/2534: Tiny fixes for gnu-nat and another enhancement
Date: Mon, 6 Oct 2008 11:52:33 +0200

 --+QahgC5+KEYLbs62
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="gdb-1-current_inferior.patch"
 Content-Transfer-Encoding: quoted-printable
 
 2008-10-06  Thomas Schwinge  <tschwinge@gnu.org>
 
 	* gnu-nat.h: Rename `current_inferior' to `current_inf' to avoid a name
 	collision.
 	* gnu-nat.c: Likewise.
 	* i386gnu-nat.c: Likewise.
 
 Index: gnu-nat.h
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvs/src/src/gdb/gnu-nat.h,v
 retrieving revision 1.7
 diff -u -p -r1.7 gnu-nat.h
 --- gnu-nat.h	1 Jan 2008 22:53:10 -0000	1.7
 +++ gnu-nat.h	5 Oct 2008 16:01:32 -0000
 @@ -25,7 +25,7 @@
 =20
  struct inf;
 =20
 -extern struct inf *current_inferior;
 +extern struct inf *current_inf;
 =20
  /* Converts a GDB pid to a struct proc.  */
  struct proc *inf_tid_to_thread (struct inf *inf, int tid);
 Index: gnu-nat.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvs/src/src/gdb/gnu-nat.c,v
 retrieving revision 1.54
 diff -u -p -r1.54 gnu-nat.c
 --- gnu-nat.c	22 Sep 2008 15:21:30 -0000	1.54
 +++ gnu-nat.c	5 Oct 2008 16:01:32 -0000
 @@ -1425,7 +1433,7 @@ inf_continue (struct inf *inf)
 =20
  =0C
  /* The inferior used for all gdb target ops.  */
 -struct inf *current_inferior =3D 0;
 +struct inf *current_inf =3D 0;
 =20
  /* The inferior being waited for by gnu_wait.  Since GDB is decidely not
     multi-threaded, we don't bother to lock this.  */
 @@ -1443,7 +1451,7 @@ gnu_wait (ptid_t ptid, struct target_wai
      } msg;
    error_t err;
    struct proc *thread;
 -  struct inf *inf =3D current_inferior;
 +  struct inf *inf =3D current_inf;
 =20
    extern int exc_server (mach_msg_header_t *, mach_msg_header_t *);
    extern int msg_reply_server (mach_msg_header_t *, mach_msg_header_t *);
 @@ -1958,7 +1966,7 @@ gnu_resume (ptid_t ptid, int step, enum=20
  {
    struct proc *step_thread =3D 0;
    int resume_all;
 -  struct inf *inf =3D current_inferior;
 +  struct inf *inf =3D current_inf;
 =20
    inf_debug (inf, "ptid =3D %s, step =3D %d, sig =3D %d",
  	     target_pid_to_str (ptid), step, sig);
 @@ -2030,12 +2038,12 @@ gnu_resume (ptid_t ptid, int step, enum=20
  static void
  gnu_kill_inferior (void)
  {
 -  struct proc *task =3D current_inferior->task;
 +  struct proc *task =3D current_inf->task;
    if (task)
      {
        proc_debug (task, "terminating...");
        task_terminate (task->port);
 -      inf_set_pid (current_inferior, -1);
 +      inf_set_pid (current_inf, -1);
      }
    target_mourn_inferior ();
  }
 @@ -2044,8 +2052,8 @@ gnu_kill_inferior (void)
  static void
  gnu_mourn_inferior (void)
  {
 -  inf_debug (current_inferior, "rip");
 -  inf_detach (current_inferior);
 +  inf_debug (current_inf, "rip");
 +  inf_detach (current_inf);
    unpush_target (&gnu_ops);
    generic_mourn_inferior ();
  }
 @@ -2057,9 +2065,9 @@ gnu_mourn_inferior (void)
  static int
  inf_pick_first_thread (void)
  {
 -  if (current_inferior->task && current_inferior->threads)
 +  if (current_inf->task && current_inf->threads)
      /* The first thread.  */
 -    return current_inferior->threads->tid;
 +    return current_inf->threads->tid;
    else
      /* What may be the next thread.  */
      return next_thread_id;
 @@ -2068,9 +2076,9 @@ inf_pick_first_thread (void)
  static struct inf *
  cur_inf (void)
  {
 -  if (!current_inferior)
 -    current_inferior =3D make_inf ();
 -  return current_inferior;
 +  if (!current_inf)
 +    current_inf =3D make_inf ();
 +  return current_inf;
  }
 =20
  static void
 @@ -2214,15 +2222,15 @@ gnu_detach (char *args, int from_tty)
        char *exec_file =3D get_exec_file (0);
        if (exec_file)
  	printf_unfiltered ("Detaching from program `%s' pid %d\n",
 -			   exec_file, current_inferior->pid);
 +			   exec_file, current_inf->pid);
        else
 -	printf_unfiltered ("Detaching from pid %d\n", current_inferior->pid);
 +	printf_unfiltered ("Detaching from pid %d\n", current_inf->pid);
        gdb_flush (gdb_stdout);
      }
 =20
 -  pid =3D current_inferior->pid;
 +  pid =3D current_inf->pid;
 =20
 -  inf_detach (current_inferior);
 +  inf_detach (current_inf);
 =20
    inferior_ptid =3D null_ptid;
    detach_inferior (pid);
 @@ -2233,8 +2241,8 @@ gnu_detach (char *args, int from_tty)
  static void
  gnu_terminal_init_inferior (void)
  {
 -  gdb_assert (current_inferior);
 -  terminal_init_inferior_with_pgrp (current_inferior->pid);
 +  gdb_assert (current_inf);
 +  terminal_init_inferior_with_pgrp (current_inf->pid);
  }
 =20
  /* Get ready to modify the registers array.  On machines which store
 @@ -2262,8 +2270,8 @@ gnu_stop (ptid_t ptid)
  static int
  gnu_thread_alive (ptid_t ptid)
  {
 -  inf_update_procs (current_inferior);
 -  return !!inf_tid_to_thread (current_inferior,
 +  inf_update_procs (current_inf);
 +  return !!inf_tid_to_thread (current_inf,
  			      ptid_get_tid (ptid));
  }
 =20
 @@ -2478,16 +2486,16 @@ gnu_xfer_memory (CORE_ADDR memaddr, gdb_
  		 struct mem_attrib *attrib,
  		 struct target_ops *target)
  {
 -  task_t task =3D (current_inferior
 -		 ? (current_inferior->task
 -		    ? current_inferior->task->port : 0)
 +  task_t task =3D (current_inf
 +		 ? (current_inf->task
 +		    ? current_inf->task->port : 0)
  		 : 0);
 =20
    if (task =3D=3D MACH_PORT_NULL)
      return 0;
    else
      {
 -      inf_debug (current_inferior, "%s %p[%d] %s %p",
 +      inf_debug (current_inf, "%s %p[%d] %s %p",
  		 write ? "writing" : "reading", (void *) memaddr, len,
  		 write ? "<--" : "-->", myaddr);
        if (write)
 @@ -2510,9 +2518,9 @@ gnu_find_memory_regions (int (*func) (CO
    vm_address_t region_address, last_region_address, last_region_end;
    vm_prot_t last_protection;
 =20
 -  if (current_inferior =3D=3D 0 || current_inferior->task =3D=3D 0)
 +  if (current_inf =3D=3D 0 || current_inf->task =3D=3D 0)
      return 0;
 -  task =3D current_inferior->task->port;
 +  task =3D current_inf->task->port;
    if (task =3D=3D MACH_PORT_NULL)
      return 0;
 =20
 @@ -2595,7 +2603,7 @@ proc_string (struct proc *proc)
  static char *
  gnu_pid_to_str (ptid_t ptid)
  {
 -  struct inf *inf =3D current_inferior;
 +  struct inf *inf =3D current_inf;
    int tid =3D ptid_get_tid (ptid);
    struct proc *thread =3D inf_tid_to_thread (inf, tid);
 =20
 @@ -3423,7 +3435,7 @@ flush_inferior_icache (CORE_ADDR pc, int
    vm_machine_attribute_val_t flush =3D MATTR_VAL_ICACHE_FLUSH;
    error_t ret;
 =20
 -  ret =3D vm_machine_attribute (current_inferior->task->port,
 +  ret =3D vm_machine_attribute (current_inf->task->port,
  			      pc,
  			      amount,
  			      MATTR_CACHE,
 Index: i386gnu-nat.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvs/src/src/gdb/i386gnu-nat.c,v
 retrieving revision 1.34
 diff -u -p -r1.34 i386gnu-nat.c
 --- i386gnu-nat.c	8 Sep 2008 21:33:25 -0000	1.34
 +++ i386gnu-nat.c	5 Oct 2008 16:01:32 -0000
 @@ -116,9 +116,9 @@ gnu_fetch_registers (struct regcache *re
    struct proc *thread;
 =20
    /* Make sure we know about new threads.  */
 -  inf_update_procs (current_inferior);
 +  inf_update_procs (current_inf);
 =20
 -  thread =3D inf_tid_to_thread (current_inferior,
 +  thread =3D inf_tid_to_thread (current_inf,
  			      ptid_get_tid (inferior_ptid));
    if (!thread)
      error (_("Can't fetch registers from thread %s: No such thread"),
 @@ -208,9 +208,9 @@ gnu_store_registers (struct regcache *re
    struct gdbarch *gdbarch =3D get_regcache_arch (regcache);
 =20
    /* Make sure we know about new threads.  */
 -  inf_update_procs (current_inferior);
 +  inf_update_procs (current_inf);
 =20
 -  thread =3D inf_tid_to_thread (current_inferior,
 +  thread =3D inf_tid_to_thread (current_inf,
  			      ptid_get_tid (inferior_ptid));
    if (!thread)
      error (_("Couldn't store registers into thread %s: No such thread"),
 
 --+QahgC5+KEYLbs62
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: Digital signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.2.2 (GNU/Linux)
 
 iD8DBQFI6d/ggfzh735dTTURAqFDAJ0X9R9TOihwuCRgAb+g3D6gUzqVKwCgrsrY
 tUFXptfAb5FV2OwOyJiJ5Zk=
 =xq2w
 -----END PGP SIGNATURE-----
 
 --+QahgC5+KEYLbs62--


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