From: Michael Snyder <msnyder@cygnus.com>
To: Daniel Berlin <dan@cgsoftware.com>
Cc: Christopher Blizzard <blizzard@mozilla.org>,
gdb-patches@sourceware.cygnus.com
Subject: Re: [Fwd: gdb patch]
Date: Mon, 08 May 2000 14:50:00 -0000 [thread overview]
Message-ID: <391736AA.7EAC@cygnus.com> (raw)
In-Reply-To: <Pine.LNX.4.10.10005081446080.19102-100000@propylaea.anduin.com>
Daniel Berlin wrote:
>
> It breaks quite a lot as default, because it always centers on the
> context, even if you try to pass other options.
> As an option (IE how it is now, list -w), it breaks nothing.
In that case, let's merge it as an option rather than the default,
as I think you suggested in an earlier message.
> > The general consensus is that it is a good thing, but there is
> > concern that it might break test suites. The last word on the
> > subject that I remember was that Daniel did not believe that
> > it would break test suites, and he was gonna go verify this.
From msnyder@cygnus.com Mon May 08 15:36:00 2000
From: msnyder@cygnus.com
To: gdb-patches@sourceware.cygnus.com
Subject: [PATCH] solaris thread tweak
Date: Mon, 08 May 2000 15:36:00 -0000
Message-id: <200005082236.PAA29556@seadog.cygnus.com>
X-SW-Source: 2000-05/msg00142.html
Content-length: 6801
Guard against adding the main thread to the thread list twice.
Also pretty up the declarations for the thread_db function pointers.
2000-05-08 Michael Snyder <msnyder@seadog.cygnus.com>
* sol-thread.c (sol_thread_create_inferior): only add the thread
to the thread list if it is not already in there.
(prototypes for thread_db func ptrs): pretty up formatting.
Index: sol-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/sol-thread.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -p -r1.6 -r1.7
*** sol-thread.c 2000/04/13 16:31:50 1.6
--- sol-thread.c 2000/05/08 22:34:38 1.7
*************** static void init_sol_core_ops PARAMS ((v
*** 133,186 ****
/* Pointers to routines from lithread_db resolved by dlopen() */
! static void
! (*p_td_log) (const int on_off);
! static td_err_e
! (*p_td_ta_new) (const struct ps_prochandle * ph_p, td_thragent_t ** ta_pp);
! static td_err_e
! (*p_td_ta_delete) (td_thragent_t * ta_p);
! static td_err_e
! (*p_td_init) (void);
! static td_err_e
! (*p_td_ta_get_ph) (const td_thragent_t * ta_p, struct ps_prochandle ** ph_pp);
! static td_err_e
! (*p_td_ta_get_nthreads) (const td_thragent_t * ta_p, int *nthread_p);
! static td_err_e
! (*p_td_ta_tsd_iter) (const td_thragent_t * ta_p, td_key_iter_f * cb, void *cbdata_p);
! static td_err_e
! (*p_td_ta_thr_iter) (const td_thragent_t * ta_p, td_thr_iter_f * cb, void *cbdata_p, td_thr_state_e state,
! int ti_pri, sigset_t * ti_sigmask_p, unsigned ti_user_flags);
! static td_err_e
! (*p_td_thr_validate) (const td_thrhandle_t * th_p);
! static td_err_e
! (*p_td_thr_tsd) (const td_thrhandle_t * th_p, const thread_key_t key, void **data_pp);
! static td_err_e
! (*p_td_thr_get_info) (const td_thrhandle_t * th_p, td_thrinfo_t * ti_p);
! static td_err_e
! (*p_td_thr_getfpregs) (const td_thrhandle_t * th_p, prfpregset_t * fpregset);
! static td_err_e
! (*p_td_thr_getxregsize) (const td_thrhandle_t * th_p, int *xregsize);
! static td_err_e
! (*p_td_thr_getxregs) (const td_thrhandle_t * th_p, const caddr_t xregset);
! static td_err_e
! (*p_td_thr_sigsetmask) (const td_thrhandle_t * th_p, const sigset_t ti_sigmask);
! static td_err_e
! (*p_td_thr_setprio) (const td_thrhandle_t * th_p, const int ti_pri);
! static td_err_e
! (*p_td_thr_setsigpending) (const td_thrhandle_t * th_p, const uchar_t ti_pending_flag, const sigset_t ti_pending);
! static td_err_e
! (*p_td_thr_setfpregs) (const td_thrhandle_t * th_p, const prfpregset_t * fpregset);
! static td_err_e
! (*p_td_thr_setxregs) (const td_thrhandle_t * th_p, const caddr_t xregset);
! static td_err_e
! (*p_td_ta_map_id2thr) (const td_thragent_t * ta_p, thread_t tid, td_thrhandle_t * th_p);
! static td_err_e
! (*p_td_ta_map_lwp2thr) (const td_thragent_t * ta_p, lwpid_t lwpid, td_thrhandle_t * th_p);
! static td_err_e
! (*p_td_thr_getgregs) (const td_thrhandle_t * th_p, prgregset_t regset);
! static td_err_e
! (*p_td_thr_setgregs) (const td_thrhandle_t * th_p, const prgregset_t regset);
! \f
/*
LOCAL FUNCTION
--- 133,191 ----
/* Pointers to routines from lithread_db resolved by dlopen() */
! static void (*p_td_log) (const int on_off);
! static td_err_e (*p_td_ta_new) (const struct ps_prochandle * ph_p,
! td_thragent_t ** ta_pp);
! static td_err_e (*p_td_ta_delete) (td_thragent_t * ta_p);
! static td_err_e (*p_td_init) (void);
! static td_err_e (*p_td_ta_get_ph) (const td_thragent_t * ta_p,
! struct ps_prochandle ** ph_pp);
! static td_err_e (*p_td_ta_get_nthreads) (const td_thragent_t * ta_p,
! int *nthread_p);
! static td_err_e (*p_td_ta_tsd_iter) (const td_thragent_t * ta_p,
! td_key_iter_f * cb,
! void *cbdata_p);
! static td_err_e (*p_td_ta_thr_iter) (const td_thragent_t * ta_p,
! td_thr_iter_f * cb,
! void *cbdata_p,
! td_thr_state_e state,
! int ti_pri,
! sigset_t * ti_sigmask_p,
! unsigned ti_user_flags);
! static td_err_e (*p_td_thr_validate) (const td_thrhandle_t * th_p);
! static td_err_e (*p_td_thr_tsd) (const td_thrhandle_t * th_p,
! const thread_key_t key,
! void **data_pp);
! static td_err_e (*p_td_thr_get_info) (const td_thrhandle_t * th_p,
! td_thrinfo_t * ti_p);
! static td_err_e (*p_td_thr_getfpregs) (const td_thrhandle_t * th_p,
! prfpregset_t * fpregset);
! static td_err_e (*p_td_thr_getxregsize) (const td_thrhandle_t * th_p,
! int *xregsize);
! static td_err_e (*p_td_thr_getxregs) (const td_thrhandle_t * th_p,
! const caddr_t xregset);
! static td_err_e (*p_td_thr_sigsetmask) (const td_thrhandle_t * th_p,
! const sigset_t ti_sigmask);
! static td_err_e (*p_td_thr_setprio) (const td_thrhandle_t * th_p,
! const int ti_pri);
! static td_err_e (*p_td_thr_setsigpending) (const td_thrhandle_t * th_p,
! const uchar_t ti_pending_flag,
! const sigset_t ti_pending);
! static td_err_e (*p_td_thr_setfpregs) (const td_thrhandle_t * th_p,
! const prfpregset_t * fpregset);
! static td_err_e (*p_td_thr_setxregs) (const td_thrhandle_t * th_p,
! const caddr_t xregset);
! static td_err_e (*p_td_ta_map_id2thr) (const td_thragent_t * ta_p,
! thread_t tid,
! td_thrhandle_t * th_p);
! static td_err_e (*p_td_ta_map_lwp2thr) (const td_thragent_t * ta_p,
! lwpid_t lwpid,
! td_thrhandle_t * th_p);
! static td_err_e (*p_td_thr_getgregs) (const td_thrhandle_t * th_p,
! prgregset_t regset);
! static td_err_e (*p_td_thr_setgregs) (const td_thrhandle_t * th_p,
! const prgregset_t regset);
!
/*
LOCAL FUNCTION
*************** lwp_to_thread (lwp)
*** 390,396 ****
val = p_td_thr_validate (&th);
if (val == TD_NOTHR)
! return lwp; /* libthread doesn't know about it, just return lwp */
else if (val != TD_OK)
error ("lwp_to_thread: td_thr_validate: %s.", td_err_string (val));
--- 395,402 ----
val = p_td_thr_validate (&th);
if (val == TD_NOTHR)
! return lwp; /* libthread doesn't know about it;
! just return lwp */
else if (val != TD_OK)
error ("lwp_to_thread: td_thr_validate: %s.", td_err_string (val));
*************** sol_thread_create_inferior (exec_file, a
*** 847,853 ****
if (inferior_pid == -1)
inferior_pid = main_ph.pid;
! add_thread (inferior_pid);
}
}
--- 853,860 ----
if (inferior_pid == -1)
inferior_pid = main_ph.pid;
! if (!in_thread_list (inferior_pid))
! add_thread (inferior_pid);
}
}
From msnyder@cygnus.com Mon May 08 18:28:00 2000
From: msnyder@cygnus.com
To: cagney@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: [PATCH]: Make fp0_regnum a multi-arch variable.
Date: Mon, 08 May 2000 18:28:00 -0000
Message-id: <200005090128.SAA14516@seadog.cygnus.com>
X-SW-Source: 2000-05/msg00143.html
Content-length: 24539
The macro FP0_REGNUM is used widely as a test of whether the target
architecture has an FPU. This has to be a runtime test for multi-arch.
2000-05-08 Michael Snyder <msnyder@seadog.cygnus.com>
* gdbarch.sh: Add FP0_REGNUM to list of multi-arched register numbers.
* gdbarch.c, gdbarch.h: Regenerate.
* core-regset.c: Change FP0_REGNUM to a runtime test.
* procfs.c: Ditto.
* sun3-nat.c: Ditto.
* sparc-tdep.c: Ditto.
* i386mach-nat.c: Remove unnecessary ifdef for FP0_REGNUM.
* ptx4-nat.c: Ditto.
Index: core-regset.c
===================================================================
RCS file: /cvs/src/src/gdb/core-regset.c,v
retrieving revision 1.1.1.3
diff -p -r1.1.1.3 core-regset.c
*** core-regset.c 1999/10/05 23:08:06 1.1.1.3
--- core-regset.c 2000/05/09 01:01:27
*************** fetch_core_registers (core_reg_sect, cor
*** 109,117 ****
else
{
memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
! #if defined (FP0_REGNUM)
! supply_fpregset (&fpregset);
! #endif
}
}
#endif /* defined(HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T) */
--- 109,116 ----
else
{
memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
! if (FP0_REGNUM >= 0)
! supply_fpregset (&fpregset);
}
}
#endif /* defined(HAVE_GREGSET_T) && defined (HAVE_FPREGSET_T) */
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.20
diff -p -r1.20 gdbarch.c
*** gdbarch.c 2000/05/02 09:36:56 1.20
--- gdbarch.c 2000/05/09 01:01:27
*************** struct gdbarch
*** 146,151 ****
--- 146,152 ----
int sp_regnum;
int fp_regnum;
int pc_regnum;
+ int fp0_regnum;
int npc_regnum;
int nnpc_regnum;
gdbarch_register_name_ftype *register_name;
*************** struct gdbarch startup_gdbarch = {
*** 283,288 ****
--- 284,290 ----
0,
0,
0,
+ 0,
generic_get_saved_register,
0,
0,
*************** gdbarch_alloc (const struct gdbarch_info
*** 353,358 ****
--- 355,361 ----
gdbarch->sp_regnum = -1;
gdbarch->fp_regnum = -1;
gdbarch->pc_regnum = -1;
+ gdbarch->fp0_regnum = -1;
gdbarch->npc_regnum = -1;
gdbarch->nnpc_regnum = -1;
gdbarch->register_name = legacy_register_name;
*************** verify_gdbarch (struct gdbarch *gdbarch)
*** 472,477 ****
--- 475,481 ----
if ((GDB_MULTI_ARCH >= 2)
&& (gdbarch->pc_regnum == -1))
internal_error ("gdbarch: verify_gdbarch: pc_regnum invalid");
+ /* Skip verify of fp0_regnum, invalid_p == 0 */
/* Skip verify of npc_regnum, invalid_p == 0 */
/* Skip verify of nnpc_regnum, invalid_p == 0 */
/* Skip verify of register_name, invalid_p == 0 */
*************** gdbarch_dump (void)
*** 712,717 ****
--- 716,724 ----
"gdbarch_update: PC_REGNUM = %ld\n",
(long) PC_REGNUM);
fprintf_unfiltered (gdb_stdlog,
+ "gdbarch_update: FP0_REGNUM = %ld\n",
+ (long) FP0_REGNUM);
+ fprintf_unfiltered (gdb_stdlog,
"gdbarch_update: NPC_REGNUM = %ld\n",
(long) NPC_REGNUM);
fprintf_unfiltered (gdb_stdlog,
*************** set_gdbarch_pc_regnum (struct gdbarch *g
*** 1346,1351 ****
--- 1353,1374 ----
int pc_regnum)
{
gdbarch->pc_regnum = pc_regnum;
+ }
+
+ int
+ gdbarch_fp0_regnum (struct gdbarch *gdbarch)
+ {
+ /* Skip verify of fp0_regnum, invalid_p == 0 */
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_fp0_regnum called\n");
+ return gdbarch->fp0_regnum;
+ }
+
+ void
+ set_gdbarch_fp0_regnum (struct gdbarch *gdbarch,
+ int fp0_regnum)
+ {
+ gdbarch->fp0_regnum = fp0_regnum;
}
int
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.16
diff -p -r1.16 gdbarch.h
*** gdbarch.h 2000/05/02 09:36:56 1.16
--- gdbarch.h 2000/05/09 01:01:27
*************** extern void set_gdbarch_pc_regnum (struc
*** 264,269 ****
--- 264,282 ----
#endif
/* Default (value) for non- multi-arch platforms. */
+ #if (GDB_MULTI_ARCH == 0) && !defined (FP0_REGNUM)
+ #define FP0_REGNUM (-1)
+ #endif
+
+ extern int gdbarch_fp0_regnum (struct gdbarch *gdbarch);
+ extern void set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, int fp0_regnum);
+ #if GDB_MULTI_ARCH
+ #if (GDB_MULTI_ARCH > 1) || !defined (FP0_REGNUM)
+ #define FP0_REGNUM (gdbarch_fp0_regnum (current_gdbarch))
+ #endif
+ #endif
+
+ /* Default (value) for non- multi-arch platforms. */
#if (GDB_MULTI_ARCH == 0) && !defined (NPC_REGNUM)
#define NPC_REGNUM (-1)
#endif
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.19
diff -p -r1.19 gdbarch.sh
*** gdbarch.sh 2000/05/02 09:36:56 1.19
--- gdbarch.sh 2000/05/09 01:01:27
*************** v:2:NUM_REGS:int:num_regs::::0:-1
*** 241,246 ****
--- 241,247 ----
v:2:SP_REGNUM:int:sp_regnum::::0:-1
v:2:FP_REGNUM:int:fp_regnum::::0:-1
v:2:PC_REGNUM:int:pc_regnum::::0:-1
+ v:2:FP0_REGNUM:int:fp0_regnum::::0:-1:0
v:2:NPC_REGNUM:int:npc_regnum::::0:-1:0
v:2:NNPC_REGNUM:int:nnpc_regnum::::0:-1:0
f:2:REGISTER_NAME:char *:register_name:int regnr:regnr:::legacy_register_name:0
Index: i386mach-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386mach-nat.c,v
retrieving revision 1.1.1.4
diff -p -r1.1.1.4 i386mach-nat.c
*** i386mach-nat.c 1999/10/05 23:08:20 1.1.1.4
--- i386mach-nat.c 2000/05/09 01:01:27
*************** fetch_core_registers (core_reg_sect, cor
*** 129,139 ****
break;
case 2:
- #ifdef FP0_REGNUM
memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)],
core_reg_sect,
core_reg_size); /* FIXME, probably bogus */
- #endif
#ifdef FPC_REGNUM
memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)],
&corestr.c_fpu.f_fpstatus.f_ctrl,
--- 129,137 ----
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.9
diff -p -r1.9 procfs.c
*** procfs.c 2000/05/05 20:56:10 1.9
--- procfs.c 2000/05/09 01:01:27
*************** procfs_fetch_registers (regno)
*** 3503,3521 ****
supply_gregset (gregs);
! #if defined (FP0_REGNUM) /* need floating point? */
! if ((regno >= 0 && regno < FP0_REGNUM) ||
! regno == PC_REGNUM ||
! (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
! regno == FP_REGNUM ||
! regno == SP_REGNUM)
! return; /* not a floating point register */
! if ((fpregs = proc_get_fpregs (pi)) == NULL)
! proc_error (pi, "fetch_registers, get_fpregs", __LINE__);
! supply_fpregset (fpregs);
! #endif
}
/* Get ready to modify the registers array. On machines which store
--- 3503,3522 ----
supply_gregset (gregs);
! if (FP0_REGNUM >= 0) /* need floating point? */
! {
! if ((regno >= 0 && regno < FP0_REGNUM) ||
! regno == PC_REGNUM ||
! (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
! regno == FP_REGNUM ||
! regno == SP_REGNUM)
! return; /* not a floating point register */
! if ((fpregs = proc_get_fpregs (pi)) == NULL)
! proc_error (pi, "fetch_registers, get_fpregs", __LINE__);
! supply_fpregset (fpregs);
! }
}
/* Get ready to modify the registers array. On machines which store
*************** procfs_store_registers (regno)
*** 3577,3597 ****
if (!proc_set_gregs (pi))
proc_error (pi, "store_registers, set_gregs", __LINE__);
! #if defined (FP0_REGNUM) /* need floating point? */
! if ((regno >= 0 && regno < FP0_REGNUM) ||
! regno == PC_REGNUM ||
! (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
! regno == FP_REGNUM ||
! regno == SP_REGNUM)
! return; /* not a floating point register */
!
! if ((fpregs = proc_get_fpregs (pi)) == NULL)
! proc_error (pi, "store_registers, get_fpregs", __LINE__);
!
! fill_fpregset (fpregs, regno);
! if (!proc_set_fpregs (pi))
! proc_error (pi, "store_registers, set_fpregs", __LINE__);
! #endif
}
/*
--- 3578,3599 ----
if (!proc_set_gregs (pi))
proc_error (pi, "store_registers, set_gregs", __LINE__);
! if (FP0_REGNUM >= 0) /* need floating point? */
! {
! if ((regno >= 0 && regno < FP0_REGNUM) ||
! regno == PC_REGNUM ||
! (NPC_REGNUM >= 0 && regno == NPC_REGNUM) ||
! regno == FP_REGNUM ||
! regno == SP_REGNUM)
! return; /* not a floating point register */
!
! if ((fpregs = proc_get_fpregs (pi)) == NULL)
! proc_error (pi, "store_registers, get_fpregs", __LINE__);
!
! fill_fpregset (fpregs, regno);
! if (!proc_set_fpregs (pi))
! proc_error (pi, "store_registers, set_fpregs", __LINE__);
! }
}
/*
*************** invalidate_cache (parent, pi, ptr)
*** 4112,4125 ****
if (!proc_set_gregs (pi)) /* flush gregs cache */
proc_warn (pi, "target_resume, set_gregs",
__LINE__);
! #ifdef FP0_REGNUM
! if (pi->fpregs_dirty)
! if (parent == NULL ||
! proc_get_current_thread (parent) != pi->tid)
! if (!proc_set_fpregs (pi)) /* flush fpregs cache */
! proc_warn (pi, "target_resume, set_fpregs",
! __LINE__);
! #endif
#endif
if (parent != NULL)
--- 4114,4126 ----
if (!proc_set_gregs (pi)) /* flush gregs cache */
proc_warn (pi, "target_resume, set_gregs",
__LINE__);
! if (FP0_REGNUM >= 0)
! if (pi->fpregs_dirty)
! if (parent == NULL ||
! proc_get_current_thread (parent) != pi->tid)
! if (!proc_set_fpregs (pi)) /* flush fpregs cache */
! proc_warn (pi, "target_resume, set_fpregs",
! __LINE__);
#endif
if (parent != NULL)
Index: ptx4-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ptx4-nat.c,v
retrieving revision 1.1.1.3
diff -p -r1.1.1.3 ptx4-nat.c
*** ptx4-nat.c 1999/07/07 20:08:48 1.1.1.3
--- ptx4-nat.c 2000/05/09 01:08:01
*************** fill_gregset (gregsetp, regno)
*** 62,69 ****
}
}
- #if defined (FP0_REGNUM)
-
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), unpack the register contents and supply them as gdb's
idea of the current floating point register values. */
--- 62,67 ----
*************** fill_fpregset (fpregsetp, regno)
*** 92,99 ****
/* FIXME: see m68k-tdep.c for an example, for the m68k. */
}
-
- #endif /* defined (FP0_REGNUM) */
/*
* This doesn't quite do the same thing as the procfs.c version, but give
--- 90,95 ----
Index: sun3-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sun3-nat.c,v
retrieving revision 1.1.1.4
diff -p -r1.1.1.4 sun3-nat.c
*** sun3-nat.c 1999/10/05 23:08:54 1.1.1.4
--- sun3-nat.c 2000/05/09 01:01:28
*************** fetch_inferior_registers (regno)
*** 33,63 ****
int regno;
{
struct regs inferior_registers;
- #ifdef FP0_REGNUM
struct fp_status inferior_fp_registers;
- #endif
registers_fetched ();
ptrace (PTRACE_GETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_registers);
- #ifdef FP0_REGNUM
- ptrace (PTRACE_GETFPREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) & inferior_fp_registers);
- #endif
memcpy (registers, &inferior_registers, 16 * 4);
! #ifdef FP0_REGNUM
! memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
! sizeof inferior_fp_registers.fps_regs);
! #endif
*(int *) ®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
*(int *) ®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
! #ifdef FP0_REGNUM
! memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)],
! &inferior_fp_registers.fps_control,
! sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
! #endif
}
/* Store our register values back into the inferior.
--- 33,61 ----
int regno;
{
struct regs inferior_registers;
struct fp_status inferior_fp_registers;
registers_fetched ();
ptrace (PTRACE_GETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_registers);
+ if (FP0_REGNUM >= 0)
+ ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers);
+
memcpy (registers, &inferior_registers, 16 * 4);
! if (FP0_REGNUM >= 0)
! memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
! sizeof inferior_fp_registers.fps_regs);
!
*(int *) ®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
*(int *) ®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
! if (FP0_REGNUM >= 0)
! memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)],
! &inferior_fp_registers.fps_control,
! sizeof inferior_fp_registers -
! sizeof inferior_fp_registers.fps_regs);
}
/* Store our register values back into the inferior.
*************** store_inferior_registers (regno)
*** 69,98 ****
int regno;
{
struct regs inferior_registers;
- #ifdef FP0_REGNUM
struct fp_status inferior_fp_registers;
- #endif
memcpy (&inferior_registers, registers, 16 * 4);
! #ifdef FP0_REGNUM
! memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)],
! sizeof inferior_fp_registers.fps_regs);
! #endif
inferior_registers.r_ps = *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)];
inferior_registers.r_pc = *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)];
! #ifdef FP0_REGNUM
! memcpy (&inferior_fp_registers.fps_control,
! ®isters[REGISTER_BYTE (FPC_REGNUM)],
! sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
! #endif
ptrace (PTRACE_SETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_registers);
! #if FP0_REGNUM
! ptrace (PTRACE_SETFPREGS, inferior_pid,
! (PTRACE_ARG3_TYPE) & inferior_fp_registers);
! #endif
}
--- 67,93 ----
int regno;
{
struct regs inferior_registers;
struct fp_status inferior_fp_registers;
memcpy (&inferior_registers, registers, 16 * 4);
! if (FP0_REGNUM >= 0)
! memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)],
! sizeof inferior_fp_registers.fps_regs);
!
inferior_registers.r_ps = *(int *) ®isters[REGISTER_BYTE (PS_REGNUM)];
inferior_registers.r_pc = *(int *) ®isters[REGISTER_BYTE (PC_REGNUM)];
! if (FP0_REGNUM >= 0)
! memcpy (&inferior_fp_registers.fps_control,
! ®isters[REGISTER_BYTE (FPC_REGNUM)],
! sizeof inferior_fp_registers -
! sizeof inferior_fp_registers.fps_regs);
ptrace (PTRACE_SETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_registers);
! if (FP0_REGNUM >= 0)
! ptrace (PTRACE_SETFPREGS, inferior_pid,
! (PTRACE_ARG3_TYPE) & inferior_fp_registers);
}
*************** fetch_core_registers (core_reg_sect, cor
*** 125,142 ****
if (core_reg_size >= sizeof (struct fpu))
{
! #ifdef FP0_REGNUM
! memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)],
! fpustruct->f_fpstatus.fps_regs,
! sizeof fpustruct->f_fpstatus.fps_regs);
! memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)],
! &fpustruct->f_fpstatus.fps_control,
! sizeof fpustruct->f_fpstatus -
! sizeof fpustruct->f_fpstatus.fps_regs);
! #endif
}
else
! fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
}
}
\f
--- 120,139 ----
if (core_reg_size >= sizeof (struct fpu))
{
! if (FP0_REGNUM >= 0)
! {
! memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)],
! fpustruct->f_fpstatus.fps_regs,
! sizeof fpustruct->f_fpstatus.fps_regs);
! memcpy (®isters[REGISTER_BYTE (FPC_REGNUM)],
! &fpustruct->f_fpstatus.fps_control,
! sizeof fpustruct->f_fpstatus -
! sizeof fpustruct->f_fpstatus.fps_regs);
! }
}
else
! fprintf_unfiltered (gdb_stderr,
! "Couldn't read float regs from core file\n");
}
}
\f
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.1.1.7
diff -p -r1.1.1.7 sparc-tdep.c
*** sparc-tdep.c 1999/10/05 23:08:51 1.1.1.7
--- sparc-tdep.c 2000/05/09 01:22:24
***************
*** 44,52 ****
#ifdef GDB_TARGET_IS_SPARC64
#define FP_REGISTER_BYTES (64 * 4)
! #else
#define FP_REGISTER_BYTES (32 * 4)
#endif
/* If not defined, assume 32 bit sparc. */
#ifndef FP_MAX_REGNUM
--- 44,56 ----
#ifdef GDB_TARGET_IS_SPARC64
#define FP_REGISTER_BYTES (64 * 4)
! #else
! #if (SPARC_HAS_FPU)
#define FP_REGISTER_BYTES (32 * 4)
+ #else
+ #define FP_REGISTER_BYTES 0
#endif
+ #endif
/* If not defined, assume 32 bit sparc. */
#ifndef FP_MAX_REGNUM
*************** sparc_get_saved_register (raw_buffer, op
*** 749,764 ****
else if (regnum >= O0_REGNUM && regnum < O0_REGNUM + 8)
addr = frame1->frame + (regnum - O0_REGNUM) * SPARC_INTREG_SIZE
- (FP_REGISTER_BYTES + 16 * SPARC_INTREG_SIZE);
! #ifdef FP0_REGNUM
! else if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32)
addr = frame1->frame + (regnum - FP0_REGNUM) * 4
- (FP_REGISTER_BYTES);
#ifdef GDB_TARGET_IS_SPARC64
! else if (regnum >= FP0_REGNUM + 32 && regnum < FP_MAX_REGNUM)
addr = frame1->frame + 32 * 4 + (regnum - FP0_REGNUM - 32) * 8
- (FP_REGISTER_BYTES);
#endif
- #endif /* FP0_REGNUM */
else if (regnum >= Y_REGNUM && regnum < NUM_REGS)
addr = frame1->frame + (regnum - Y_REGNUM) * SPARC_INTREG_SIZE
- (FP_REGISTER_BYTES + 24 * SPARC_INTREG_SIZE);
--- 753,768 ----
else if (regnum >= O0_REGNUM && regnum < O0_REGNUM + 8)
addr = frame1->frame + (regnum - O0_REGNUM) * SPARC_INTREG_SIZE
- (FP_REGISTER_BYTES + 16 * SPARC_INTREG_SIZE);
! else if (FP0_REGNUM >= 0 &&
! regnum >= FP0_REGNUM && regnum < FP0_REGNUM + 32)
addr = frame1->frame + (regnum - FP0_REGNUM) * 4
- (FP_REGISTER_BYTES);
#ifdef GDB_TARGET_IS_SPARC64
! else if (FP0_REGNUM >= 0 &&
! regnum >= FP0_REGNUM + 32 && regnum < FP_MAX_REGNUM)
addr = frame1->frame + 32 * 4 + (regnum - FP0_REGNUM - 32) * 8
- (FP_REGISTER_BYTES);
#endif
else if (regnum >= Y_REGNUM && regnum < NUM_REGS)
addr = frame1->frame + (regnum - Y_REGNUM) * SPARC_INTREG_SIZE
- (FP_REGISTER_BYTES + 24 * SPARC_INTREG_SIZE);
*************** sparc_get_saved_register (raw_buffer, op
*** 849,861 ****
#endif
/* See tm-sparc.h for how this is calculated. */
- #ifdef FP0_REGNUM
#define DUMMY_STACK_REG_BUF_SIZE \
! (((8+8+8) * SPARC_INTREG_SIZE) + FP_REGISTER_BYTES)
! #else
! #define DUMMY_STACK_REG_BUF_SIZE \
! (((8+8+8) * SPARC_INTREG_SIZE) )
! #endif /* FP0_REGNUM */
#define DUMMY_STACK_SIZE (DUMMY_STACK_REG_BUF_SIZE + DUMMY_REG_SAVE_OFFSET)
void
--- 853,860 ----
#endif
/* See tm-sparc.h for how this is calculated. */
#define DUMMY_STACK_REG_BUF_SIZE \
! (((8+8+8) * SPARC_INTREG_SIZE) + FP_REGISTER_BYTES)
#define DUMMY_STACK_SIZE (DUMMY_STACK_REG_BUF_SIZE + DUMMY_REG_SAVE_OFFSET)
void
*************** sparc_push_dummy_frame ()
*** 887,897 ****
®ister_temp[16 * SPARC_INTREG_SIZE],
SPARC_INTREG_SIZE * 8);
! #ifdef FP0_REGNUM
! read_register_bytes (REGISTER_BYTE (FP0_REGNUM),
! ®ister_temp[24 * SPARC_INTREG_SIZE],
! FP_REGISTER_BYTES);
! #endif /* FP0_REGNUM */
sp -= DUMMY_STACK_SIZE;
--- 886,895 ----
®ister_temp[16 * SPARC_INTREG_SIZE],
SPARC_INTREG_SIZE * 8);
! if (FP0_REGNUM >= 0)
! read_register_bytes (REGISTER_BYTE (FP0_REGNUM),
! ®ister_temp[24 * SPARC_INTREG_SIZE],
! FP_REGISTER_BYTES);
sp -= DUMMY_STACK_SIZE;
*************** sparc_frame_find_saved_regs (fi, saved_r
*** 991,1008 ****
saved_regs_addr->regs[regnum] =
frame_addr + (regnum - I0_REGNUM) * SPARC_INTREG_SIZE
- DUMMY_STACK_REG_BUF_SIZE + 8 * SPARC_INTREG_SIZE;
! #ifdef FP0_REGNUM
! for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 32; regnum++)
! saved_regs_addr->regs[regnum] =
! frame_addr + (regnum - FP0_REGNUM) * 4
! - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
#ifdef GDB_TARGET_IS_SPARC64
! for (regnum = FP0_REGNUM + 32; regnum < FP_MAX_REGNUM; regnum++)
! saved_regs_addr->regs[regnum] =
! frame_addr + 32 * 4 + (regnum - FP0_REGNUM - 32) * 4
! - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
#endif
! #endif /* FP0_REGNUM */
#ifdef GDB_TARGET_IS_SPARC64
for (regnum = PC_REGNUM; regnum < PC_REGNUM + 7; regnum++)
{
--- 989,1008 ----
saved_regs_addr->regs[regnum] =
frame_addr + (regnum - I0_REGNUM) * SPARC_INTREG_SIZE
- DUMMY_STACK_REG_BUF_SIZE + 8 * SPARC_INTREG_SIZE;
! if (FP0_REGNUM >= 0)
! {
! for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 32; regnum++)
! saved_regs_addr->regs[regnum] =
! frame_addr + (regnum - FP0_REGNUM) * 4
! - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
#ifdef GDB_TARGET_IS_SPARC64
! for (regnum = FP0_REGNUM + 32; regnum < FP_MAX_REGNUM; regnum++)
! saved_regs_addr->regs[regnum] =
! frame_addr + 32 * 4 + (regnum - FP0_REGNUM - 32) * 4
! - DUMMY_STACK_REG_BUF_SIZE + 24 * SPARC_INTREG_SIZE;
#endif
! }
!
#ifdef GDB_TARGET_IS_SPARC64
for (regnum = PC_REGNUM; regnum < PC_REGNUM + 7; regnum++)
{
*************** sparc_pop_frame ()
*** 1094,1119 ****
int regnum;
sparc_frame_find_saved_regs (frame, &fsr);
! #ifdef FP0_REGNUM
! if (fsr.regs[FP0_REGNUM])
{
! read_memory (fsr.regs[FP0_REGNUM], raw_buffer, FP_REGISTER_BYTES);
! write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
! raw_buffer, FP_REGISTER_BYTES);
! }
#ifndef GDB_TARGET_IS_SPARC64
! if (fsr.regs[FPS_REGNUM])
! {
! read_memory (fsr.regs[FPS_REGNUM], raw_buffer, 4);
! write_register_bytes (REGISTER_BYTE (FPS_REGNUM), raw_buffer, 4);
! }
! if (fsr.regs[CPS_REGNUM])
! {
! read_memory (fsr.regs[CPS_REGNUM], raw_buffer, 4);
! write_register_bytes (REGISTER_BYTE (CPS_REGNUM), raw_buffer, 4);
! }
#endif
! #endif /* FP0_REGNUM */
if (fsr.regs[G1_REGNUM])
{
read_memory (fsr.regs[G1_REGNUM], raw_buffer, 7 * SPARC_INTREG_SIZE);
--- 1094,1120 ----
int regnum;
sparc_frame_find_saved_regs (frame, &fsr);
! if (FP0_REGNUM >= 0)
{
! if (fsr.regs[FP0_REGNUM])
! {
! read_memory (fsr.regs[FP0_REGNUM], raw_buffer, FP_REGISTER_BYTES);
! write_register_bytes (REGISTER_BYTE (FP0_REGNUM),
! raw_buffer, FP_REGISTER_BYTES);
! }
#ifndef GDB_TARGET_IS_SPARC64
! if (fsr.regs[FPS_REGNUM])
! {
! read_memory (fsr.regs[FPS_REGNUM], raw_buffer, 4);
! write_register_bytes (REGISTER_BYTE (FPS_REGNUM), raw_buffer, 4);
! }
! if (fsr.regs[CPS_REGNUM])
! {
! read_memory (fsr.regs[CPS_REGNUM], raw_buffer, 4);
! write_register_bytes (REGISTER_BYTE (CPS_REGNUM), raw_buffer, 4);
! }
#endif
! }
if (fsr.regs[G1_REGNUM])
{
read_memory (fsr.regs[G1_REGNUM], raw_buffer, 7 * SPARC_INTREG_SIZE);
*************** fill_gregset (gregsetp, regno)
*** 1388,1395 ****
}
}
- #if defined (FP0_REGNUM)
-
/* Given a pointer to a floating point register set in /proc format
(fpregset_t *), unpack the register contents and supply them as gdb's
idea of the current floating point register values. */
--- 1389,1394 ----
*************** supply_fpregset (fpregsetp)
*** 1401,1406 ****
--- 1400,1408 ----
register int regi;
char *from;
+ if (FP0_REGNUM < 0)
+ return;
+
for (regi = FP0_REGNUM; regi < FP_MAX_REGNUM; regi++)
{
from = (char *) &fpregsetp->pr_fr.pr_regs[regi - FP0_REGNUM];
*************** fill_fpregset (fpregsetp, regno)
*** 1424,1429 ****
--- 1426,1434 ----
char *to;
char *from;
+ if (FP0_REGNUM < 0)
+ return;
+
for (regi = FP0_REGNUM; regi < FP_MAX_REGNUM; regi++)
{
if ((regno == -1) || (regno == regi))
*************** fill_fpregset (fpregsetp, regno)
*** 1438,1445 ****
fpregsetp->pr_fsr = *(int *) ®isters[REGISTER_BYTE (FPS_REGNUM)];
}
}
-
- #endif /* defined (FP0_REGNUM) */
#endif /* USE_PROC_FS */
--- 1443,1448 ----
From mdejong@cygnus.com Mon May 08 21:11:00 2000
From: Mo DeJong <mdejong@cygnus.com>
To: Fernando Nasser <fnasser@cygnus.com>
Cc: DJ Delorie <dj@delorie.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: GDB needs a --cmdline option
Date: Mon, 08 May 2000 21:11:00 -0000
Message-id: <Pine.SOL.3.91.1000508210428.24783A-100000@cse.cygnus.com>
References: <3916F209.389D51A9@cygnus.com>
X-SW-Source: 2000-05/msg00144.html
Content-length: 970
On Mon, 8 May 2000, Fernando Nasser wrote:
> Based on what DJ wrote, we could do something similar to dbx.
>
> gdb <gdb command line switches> -run <command line>
>
> The first token would be the program to run and everything else
> would be set as arguments for that program (implicit "set args").
>
> The -run must be (obviously) the last gdb command line switch.
>
> Gdb will silently exit on program exit, with the same return code
> as the inferior ended.
>
> Opinions? Volunteers?
This functionality would be great. We need this for Source Nav
to debug our really lousy custom parsers. They crash all the time
but they are run in a pipeline so it is kind of ugly to try to debug
them. It would be really great if the parsers could be "run in gdb"
and just act like the normal program when nothing went wrong.
I have never hacked on gdb before, but I would be willing to do
whatever I can to help making this cool feature a reality.
Mo DeJong
Red Hat Inc.
From eliz@delorie.com Tue May 09 01:32:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: 3diff@flib.gnu.ai.mit.edu
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: another proofreading patch
Date: Tue, 09 May 2000 01:32:00 -0000
Message-id: <200005090832.EAA10268@indy.delorie.com>
References: <200005082145.RAA08735@flib.gnu.ai.mit.edu>
X-SW-Source: 2000-05/msg00145.html
Content-length: 305
> Date: Mon, 8 May 2000 17:45:02 -0400
> From: Brian Youmans <3diff@flib.gnu.ai.mit.edu>
>
> Here is a patch for gdb.texinfo that fixes several grammatical
> glitches, two incorrect typefaces, and three spots where parts of a
> multitable print over other parts of the table.
I committed this. Thanks!
From eliz@delorie.com Tue May 09 01:33:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: 3diff@gnu.org
Cc: fnasser@cygnus.com, dj@delorie.com, gdb-patches@sourceware.cygnus.com
Subject: Re: authorship
Date: Tue, 09 May 2000 01:33:00 -0000
Message-id: <200005090833.EAA10272@indy.delorie.com>
References: <200005081355.JAA19096@delysid.gnu.org> <3916CE20.774F4438@cygnus.com> <200005081544.LAA19526@delysid.gnu.org> <200005081637.MAA18610@envy.delorie.com> <3916F261.EB8FAD0C@cygnus.com> <200005081809.OAA20154@delysid.gnu.org>
X-SW-Source: 2000-05/msg00146.html
Content-length: 162
> Date: Mon, 8 May 2000 14:09:55 -0400
> From: Brian Youmans <3diff@gnu.org>
>
> Are people agreed that it is reasonable to add Stan Shebs as an
> author?
Yes.
From ezannoni@cygnus.com Tue May 09 15:26:00 2000
From: Elena Zannoni <ezannoni@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: [PATCH] solib.c, symbol_add_stub()
Date: Tue, 09 May 2000 15:26:00 -0000
Message-id: <14616.37000.411978.581004@kwikemart.cygnus.com>
X-SW-Source: 2000-05/msg00147.html
Content-length: 2818
This patch gets rid of a core dump (reported by Peter Schauer) if
there is no .text section in a shared library.
Will commit tomorrow if there are no objections.
2000-05-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* solib.c (symbol_add_stub): Remember the index and the name of
the section with the lowest address. Use this data (instead of
data from .text) to pass info into symbol_file_add.
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.12
diff -p -u -r1.12 solib.c
--- solib.c 2000/05/05 18:14:27 1.12
+++ solib.c 2000/05/09 22:19:37
@@ -1165,10 +1165,10 @@ symbol_add_stub (arg)
PTR arg;
{
register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
- CORE_ADDR text_addr = 0;
struct section_addr_info *sap;
- int i;
- asection *text_section;
+ CORE_ADDR lowest_addr = 0;
+ int lowest_index;
+ asection *lowest_sect = NULL;
/* Have we already loaded this shared object? */
ALL_OBJFILES (so->objfile)
@@ -1179,32 +1179,33 @@ symbol_add_stub (arg)
/* Find the shared object's text segment. */
if (so->textsection)
- text_addr = so->textsection->addr;
+ {
+ lowest_addr = so->textsection->addr;
+ lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
+ lowest_index = lowest_sect->index;
+ }
else if (so->abfd != NULL)
{
- asection *lowest_sect;
-
- /* If we didn't find a mapped non zero sized .text section, set up
- text_addr so that the relocation in symbol_file_add does no harm. */
+ /* If we didn't find a mapped non zero sized .text section, set
+ up lowest_addr so that the relocation in symbol_file_add does
+ no harm. */
lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
if (lowest_sect == NULL)
bfd_map_over_sections (so->abfd, find_lowest_section,
(PTR) &lowest_sect);
if (lowest_sect)
- text_addr = bfd_section_vma (so->abfd, lowest_sect)
- + LM_ADDR (so);
+ {
+ lowest_addr = bfd_section_vma (so->abfd, lowest_sect)
+ + LM_ADDR (so);
+ lowest_index = lowest_sect->index;
+ }
}
sap = build_section_addr_info_from_section_table (so->sections,
so->sections_end);
+
+ sap->other[lowest_index].addr = lowest_addr;
- /* Look for the index for the .text section in the sap structure. */
- text_section = bfd_get_section_by_name (so->abfd, ".text");
- for (i = 0; i < MAX_SECTIONS && sap->other[i].name; i++)
- if (sap->other[i].sectindex == text_section->index)
- break;
-
- sap->other[i].addr = text_addr;
so->objfile = symbol_file_add (so->so_name, so->from_tty,
sap, 0, OBJF_SHARED);
free_section_addr_info (sap);
prev parent reply other threads:[~2000-05-08 14:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3916DC7C.D17FE386@mozilla.org>
2000-05-08 9:16 ` Michael Snyder
2000-05-08 14:47 ` Daniel Berlin
2000-05-08 14:50 ` Michael Snyder [this message]
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=391736AA.7EAC@cygnus.com \
--to=msnyder@cygnus.com \
--cc=blizzard@mozilla.org \
--cc=dan@cgsoftware.com \
--cc=gdb-patches@sourceware.cygnus.com \
/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