From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: gdb-patches@sourceware.cygnus.com Subject: Conversion of the GNU Hurd to the new i386 register layout Date: Mon, 20 Dec 1999 14:38:00 -0000 Message-id: <199912202238.XAA00177@delius.kettenis.local> X-SW-Source: 1999-q4/msg00407.html The following patch converts the GNU Hurd to the new i386 register layout. Mark 1999-12-20 Mark Kettenis * config/i386/tm-i386gnu.h (THREAD_STATE_FLAVOR): Define to i386_REGS_SEGS_STATE. (HAVE_I387_REGS): Define. (FLOAT_INFO): Remove. * i386gnu-nat.c: Almost completely rewritten to use new i386 register layout and `float info' implementation. * gnu-nat.c (inf_update_procs, proc_get_state, proc_string): Move prototypes from here. * gnu-nat.h: To here. Index: gdb/gdb/config/i386/tm-i386gnu.h =================================================================== RCS file: /var/cvsroot/gdb/gdb/config/i386/tm-i386gnu.h,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 tm-i386gnu.h --- gdb/gdb/config/i386/tm-i386gnu.h 1999/07/19 17:23:27 1.1.1.2 +++ gdb/gdb/config/i386/tm-i386gnu.h 1999/12/20 21:06:55 @@ -1,4 +1,4 @@ -/* Macro definitions for i386, GNU Hurd +/* Macro definitions for i386 running the GNU Hurd. Copyright (C) 1992, 1999 Free Software Foundation, Inc. This file is part of GDB. @@ -21,26 +21,26 @@ #ifndef TM_I386GNU_H #define TM_I386GNU_H 1 -/* Include common definitions for gnu systems */ +/* Include common definitions for GNU systems. + FIXME: This does not belong here since this is supposed to contain + only native-dependent information. */ #include "nm-gnu.h" /* Thread flavors used in re-setting the T bit. - * @@ this is also bad for cross debugging. - */ -#define THREAD_STATE_FLAVOR i386_THREAD_STATE + FIXME: This is native-dependent. */ +#define THREAD_STATE_FLAVOR i386_REGS_SEGS_STATE #define THREAD_STATE_SIZE i386_THREAD_STATE_COUNT #define THREAD_STATE_SET_TRACED(state) \ ((struct i386_thread_state *)state)->efl |= 0x100 #define THREAD_STATE_CLEAR_TRACED(state) \ ((((struct i386_thread_state *)state)->efl &= ~0x100), 1) -/* we can do it */ +/* We can attach and detach. + FIXME: This is probably native-dependent too. */ #define ATTACH_DETACH 1 +#define HAVE_I387_REGS #include "i386/tm-i386.h" - -#undef FLOAT_INFO -#define FLOAT_INFO { i386_mach3_float_info (); } /* Offset to saved PC in sigcontext. */ #define SIGCONTEXT_PC_OFFSET 68 Index: gdb/gdb/i386gnu-nat.c =================================================================== RCS file: /var/cvsroot/gdb/gdb/i386gnu-nat.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 i386gnu-nat.c --- gdb/gdb/i386gnu-nat.c 1999/07/19 17:22:27 1.1.1.2 +++ gdb/gdb/i386gnu-nat.c 1999/12/20 20:31:13 @@ -1,4 +1,4 @@ -/* Low level interface to I386 running the GNU Hurd +/* Low level interface to i386 running the GNU Hurd. Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -22,36 +22,41 @@ #include "inferior.h" #include "floatformat.h" +#include #include #include #include +#include #include #include -#include #include "gnu-nat.h" + +/* The FPU hardware state. */ +struct env387 +{ + unsigned short control; + unsigned short r0; + unsigned short status; + unsigned short r1; + unsigned short tag; + unsigned short r2; + unsigned long eip; + unsigned short code_seg; + unsigned short opcode; + unsigned long operand; + unsigned short operand_seg; + unsigned short r3; + unsigned char regs[8][10]; +}; -/* Hmmm... Should this not be here? - * Now for i386_float_info() target_has_execution - */ -#include - -/* @@@ Should move print_387_status() to i387-tdep.c */ -extern void print_387_control_word (); /* i387-tdep.h */ -extern void print_387_status_word (); -/* Find offsets to thread states at compile time. - * If your compiler does not grok this, calculate offsets - * offsets yourself and use them (or get a compatible compiler :-) - */ - -#define REG_OFFSET(reg) (int)(&((struct i386_thread_state *)0)->reg) - -/* at reg_offset[i] is the offset to the i386_thread_state - * location where the gdb registers[i] is stored. - */ +/* Offset to the thread_state_t location where REG is stored. */ +#define REG_OFFSET(reg) offsetof (struct i386_thread_state, reg) +/* At reg_offset[i] is the offset to the thread_state_t location where + the gdb registers[i] is stored. */ static int reg_offset[] = { REG_OFFSET (eax), REG_OFFSET (ecx), REG_OFFSET (edx), REG_OFFSET (ebx), @@ -60,309 +65,268 @@ REG_OFFSET (ds), REG_OFFSET (es), REG_OFFSET (fs), REG_OFFSET (gs) }; -#define REG_ADDR(state,regnum) ((char *)(state)+reg_offset[regnum]) +#define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum]) -/* Fetch COUNT contiguous registers from thread STATE starting from REGNUM - * Caller knows that the regs handled in one transaction are of same size. - */ -#define FETCH_REGS(state, regnum, count) \ - memcpy (®isters[REGISTER_BYTE (regnum)], \ - REG_ADDR (state, regnum), \ - count * REGISTER_RAW_SIZE (regnum)) - -/* Store COUNT contiguous registers to thread STATE starting from REGNUM */ -#define STORE_REGS(state, regnum, count) \ - memcpy (REG_ADDR (state, regnum), \ - ®isters[REGISTER_BYTE (regnum)], \ - count * REGISTER_RAW_SIZE (regnum)) -/* - * Fetch inferiors registers for gdb. - * REG specifies which (as gdb views it) register, -1 for all. - */ -void -gnu_fetch_registers (int reg) +/* Get the whole floating-point state of THREAD and record the + values of the corresponding (pseudo) registers. */ +static void +fetch_fpregs (struct proc *thread) { - struct proc *thread; - thread_state_t state; - - inf_update_procs (current_inferior); /* Make sure we know about new threads. */ - - thread = inf_tid_to_thread (current_inferior, inferior_pid); - if (!thread) - error ("fetch inferior registers: %d: Invalid thread", inferior_pid); - - state = proc_get_state (thread, 0); + mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT; + struct i386_float_state state; + struct env387 *ep = (struct env387 *) state.hw_state; + error_t err; + int i; - if (!state) - warning ("Couldn't fetch register %s from %s (invalid thread).", - REGISTER_NAME (reg), proc_string (thread)); - else if (reg >= 0) + err = thread_get_state (thread->port, i386_FLOAT_STATE, + (thread_state_t) &state, &count); + if (err) { - proc_debug (thread, "fetching register: %s", REGISTER_NAME (reg)); - supply_register (reg, REG_ADDR (state, reg)); - thread->fetched_regs |= (1 << reg); + warning ("Couldn't fetch floating-point state from %s", + proc_string (thread)); + return; } - else + + if (! state.initialized) + /* The floating-point state isn't initialized. */ { - proc_debug (thread, "fetching all registers"); - for (reg = 0; reg < NUM_REGS; reg++) - supply_register (reg, REG_ADDR (state, reg)); - thread->fetched_regs = ~0; + for (i = FP0_REGNUM; i <= FP7_REGNUM; i++) + supply_register (i, NULL); + for (i = FIRST_FPU_CTRL_REGNUM; i <= LAST_FPU_CTRL_REGNUM; i++) + supply_register (i, NULL); + + return; } + + /* Supply the floating-point registers. */ + for (i = 0; i < 8; i++) + supply_register (FP0_REGNUM + i, ep->regs[i]); + + supply_register (FCTRL_REGNUM, (char *) &ep->control); + supply_register (FSTAT_REGNUM, (char *) &ep->status); + supply_register (FTAG_REGNUM, (char *) &ep->tag); + supply_register (FCOFF_REGNUM, (char *) &ep->eip); + supply_register (FDS_REGNUM, (char *) &ep->operand_seg); + supply_register (FDOFF_REGNUM, (char *) &ep->operand); + + /* Store the code segment and opcode pseudo registers. */ + { + long l; + + l = ep->code_seg; + supply_register (FCS_REGNUM, (char *) &l); + l = ep->opcode & ((1 << 11) - 1); + supply_register (FOP_REGNUM, (char *) &l); + } } - -/* Store our register values back into the inferior. - * If REG is -1, do this for all registers. - * Otherwise, REG specifies which register - * - * On mach3 all registers are always saved in one call. - */ + +/* Fetch register REGNO, or all regs if REGNO is -1. */ void -gnu_store_registers (reg) - int reg; +gnu_fetch_registers (int regno) { struct proc *thread; - int was_aborted, was_valid; - thread_state_t state; - thread_state_data_t old_state; - inf_update_procs (current_inferior); /* Make sure we know about new threads. */ + /* Make sure we know about new threads. */ + inf_update_procs (current_inferior); thread = inf_tid_to_thread (current_inferior, inferior_pid); if (!thread) - error ("store inferior registers: %d: Invalid thread", inferior_pid); - - proc_debug (thread, "storing register %s.", REGISTER_NAME (reg)); - - was_aborted = thread->aborted; - was_valid = thread->state_valid; - if (!was_aborted && was_valid) - bcopy (&thread->state, &old_state, sizeof (old_state)); + error ("Can't fetch registers from thread %d: No such thread", + inferior_pid); - state = proc_get_state (thread, 1); - - if (!state) - warning ("Couldn't store register %s from %s (invalid thread).", - REGISTER_NAME (reg), proc_string (thread)); - else + if (regno < NUM_GREGS || regno == -1) { - if (!was_aborted && was_valid) - /* See which registers have changed after aborting the thread. */ + thread_state_t state; + + /* This does the dirty work for us. */ + state = proc_get_state (thread, 0); + if (!state) { - int check_reg; - for (check_reg = 0; check_reg < NUM_REGS; check_reg++) - if ((thread->fetched_regs & (1 << check_reg)) - && bcmp (REG_ADDR (&old_state, check_reg), - REG_ADDR (state, check_reg), - REGISTER_RAW_SIZE (check_reg))) - /* Register CHECK_REG has changed! Ack! */ - { - warning ("Register %s changed after thread was aborted.", - REGISTER_NAME (check_reg)); - if (reg >= 0 && reg != check_reg) - /* Update gdb's copy of the register. */ - supply_register (check_reg, REG_ADDR (state, check_reg)); - else - warning ("... also writing this register! Suspicious..."); - } + warning ("Couldn't fetch registers from %s", + proc_string (thread)); + return; } - if (reg >= 0) + if (regno == -1) { - proc_debug (thread, "storing register: %s", REGISTER_NAME (reg)); - STORE_REGS (state, reg, 1); + int i; + + proc_debug (thread, "fetching all register"); + + for (i = 0; i < NUM_GREGS; i++) + supply_register (i, REG_ADDR (state, i)); + thread->fetched_regs = ~0; } else { - proc_debug (thread, "storing all registers"); - for (reg = 0; reg < NUM_REGS; reg++) - STORE_REGS (state, reg, 1); + proc_debug (thread, "fetching register %s", REGISTER_NAME (regno)); + + supply_register (regno, REG_ADDR (state, regno)); + thread->fetched_regs |= (1 << regno); } } + + if (regno >= NUM_GREGS || regno == -1) + { + proc_debug (thread, "fetching floating-point registers"); + + fetch_fpregs (thread); + } } + -/* jtv@hut.fi: I copied and modified this 387 code from - * gdb/i386-xdep.c. Modifications for Mach 3.0. - * - * i387 status dumper. See also i387-tdep.c - */ -struct env387 +/* Fill the i387 hardware state EP with selected data from the set of + (pseudo) registers specified by REGS and VALID. VALID is an array + indicating which registers in REGS are valid. If VALID is zero, + all registers are assumed to be valid. */ +static void +convert_to_env387 (struct env387 *ep, char *regs, signed char *valid) { - unsigned short control; - unsigned short r0; - unsigned short status; - unsigned short r1; - unsigned short tag; - unsigned short r2; - unsigned long eip; - unsigned short code_seg; - unsigned short opcode; - unsigned long operand; - unsigned short operand_seg; - unsigned short r3; - unsigned char regs[8][10]; -}; -/* This routine is machine independent? - * Should move it to i387-tdep.c but you need to export struct env387 - */ -static -print_387_status (status, ep) - unsigned short status; - struct env387 *ep; -{ int i; - int bothstatus; - int top; - int fpreg; - unsigned char *p; - bothstatus = ((status != 0) && (ep->status != 0)); - if (status != 0) - { - if (bothstatus) - printf_unfiltered ("u: "); - print_387_status_word (status); - } + /* Fill in the floating-point registers. */ + for (i = 0; i < 8; i++) + if (!valid || valid[i]) + memcpy (ep->regs[i], ®s[REGISTER_BYTE (FP0_REGNUM + i)], + REGISTER_RAW_SIZE (FP0_REGNUM + i)); + +#define fill(member, regno) \ + if (!valid || valid[(regno)]) \ + memcpy (&ep->member, ®s[REGISTER_BYTE (regno)], \ + sizeof (ep->member)); + + fill (control, FCTRL_REGNUM); + fill (status, FSTAT_REGNUM); + fill (tag, FTAG_REGNUM); + fill (eip, FCOFF_REGNUM); + fill (operand, FDOFF_REGNUM); + fill (operand_seg, FDS_REGNUM); + +#undef fill + + if (!valid || valid[FCS_REGNUM]) + ep->code_seg = + (* (int *) ®isters[REGISTER_BYTE (FCS_REGNUM)] & 0xffff); + + if (!valid || valid[FOP_REGNUM]) + ep->opcode = + ((* (int *) ®isters[REGISTER_BYTE (FOP_REGNUM)] & ((1 << 11) - 1))); +} - if (ep->status != 0) +/* Store the whole floating-point state into THREAD using information + from the corresponding (pseudo) registers. */ +static void +store_fpregs (struct proc *thread) +{ + mach_msg_type_number_t count = i386_FLOAT_STATE_COUNT; + struct i386_float_state state; + error_t err; + + err = thread_get_state (thread->port, i386_FLOAT_STATE, + (thread_state_t) &state, &count); + if (err) { - if (bothstatus) - printf_unfiltered ("e: "); - print_387_status_word (ep->status); + warning ("Couldn't fetch floating-point state from %s", + proc_string (thread)); + return; } - print_387_control_word (ep->control); - printf_unfiltered ("last exception: "); - printf_unfiltered ("opcode %s; ", local_hex_string (ep->opcode)); - printf_unfiltered ("pc %s:", local_hex_string (ep->code_seg)); - printf_unfiltered ("%s; ", local_hex_string (ep->eip)); - printf_unfiltered ("operand %s", local_hex_string (ep->operand_seg)); - printf_unfiltered (":%s\n", local_hex_string (ep->operand)); - - top = (ep->status >> 11) & 7; - - printf_unfiltered ("regno tag msb lsb value\n"); - for (fpreg = 7; fpreg >= 0; fpreg--) + convert_to_env387 ((struct env387 *) state.hw_state, + registers, register_valid); + + err = thread_set_state (thread->port, i386_FLOAT_STATE, + (thread_state_t) &state, i386_FLOAT_STATE_COUNT); + if (err) { - double val; - - printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); - - switch ((ep->tag >> (fpreg * 2)) & 3) - { - case 0: - printf_unfiltered ("valid "); - break; - case 1: - printf_unfiltered ("zero "); - break; - case 2: - printf_unfiltered ("trap "); - break; - case 3: - printf_unfiltered ("empty "); - break; - } - for (i = 9; i >= 0; i--) - printf_unfiltered ("%02x", ep->regs[fpreg][i]); - - floatformat_to_double (&floatformat_i387_ext, (char *) ep->regs[fpreg], - &val); - printf_unfiltered (" %g\n", val); + warning ("Couldn't store floating-point state into %s", + proc_string (thread)); + return; } - if (ep->r0) - printf_unfiltered ("warning: reserved0 is %s\n", local_hex_string (ep->r0)); - if (ep->r1) - printf_unfiltered ("warning: reserved1 is %s\n", local_hex_string (ep->r1)); - if (ep->r2) - printf_unfiltered ("warning: reserved2 is %s\n", local_hex_string (ep->r2)); - if (ep->r3) - printf_unfiltered ("warning: reserved3 is %s\n", local_hex_string (ep->r3)); } - -/* - * values that go into fp_kind (from ) - */ -#define FP_NO 0 /* no fp chip, no emulator (no fp support) */ -#define FP_SW 1 /* no fp chip, using software emulator */ -#define FP_HW 2 /* chip present bit */ -#define FP_287 2 /* 80287 chip present */ -#define FP_387 3 /* 80387 chip present */ -typedef struct fpstate +/* Store at least register REGNO, or all regs if REGNO == -1. */ +void +gnu_store_registers (int regno) { -#if 1 - unsigned char state[FP_STATE_BYTES]; /* "hardware" state */ -#else - struct env387 state; /* Actually this */ -#endif - int status; /* Duplicate status */ -} - *fpstate_t; + struct proc *thread; -/* Mach 3 specific routines. - */ -static int -get_i387_state (fstate) - struct fpstate *fstate; -{ - error_t err; - thread_state_data_t state; - unsigned int fsCnt = i386_FLOAT_STATE_COUNT; - struct i386_float_state *fsp; - struct proc *thread = inf_tid_to_thread (current_inferior, inferior_pid); + /* Make sure we know about new threads. */ + inf_update_procs (current_inferior); + thread = inf_tid_to_thread (current_inferior, inferior_pid); if (!thread) - error ("get_i387_state: Invalid thread"); - - proc_abort (thread, 0); /* Make sure THREAD's in a reasonable state. */ + error ("Couldn't store registers into thread %d: No such thread", + inferior_pid); - err = thread_get_state (thread->port, i386_FLOAT_STATE, state, &fsCnt); - if (err) + if (regno < NUM_GREGS || regno == -1) { - warning ("Can not get live floating point state: %s", - mach_error_string (err)); - return 0; - } + thread_state_t state; + thread_state_data_t old_state; + int was_aborted = thread->aborted; + int was_valid = thread->state_valid; - fsp = (struct i386_float_state *) state; - /* The 387 chip (also 486 counts) or a software emulator? */ - if (!fsp->initialized || (fsp->fpkind != FP_387 && fsp->fpkind != FP_SW)) - return 0; + if (!was_aborted && was_valid) + memcpy (&old_state, &thread->state, sizeof (old_state)); - /* Clear the target then copy thread's float state there. - Make a copy of the status word, for some reason? - */ - memset (fstate, 0, sizeof (struct fpstate)); + state = proc_get_state (thread, 1); + if (!state) + { + warning ("Couldn't store registers into %s", proc_string (thread)); + return; + } - fstate->status = fsp->exc_status; + if (!was_aborted && was_valid) + /* See which registers have changed after aborting the thread. */ + { + int check_regno; - memcpy (fstate->state, (char *) &fsp->hw_state, FP_STATE_BYTES); + for (check_regno = 0; check_regno < NUM_GREGS; check_regno++) + if ((thread->fetched_regs & (1 << check_regno)) + && memcpy (REG_ADDR (&old_state, check_regno), + REG_ADDR (state, check_regno), + REGISTER_RAW_SIZE (check_regno))) + /* Register CHECK_REGNO has changed! Ack! */ + { + warning ("Register %s changed after the thread was aborted", + REGISTER_NAME (check_regno)); + if (regno >= 0 && regno != check_regno) + /* Update gdb's copy of the register. */ + supply_register (check_regno, REG_ADDR (state, check_regno)); + else + warning ("... also writing this register! Suspicious..."); + } + } - return 1; -} +#define fill(state, regno) \ + memcpy (REG_ADDR(state, regno), ®isters[REGISTER_BYTE (regno)], \ + REGISTER_RAW_SIZE (regno)) -/* - * This is called by "info float" command - */ -void -i386_mach3_float_info () -{ - char buf[sizeof (struct fpstate) + 2 * sizeof (int)]; - int valid = 0; - fpstate_t fps; + if (regno == -1) + { + int i; + + proc_debug (thread, "storing all registers"); - if (target_has_execution) - valid = get_i387_state (buf); + for (i = 0; i < NUM_GREGS; i++) + if (register_valid[i]) + fill (state, i); + } + else + { + proc_debug (thread, "storing register %s", REGISTER_NAME (regno)); - if (!valid) - { - warning ("no floating point status saved"); - return; + assert (register_valid[regno]); + fill (state, regno); + } } - fps = (fpstate_t) buf; +#undef fill - print_387_status (fps->status, (struct env387 *) fps->state); + if (regno >= NUM_GREGS || regno == -1) + { + proc_debug (thread, "storing floating-point registers"); + + store_fpregs (thread); + } } Index: gdb/gdb/gnu-nat.c =================================================================== RCS file: /var/cvsroot/gdb/gdb/gnu-nat.c,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 gnu-nat.c --- gdb/gdb/gnu-nat.c 1999/10/16 15:27:26 1.1.1.5 +++ gdb/gdb/gnu-nat.c 1999/12/20 20:43:12 @@ -1,4 +1,4 @@ -/* Interface GDB to the GNU Hurd +/* Interface GDB to the GNU Hurd. Copyright (C) 1992, 1995, 1996, 1997, 1999 Free Software Foundation, Inc. This file is part of GDB. @@ -88,7 +88,6 @@ extern struct target_ops gnu_ops; -int inf_update_procs (struct inf *inf); struct inf *make_inf (); void inf_clear_wait (struct inf *inf); void inf_cleanup (struct inf *inf); @@ -116,7 +115,6 @@ debug ("{inf %d %p}: " msg, __inf->pid, __inf , ##args); } while (0) void proc_abort (struct proc *proc, int force); -thread_state_t proc_get_state (struct proc *proc, int force); struct proc *make_proc (struct inf *inf, mach_port_t port, int tid); struct proc *_proc_free (struct proc *proc); int proc_update_sc (struct proc *proc); @@ -126,7 +124,6 @@ void proc_steal_exc_port (struct proc *proc, mach_port_t exc_port); void proc_restore_exc_port (struct proc *proc); int proc_trace (struct proc *proc, int set); -char *proc_string (struct proc *proc); /* Evaluate RPC_EXPR in a scope with the variables MSGPORT and REFPORT bound to INF's msg port and task port respectively. If it has no msg port, Index: gdb/gdb/gnu-nat.h =================================================================== RCS file: /var/cvsroot/gdb/gdb/gnu-nat.h,v retrieving revision 1.1.1.3 diff -u -r1.1.1.3 gnu-nat.h --- gdb/gdb/gnu-nat.h 1999/07/19 17:22:22 1.1.1.3 +++ gdb/gdb/gnu-nat.h 1999/12/20 20:38:32 @@ -31,6 +31,9 @@ /* Converts a GDB pid to a struct proc. */ struct proc *inf_tid_to_thread (struct inf *inf, int tid); +/* Makes sure that INF's thread list is synced with the actual process. */ +int inf_update_procs (struct inf *inf); + /* A proc is either a thread, or the task (there can only be one task proc because it always has the same TID, PROC_TID_TASK). */ struct proc @@ -75,7 +78,14 @@ extern int __proc_pid (struct proc *proc); +/* Make sure that the state field in PROC is up to date, and return a + pointer to it, or 0 if something is wrong. If WILL_MODIFY is true, + makes sure that the thread is stopped and aborted first, and sets + the state_changed field in PROC to true. */ extern thread_state_t proc_get_state (struct proc *proc, int will_modify); + +/* Return printable description of proc. */ +extern char *proc_string (struct proc *proc); #define proc_debug(_proc, msg, args...) \ do { struct proc *__proc = (_proc); \ >From jimb@cygnus.com Tue Dec 21 12:27:00 1999 From: Jim Blandy To: gdb-patches@sourceware.cygnus.com Subject: RFA: test suite fixes Date: Tue, 21 Dec 1999 12:27:00 -0000 Message-id: <199912212027.PAA05883@zwingli.cygnus.com> X-SW-Source: 1999-q4/msg00408.html Content-length: 1783 I'd like to commit this to devo. Any comments? 1999-12-21 Jim Blandy * gdb.base/break.exp ("breakpoint line number"): Make sure the default source file is set properly before running this test. * gdb.base/break.exp ("stub continue"): Fix pattern. Index: gdb/testsuite/gdb.base/break.exp =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/break.exp,v retrieving revision 1.48 diff -c -c -b -F'^(' -r1.48 break.exp *** gdb/testsuite/gdb.base/break.exp 1999/10/02 00:24:35 1.48 --- gdb/testsuite/gdb.base/break.exp 1999/12/21 20:22:02 *************** *** 92,97 **** --- 92,106 ---- # # test break at line number # + # Note that the default source file is the last one whose source text + # was printed. For native debugging, before we've executed the + # program, this is the file containing main, but for remote debugging, + # it's wherever the processor was stopped when we connected to the + # board. So, to be sure, we do a list command. + # + gdb_test "list main" \ + ".*main \\(argc, argv, envp\\).*" \ + "use `list' to establish default source file" gdb_test "break 79" \ "Breakpoint.*at.* file .*$srcfile, line 79\\." \ "breakpoint line number" *************** *** 166,172 **** } } else { if ![target_info exists gdb_stub] { ! gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:75.*75\[\t \]+if .argc.*\{" "stub continue" } } --- 175,181 ---- } } else { if ![target_info exists gdb_stub] { ! gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:75.*75\[\t \]+if .argc.*\{.*" "stub continue" } } >From kingdon@redhat.com Tue Dec 21 14:55:00 1999 From: Jim Kingdon To: lda@research.bell-labs.com Cc: gdb-patches@sourceware.cygnus.com Subject: Re: Linux threads patch for GDB 4.18 Date: Tue, 21 Dec 1999 14:55:00 -0000 Message-id: <199912212255.RAA24624@devserv.devel.redhat.com> References: <14425.18396.966053.996801@eagle.research.bell-labs.com> X-SW-Source: 1999-q4/msg00409.html Content-length: 355 Someone asked me about GDB and threads for Linux, and specifically about the patch I posted to this list in Aug 1999. The answer is that my patch has been checked in and there have been changes since then (such as support of non-x86 platforms). So I would recommend getting the latest GDB out of CVS - see http://sourceware.cygnus.com/gdb/ for details. >From shebs@cygnus.com Tue Dec 21 16:18:00 1999 From: Stan Shebs To: jimb@cygnus.com Cc: gdb-patches@sourceware.cygnus.com Subject: Re: RFA: test suite fixes Date: Tue, 21 Dec 1999 16:18:00 -0000 Message-id: <199912220018.QAA23327@andros.cygnus.com> References: <199912212027.PAA05883@zwingli.cygnus.com> X-SW-Source: 1999-q4/msg00410.html Content-length: 551 Date: Tue, 21 Dec 1999 15:27:37 -0500 (EST) From: Jim Blandy I'd like to commit this to devo. Any comments? Makes sense to me, although I'm curious about why nobody has seen this before. Or have they, and just ignored the failures? Which remote target is doing this? Stan 1999-12-21 Jim Blandy * gdb.base/break.exp ("breakpoint line number"): Make sure the default source file is set properly before running this test. * gdb.base/break.exp ("stub continue"): Fix pattern. >From chastain@cygnus.com Tue Dec 21 17:36:00 1999 From: Michael Elizabeth Chastain To: gdb-patches@sourceware.cygnus.com Cc: cgf@cygnus.com Subject: Discard nested LBRAC symbols without crashing Date: Tue, 21 Dec 1999 17:36:00 -0000 Message-id: <199912220136.RAA02227@makita.cygnus.com> X-SW-Source: 1999-q4/msg00411.html Content-length: 1747 Hello gdb-patches people, Here is my first gdb patch ever. Any feedback is welcome. The problem: In dbxread.c, the function "process_one_symbol" checks for nested definitions of 'F' symbols, complains about them, and ignores them. Unfortunately it messes up the symbol table by calling 'finish_block' before issuing the complaint. The fix: Change process_one_symbol to check for nested definitions before calling 'finish_block' rather than after. This patch applies cleanly to gdb-19991213 snapshot and ought to apply to any version in the past several years. Michael Elizabeth Chastain < mailto:chastain@cygnus.com > "love without fear" --- Index: gdb/dbxread.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/dbxread.c,v retrieving revision 1.243 diff -u -r1.243 dbxread.c --- dbxread.c 1999/11/25 05:56:21 1.243 +++ dbxread.c 1999/12/22 01:17:52 @@ -2379,6 +2379,18 @@ function_start_offset = valu; within_function = 1; + + /* + * 15 Dec 1999, chastain@cygnus.com + * This fixes CR-102753 by catching unmatched lbrac before + * trying to finish the symbol. + */ + if (context_stack_depth > 1) + { + complain (&lbrac_unmatched_complaint, symnum); + break; + } + if (context_stack_depth > 0) { new = pop_context (); @@ -2386,9 +2398,6 @@ finish_block (new->name, &local_symbols, new->old_blocks, new->start_addr, valu, objfile); } - /* Stack must be empty now. */ - if (context_stack_depth != 0) - complain (&lbrac_unmatched_complaint, symnum); new = push_context (0, valu); new->name = define_symbol (valu, name, desc, type, objfile); >From chastain@cygnus.com Tue Dec 21 19:58:00 1999 From: Michael Elizabeth Chastain To: gdb-patches@sourceware.cygnus.com Subject: Attempt #2: gdb patch to complain properly about nested symbols Date: Tue, 21 Dec 1999 19:58:00 -0000 Message-id: <199912220358.TAA02728@makita.cygnus.com> X-SW-Source: 1999-q4/msg00412.html Content-length: 1941 Hello gdb-patches people, Here's spin #2 of my patch to complain properly about nested symbols. Per Kevin and Jason's responses, I changed the textual description and moved the text out of the code and into the ChangeLog. Michael Elizabeth Chastain "love without fear" --- Index: gdb/ChangeLog =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/ChangeLog,v retrieving revision 1.5776 diff -u -r1.5776 ChangeLog --- ChangeLog 1999/12/18 03:37:39 1.5776 +++ ChangeLog 1999/12/22 03:57:07 @@ -1,3 +1,11 @@ +1999-12-21 Michael Chastain + + * dbxread.c (process_one_symbol): check for strange nested + LBRAC symbols before calling finish_block rather than after. + Also do not call define_symbol for these symbols. These symbols + would end up half-constructed with a null "table" pointer and + crash gdb later. + Fri Dec 17 18:24:58 1999 David Taylor * language.c (_initialize_language): move settings of language, Index: gdb/dbxread.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/dbxread.c,v retrieving revision 1.243 diff -u -r1.243 dbxread.c --- dbxread.c 1999/11/25 05:56:21 1.243 +++ dbxread.c 1999/12/22 03:57:08 @@ -2379,6 +2379,13 @@ function_start_offset = valu; within_function = 1; + + if (context_stack_depth > 1) + { + complain (&lbrac_unmatched_complaint, symnum); + break; + } + if (context_stack_depth > 0) { new = pop_context (); @@ -2386,9 +2393,6 @@ finish_block (new->name, &local_symbols, new->old_blocks, new->start_addr, valu, objfile); } - /* Stack must be empty now. */ - if (context_stack_depth != 0) - complain (&lbrac_unmatched_complaint, symnum); new = push_context (0, valu); new->name = define_symbol (valu, name, desc, type, objfile); >From elgin@gnu.org Wed Dec 22 10:44:00 1999 From: Jim Elgin To: gdb-patches@sourceware.cygnus.com Cc: gvc@gnu.org Subject: [relson@expressgate.net: gdb & objective-c] Date: Wed, 22 Dec 1999 10:44:00 -0000 Message-id: <199912221839.NAA31556@5041Qjd-253.024.popsite.net> X-SW-Source: 1999-q4/msg00413.html Content-length: 1172 Hi I received the following offer of help with gdb. If you would like to communicate with David directly, that would be fine. If you would prefer that I convey a message, I would be happy to do that. Jim ------- Start of forwarded message ------- X-Sender: relson@expressgate.net@mail.expressgate.net Date: Tue, 21 Dec 1999 15:09:24 -0500 To: gvc@gnu.org From: David Relson Subject: gdb & objective-c Content-Type: text/plain; charset="us-ascii"; format=flowed X-UIDL: 429f64508db94990985d0db48ea55167 Greetings, It is my understanding that Apple has signed the copyright of their GDB patches to the FSF, so they can be integrated into mainline 4.18. I'm interested enough in having this done, that I might be willing to do it myself. Who do I have to talk to to learn more about what needs to be done? Thanks. David - -------------------------------------------------------- David Relson Osage Software Systems, Inc. relson@expressgate.net Ann Arbor, MI 48103 734.995.3636 ------- End of forwarded message ------- -- Jim Elgin Gnu Volunteer Coordinator elgin@gnu.org >From molter@csl.sri.com Wed Dec 22 11:29:00 1999 From: Marco Molteni To: gdb-patches@sourceware.cygnus.com Subject: small patch to gdbserver to make it compile under linux 2.2.5 Date: Wed, 22 Dec 1999 11:29:00 -0000 Message-id: <19991222112941.A84629@sofia.csl.sri.com> X-SW-Source: 1999-q4/msg00414.html Content-length: 665 Hi, I'd like to contribute a small patch I did to the gdbserver source (from the gdb-4.18.tar.gz distribution) in order to make it compile under Linux. The Linux kernel version I used is:2.2.5-15smp The compiler is egcs-2.91.66 If you like, I can also contribute a patch to make gdbserver to control the remote host IP address before accepting the connection (now gdbserver happily accepts the first connection request). I hereby give the copyright of my humble patch to the FSF or to who is needed to make you accept the patch. Best regards Marco -- Marco Molteni SRI International, System Design Laboratory 333 Ravenswood Avenue, Menlo Park, CA 94025, USA. >From kevinb@cygnus.com Wed Dec 22 12:25:00 1999 From: Kevin Buettner To: Marco Molteni , gdb-patches@sourceware.cygnus.com Subject: Re: small patch to gdbserver to make it compile under linux 2.2.5 Date: Wed, 22 Dec 1999 12:25:00 -0000 Message-id: <991222202457.ZM21522@ocotillo.lan> References: <19991222112941.A84629@sofia.csl.sri.com> X-SW-Source: 1999-q4/msg00415.html Content-length: 2985 On Dec 22, 11:29am, Marco Molteni wrote: > I'd like to contribute a small patch I did to the gdbserver source > (from the gdb-4.18.tar.gz distribution) in order to make it compile > under Linux. Thanks! However... If you check a recent snapshot from sourceware.cygnus.com, I think you'll find that your concerns are alread addressed by these changes: 1999-10-28 Kevin Buettner * gdbserver/gdbreplay.c (config.h, errno.h): Include. (perror_with_name): Don't declare sys_nerr, sys_errlist, or errno when STDC_HEADERS is defined. * gdbserver/utils.c (STDC_HEADERS): Likewise. * gdbserver/low-hppabsd.c, gdbserver/low-linux.c, gdbserver/low-lynx.c, gdbserver/low-sim.c, gdbserver/low-sparc.c, gdbserver/low-sun3.c (my_registers): Declare. (registers): Changed from array type to pointer type in order to match declaration in inferior.h in main gdb sources. * gdbserver/server.h (registers): Likewise. * gdbserver/remote-utils.c (outreg): Removed declaration of registers[]. * gdbserver/low-linux.c (fetch_register): Changed PTRACE_PEEKUSR to PTRACE_PEEKUSER. [Note the missing 'E'.] (store_inferior_registers): Likewise for PTRACE_POKEUSER. * gdbserver/low-linux.c (sys/ptrace.h): Move include to avoid conflict with #defines coming from . (sys/reg.h): Only include when HAVE_SYS_REG_H is defined. (PTRACE_XFER_TYPE): Provide a default type in case the target doesn't define it. (fetch_register, read_inferior_memory, write_inferior_memory): Use PTRACE_XFER_TYPE instead of int for ptrace() transfers. (I386_GNULINUX_TARGET): Use #ifdef with this symbol instead of assuming it's an x86 target when it's not a m68k target. (i386_register_raw_size, i386_register_byte): Define these arrays to match other changes that've been occuring to the x86 target in the main gdb sources. (initialize_arch): New (static) function for doing target arch specific initializations. [... and still more changes too; see ChangeLog for the rest of 'em] > If you like, I can also contribute a patch to make gdbserver to > control the remote host IP address before accepting the connection > (now gdbserver happily accepts the first connection request). That does sound like a useful thing to have in certain situations. I'd be willing to take a look at it. (I.e, send it my way.) > I hereby give the copyright of my humble patch to the FSF or to who > is needed to make you accept the patch. If only it were this easy... When you send us your patch for controlling which IP addresses are permitted to talk to gdbserver, we'll need a bit more than this if the changes are more than several lines long. See http://sourceware.cygnus.com/gdb/submit.html for the details. I know from personal experience that this can be an incredible hassle, particularly if your employer doesn't see the value in it. (Even if they do, it can sometimes be quite a challenge.) But I assure you that it is necessary. Thanks again, Kevin >From shebs@cygnus.com Wed Dec 22 17:51:00 1999 From: Stan Shebs To: gdb@sourceware.cygnus.com, gdb-patches@sourceware.cygnus.com Subject: Stan Shebs is leaving Cygnus Date: Wed, 22 Dec 1999 17:51:00 -0000 Message-id: <199912230151.RAA24745@andros.cygnus.com> X-SW-Source: 1999-q4/msg00416.html Content-length: 1522 Yes, I'm resigning from Cygnus; my last day in the office is tomorrow, 1999-12-23. Yes, this is rather sudden! The reasons are a little complicated and I don't want to "overshare" :-), so suffice it to say that my personal stock situation makes it advisable for me not to be a Cygnus employee when the Red Hat merger is completed. The timing is somewhat unfortunate, because I'm still completely enthusiastic about Cygnus, Red Hat, GDB, GNU, etc, and our little community's future prospects look brighter than they ever have before. In fact, once my financial situation allows, I would very much like to go to work at Red Hat! In the meantime, I intend to continue working on GDB and to continue maintaining parts of it, while spreading more of my tasks around to other people. RMS has a steering committee proposal that he should be posting soon, and that will be a good first step in this direction. The committee can then decide whether it would prefer GDB to keep the status quo of a single maintainer coordinating sub-maintainers, or to be more anarchic with no single technical decisionmaker, a la GCC. In any case, I'm still planning to serve on this committee. My temporary mail address will be shebs@nabeng.com, at least until I pick a cool domain name for my new consulting business. :-) Also, from 25 Dec to 8 Jan, I'm going to be savoring margaritas in the tropics, and incommunicado during the entire time. After that, however, I will be available for tools consulting and contract work. Stan >From ovidiu@cup.hp.com Wed Dec 22 18:51:00 1999 From: Ovidiu Predescu To: Stan Shebs Cc: gdb@sourceware.cygnus.com, gdb-patches@sourceware.cygnus.com Subject: Re: Stan Shebs is leaving Cygnus Date: Wed, 22 Dec 1999 18:51:00 -0000 Message-id: <199912230249.SAA09138@orion.rgv.hp.com> References: <199912230151.RAA24745@andros.cygnus.com> X-SW-Source: 1999-q4/msg00417.html Content-length: 1957 Hi Stan, I'm terribly sorry to hear this! I was just thinking that you guys at Cygnus must be really lucky with RedHat these days, given the high stock price it has. However it appears it's not quite true :-(. I wish you best of luck in your new enterprise! Greetings and Merry Christmas, Ovidiu On Wed, 22 Dec 1999 17:51:15 -0800, Stan Shebs wrote: > Yes, I'm resigning from Cygnus; my last day in the office is tomorrow, > 1999-12-23. Yes, this is rather sudden! The reasons are a little > complicated and I don't want to "overshare" :-), so suffice it to say > that my personal stock situation makes it advisable for me not to be a > Cygnus employee when the Red Hat merger is completed. > > The timing is somewhat unfortunate, because I'm still completely > enthusiastic about Cygnus, Red Hat, GDB, GNU, etc, and our little > community's future prospects look brighter than they ever have before. > In fact, once my financial situation allows, I would very much like to > go to work at Red Hat! > > In the meantime, I intend to continue working on GDB and to continue > maintaining parts of it, while spreading more of my tasks around to > other people. RMS has a steering committee proposal that he should be > posting soon, and that will be a good first step in this direction. > The committee can then decide whether it would prefer GDB to keep the > status quo of a single maintainer coordinating sub-maintainers, or to > be more anarchic with no single technical decisionmaker, a la GCC. In > any case, I'm still planning to serve on this committee. > > My temporary mail address will be shebs@nabeng.com, at least until I > pick a cool domain name for my new consulting business. :-) Also, from > 25 Dec to 8 Jan, I'm going to be savoring margaritas in the tropics, > and incommunicado during the entire time. After that, however, I will > be available for tools consulting and contract work. > > Stan >