aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-03-03 01:00:57 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-03-03 01:00:57 +0000
commit82a2edfbcf9e89d869c4f60d82c69bc4851aa4e3 (patch)
treeb2a53ed1671d442fb77a78e2efdc662a38707038
parent4e64845ca5e5c23afd925cd780aa08884714cda9 (diff)
downloadgdb-82a2edfbcf9e89d869c4f60d82c69bc4851aa4e3.zip
gdb-82a2edfbcf9e89d869c4f60d82c69bc4851aa4e3.tar.gz
gdb-82a2edfbcf9e89d869c4f60d82c69bc4851aa4e3.tar.bz2
* breakpoint.c, breakpoint.h, c-valprint.c, ch-valprint.c,
cp-valprint.c, eval.c, expprint.c, findvar.c, language.c, objfiles.h, infcmd.c, printcmd.c, stack.c, typeprint.c, valarith.c, valops.c, valprint.c, value.h, values.c: Replace value with value_ptr. This is for the ptx compiler. * objfiles.h, target.h: Don't declare a "sec_ptr" field using a "sec_ptr" typedef. * symm-nat.c: Add a bunch of stuff for symmetry's ptrace stuff. #if 0 i386_float_info. * symm-tdep.c (round): Remove. Also remove sgttyb. * symm-tdep.c: Remove lots of stuff which duplicates stuff from i386-tdep.c. Remove register_addr and ptx_coff_regno_to_gdb. * i386-tdep.c (i386_frame_find_saved_regs): Put in I386_REGNO_TO_SYMMETRY check in case it is needed for Dynix someday. * config/i386/nm-symmetry.h: Change KERNEL_U_ADDR. Move stuff from PTRACE_READ_REGS, PTRACE_WRITE_REGS macros to symm-nat.c. Define CHILD_WAIT and declare child_wait(). * config/i386/tm-symmetry.h: Remove call function stuff; stuff in tm-i386v.h is apparently OK. * config/i386/xm-symmetry.h [_SEQUENT_]: Define HAVE_TERMIOS not HAVE_TERMIO. Define MEM_FNS_DECLARED, NEED_POSIX_SETPGID, and USE_O_NOCTTY.
-rw-r--r--gdb/ChangeLog26
-rw-r--r--gdb/breakpoint.c6
-rw-r--r--gdb/c-valprint.c4
-rw-r--r--gdb/ch-valprint.c4
-rw-r--r--gdb/config/i386/nm-symmetry.h24
-rw-r--r--gdb/config/i386/tm-symmetry.h194
-rw-r--r--gdb/config/i386/xm-symmetry.h13
-rw-r--r--gdb/cp-valprint.c2
-rw-r--r--gdb/language.c10
-rw-r--r--gdb/objfiles.h7
-rw-r--r--gdb/printcmd.c73
-rw-r--r--gdb/symm-nat.c503
-rw-r--r--gdb/symm-tdep.c388
-rw-r--r--gdb/target.h7
-rw-r--r--gdb/typeprint.c4
-rw-r--r--gdb/valprint.c8
-rw-r--r--gdb/value.h261
-rw-r--r--gdb/values.c128
18 files changed, 925 insertions, 737 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e4fdc8f..cda1a59 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,29 @@
+Wed Mar 2 09:17:55 1994 Jim Kingdon (kingdon@deneb.cygnus.com)
+
+ * breakpoint.c, breakpoint.h, c-valprint.c, ch-valprint.c,
+ cp-valprint.c, eval.c, expprint.c, findvar.c, language.c,
+ objfiles.h, infcmd.c, printcmd.c, stack.c, typeprint.c,
+ valarith.c, valops.c, valprint.c, value.h, values.c: Replace
+ value with value_ptr. This is for the ptx compiler.
+ * objfiles.h, target.h: Don't declare a "sec_ptr" field using a
+ "sec_ptr" typedef.
+ * symm-nat.c: Add a bunch of stuff for symmetry's ptrace stuff.
+ #if 0 i386_float_info.
+ * symm-tdep.c (round): Remove. Also remove sgttyb.
+ * symm-tdep.c: Remove lots of stuff which duplicates stuff from
+ i386-tdep.c. Remove register_addr and ptx_coff_regno_to_gdb.
+ * i386-tdep.c (i386_frame_find_saved_regs): Put in
+ I386_REGNO_TO_SYMMETRY check in case it is needed for Dynix
+ someday.
+ * config/i386/nm-symmetry.h: Change KERNEL_U_ADDR. Move
+ stuff from PTRACE_READ_REGS, PTRACE_WRITE_REGS macros to
+ symm-nat.c. Define CHILD_WAIT and declare child_wait().
+ * config/i386/tm-symmetry.h: Remove call function stuff; stuff in
+ tm-i386v.h is apparently OK.
+ * config/i386/xm-symmetry.h [_SEQUENT_]: Define HAVE_TERMIOS not
+ HAVE_TERMIO. Define MEM_FNS_DECLARED, NEED_POSIX_SETPGID, and
+ USE_O_NOCTTY.
+
Wed Mar 2 11:31:08 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* osfsolib.c (xfer_link_map_member): Update to use new
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 93597d4..8f86cc4 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -207,7 +207,7 @@ get_number (pp)
to pass to lookup_internalvar(). */
char *varname;
char *start = ++p;
- value val;
+ value_ptr val;
while (isalnum (*p) || *p == '_')
p++;
@@ -1012,8 +1012,8 @@ watchpoint_check (p)
call free_all_values. We can't call free_all_values because
we might be in the middle of evaluating a function call. */
- value mark = value_mark ();
- value new_val = evaluate_expression (bs->breakpoint_at->exp);
+ value_ptr mark = value_mark ();
+ value_ptr new_val = evaluate_expression (bs->breakpoint_at->exp);
if (!value_equal (bs->breakpoint_at->val, new_val))
{
release_value (new_val);
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index bee764d..aa0cd9d 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -200,7 +200,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
}
if (vt_address && vtblprint)
{
- value vt_val;
+ value_ptr vt_val;
struct symbol *wsym = (struct symbol *)NULL;
struct type *wtype;
struct symtab *s;
@@ -263,7 +263,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
{
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_UNDEF)
{
- value deref_val =
+ value_ptr deref_val =
value_at
(TYPE_TARGET_TYPE (type),
unpack_pointer (lookup_pointer_type (builtin_type_void),
diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c
index b9ae35b..24e5031 100644
--- a/gdb/ch-valprint.c
+++ b/gdb/ch-valprint.c
@@ -279,7 +279,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
{
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_UNDEF)
{
- value deref_val =
+ value_ptr deref_val =
value_at
(TYPE_TARGET_TYPE (type),
unpack_pointer (lookup_pointer_type (builtin_type_void),
@@ -375,7 +375,7 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
fputs_filtered (": ", stream);
if (TYPE_FIELD_PACKED (type, i))
{
- value v;
+ value_ptr v;
/* Bitfields require special handling, especially due to byte
order problems. */
diff --git a/gdb/config/i386/nm-symmetry.h b/gdb/config/i386/nm-symmetry.h
index 96cd4d1..a0531e2 100644
--- a/gdb/config/i386/nm-symmetry.h
+++ b/gdb/config/i386/nm-symmetry.h
@@ -18,27 +18,25 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#ifdef _SEQUENT_
-/* ptx */
-#define PTRACE_READ_REGS(pid,regaddr) mptrace (XPT_RREGS, (pid), (regaddr), 0)
-#define PTRACE_WRITE_REGS(pid,regaddr) \
- mptrace (XPT_WREGS, (pid), (regadddr), 0)
-#else
-/* dynix */
-#define PTRACE_READ_REGS(pid,regaddr) ptrace (XPT_RREGS, (pid), (regaddr), 0)
-#define PTRACE_WRITE_REGS(pid,regaddr) \
- ptrace (XPT_WREGS, (pid), (regadddr), 0)
-#endif
-
/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
#define FETCH_INFERIOR_REGISTERS
+#ifdef _SEQUENT_
+#define CHILD_WAIT
+extern int child_wait PARAMS ((int, struct target_waitstatus *));
+#endif
+
/* This is the amount to subtract from u.u_ar0
to get the offset in the core file of the register values. */
#ifdef _SEQUENT_
-#define KERNEL_U_ADDR (0xffffe000) /* VA_UBLOCK */ /* ptx */
+#include <sys/param.h>
+#include <sys/user.h>
+#include <sys/mc_vmparam.h>
+/* VA_UAREA is defined in <sys/mc_vmparam.h>, and is dependant upon
+ sizeof(struct user) */
+#define KERNEL_U_ADDR (VA_UAREA) /* ptx */
#else
#define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG)) /* dynix */
#endif
diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h
index a6a4f0d..2bdf268 100644
--- a/gdb/config/i386/tm-symmetry.h
+++ b/gdb/config/i386/tm-symmetry.h
@@ -33,6 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ptx, not dynix */
#define SDB_REG_TO_REGNUM(value) ptx_coff_regno_to_gdb(value)
extern int ptx_coff_regno_to_gdb();
+
#endif /* _SEQUENT_ */
#define START_INFERIOR_TRAPS_EXPECTED 2
@@ -49,7 +50,7 @@ extern int ptx_coff_regno_to_gdb();
/* For Symmetry, this is really the 'leave' instruction, which */
/* is right before the ret */
-#undef
+#undef ABOUT_TO_RETURN
#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc9)
#if 0
@@ -113,13 +114,17 @@ extern int ptx_coff_regno_to_gdb();
/* Get %fp2 - %fp31 by addition, since they are contiguous */
#undef SP_REGNUM
-#define SP_REGNUM 14 /* Contains address of top of stack */
+#define SP_REGNUM 14 /* esp--Contains address of top of stack */
+#define ESP_REGNUM 14
#undef FP_REGNUM
-#define FP_REGNUM 15 /* Contains address of executing stack frame */
+#define FP_REGNUM 15 /* ebp--Contains address of executing stack frame */
+#define EBP_REGNUM 15
#undef PC_REGNUM
-#define PC_REGNUM 16 /* Contains program counter */
+#define PC_REGNUM 16 /* eip--Contains program counter */
+#define EIP_REGNUM 16
#undef PS_REGNUM
-#define PS_REGNUM 17 /* Contains processor status */
+#define PS_REGNUM 17 /* eflags--Contains processor status */
+#define EFLAGS_REGNUM 17
#ifndef _SEQUENT_
/* dynix, not ptx. For ptx, see register_addr in symm-tdep.c */
@@ -221,8 +226,123 @@ switch (regno) { \
((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
} \
}
+#endif /* not _SEQUENT_ */
+
+#ifdef _SEQUENT_
+/* ptx. For Dynix, see above */
+
+/*
+ * For ptx, this is a little bit bizarre, since the register block
+ * is below the u area in memory. This means that blockend here ends
+ * up being negative (for the call from coredep.c) since the value in
+ * u.u_ar0 will be less than KERNEL_U_ADDR (and coredep.c passes us
+ * u.u_ar0 - KERNEL_U_ADDR in blockend). Since we also define
+ * FETCH_INFERIOR_REGISTERS (and supply our own functions for that),
+ * the core file case will be the only use of this function.
+ */
+
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+{ struct user foo; /* needed for finding fpu regs */ \
+switch (regno) { \
+ case 0: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EAX * sizeof(int)); break; \
+ case 1: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EDX * sizeof(int)); break; \
+ case 2: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (ECX * sizeof(int)); break; \
+ case 3: /* st(0) */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int)&foo.u_fpusave.fpu_stack[0][0] - (int)&foo); \
+ break; \
+ case 4: /* st(1) */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int) &foo.u_fpusave.fpu_stack[1][0] - (int)&foo); \
+ break; \
+ case 5: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EBX * sizeof(int)); break; \
+ case 6: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (ESI * sizeof(int)); break; \
+ case 7: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EDI * sizeof(int)); break; \
+ case 8: /* st(2) */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int) &foo.u_fpusave.fpu_stack[2][0] - (int)&foo); \
+ break; \
+ case 9: /* st(3) */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int) &foo.u_fpusave.fpu_stack[3][0] - (int)&foo); \
+ break; \
+ case 10: /* st(4) */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int) &foo.u_fpusave.fpu_stack[4][0] - (int)&foo); \
+ break; \
+ case 11: /* st(5) */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int) &foo.u_fpusave.fpu_stack[5][0] - (int)&foo); \
+ break; \
+ case 12: /* st(6) */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int) &foo.u_fpusave.fpu_stack[6][0] - (int)&foo); \
+ break; \
+ case 13: /* st(7) */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int) &foo.u_fpusave.fpu_stack[7][0] - (int)&foo); \
+ break; \
+ case 14: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (ESP * sizeof(int)); break; \
+ case 15: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EBP * sizeof(int)); break; \
+ case 16: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (EIP * sizeof(int)); break; \
+ case 17: \
+ addr = blockend + (NBPG * UPAGES) - sizeof(struct user) + (FLAGS * sizeof(int)); break; \
+ case 18: /* fp1 */ \
+ case 19: /* fp2 */ \
+ case 20: /* fp3 */ \
+ case 21: /* fp4 */ \
+ case 22: /* fp5 */ \
+ case 23: /* fp6 */ \
+ case 24: /* fp7 */ \
+ case 25: /* fp8 */ \
+ case 26: /* fp9 */ \
+ case 27: /* fp10 */ \
+ case 28: /* fp11 */ \
+ case 29: /* fp12 */ \
+ case 30: /* fp13 */ \
+ case 31: /* fp14 */ \
+ case 32: /* fp15 */ \
+ case 33: /* fp16 */ \
+ case 34: /* fp17 */ \
+ case 35: /* fp18 */ \
+ case 36: /* fp19 */ \
+ case 37: /* fp20 */ \
+ case 38: /* fp21 */ \
+ case 39: /* fp22 */ \
+ case 40: /* fp23 */ \
+ case 41: /* fp24 */ \
+ case 42: /* fp25 */ \
+ case 43: /* fp26 */ \
+ case 44: /* fp27 */ \
+ case 45: /* fp28 */ \
+ case 46: /* fp29 */ \
+ case 47: /* fp30 */ \
+ case 48: /* fp31 */ \
+ addr = blockend - KERNEL_U_ADDR + \
+ ((int) &foo.u_fpasave.fpa_regs[(regno)-18] - (int)&foo); \
+ } \
+}
#endif /* _SEQUENT_ */
+#undef FRAME_CHAIN
+#define FRAME_CHAIN(thisframe) ((thisframe)->pc == 0 ? \
+ 0 : read_memory_integer((thisframe)->frame, 4))
+
+#define FRAME_CHAIN_VALID(chain, thisframe) \
+ ((chain) != 0)
+
+#undef FRAME_ARGS_SKIP
+#define FRAME_ARGS_SKIP 0
+
/* Total amount of space needed to store our copies of the machine's
register state, the array `registers'. */
/* 10 i386 registers, 8 i387 registers, and 31 Weitek 1167 registers */
@@ -326,70 +446,6 @@ double_to_i387 PARAMS ((char *, char *));
symmetry_extract_return_value(TYPE, REGBUF, VALBUF)
-/* Things needed for making the inferior call functions. FIXME: Merge
- this with the main 386 stuff. */
-
-#define PUSH_DUMMY_FRAME \
-{ CORE_ADDR sp = read_register (SP_REGNUM); \
- int regnum; \
- sp = push_word (sp, read_register (PC_REGNUM)); \
- sp = push_word (sp, read_register (FP_REGNUM)); \
- write_register (FP_REGNUM, sp); \
- for (regnum = 0; regnum < NUM_REGS; regnum++) \
- sp = push_word (sp, read_register (regnum)); \
- write_register (SP_REGNUM, sp); \
-}
-
-#define POP_FRAME \
-{ \
- FRAME frame = get_current_frame (); \
- CORE_ADDR fp; \
- int regnum; \
- struct frame_saved_regs fsr; \
- struct frame_info *fi; \
- fi = get_frame_info (frame); \
- fp = fi->frame; \
- get_frame_saved_regs (fi, &fsr); \
- for (regnum = 0; regnum < NUM_REGS; regnum++) { \
- CORE_ADDR adr; \
- adr = fsr.regs[regnum]; \
- if (adr) \
- write_register (regnum, read_memory_integer (adr, 4)); \
- } \
- write_register (FP_REGNUM, read_memory_integer (fp, 4)); \
- write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
- write_register (SP_REGNUM, fp + 8); \
- flush_cached_frames (); \
- set_current_frame ( create_new_frame (read_register (FP_REGNUM), \
- read_pc ())); \
-}
-
-/* from i386-dep.c, worked better than my original... */
-/* This sequence of words is the instructions
- * call (32-bit offset)
- * int 3
- * This is 6 bytes.
- */
-
-#define CALL_DUMMY { 0x223344e8, 0xcc11 }
-
-#define CALL_DUMMY_LENGTH 8
-
-#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */
-
-/* Insert the specified number of args and function address
- into a call sequence of the above form stored at DUMMYNAME. */
-
-#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
-{ \
- int from, to, delta, loc; \
- loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \
- from = loc + 5; \
- to = (int)(fun); \
- delta = to - from; \
- *(int *)((char *)(dummyname) + 1) = delta; \
-}
-
extern void
print_387_control_word PARAMS ((unsigned int));
diff --git a/gdb/config/i386/xm-symmetry.h b/gdb/config/i386/xm-symmetry.h
index a12c22e..d18d40b 100644
--- a/gdb/config/i386/xm-symmetry.h
+++ b/gdb/config/i386/xm-symmetry.h
@@ -27,8 +27,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef _SEQUENT_
/* ptx */
-#define HAVE_TERMIO
+#define HAVE_TERMIOS
#define USG
+
+#define MEM_FNS_DECLARED
+
+#define NEED_POSIX_SETPGID
+
+#define USE_O_NOCTTY
+
#else
/* dynix */
@@ -43,6 +50,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define PTRACE_DETACH XPT_UNDEBUG
#define ATTACH_DETACH */
+#ifdef _SEQUENT_
+/* ptx does attach as of ptx version 2.1 */
+#define ATTACH_DETACH 1
+
#define HOST_BYTE_ORDER LITTLE_ENDIAN
/* We must fetch all the regs before storing, since we store all at once. */
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 07ba9fb..c6e9b16 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -283,7 +283,7 @@ cp_print_value_fields (type, valaddr, stream, format, recurse, pretty,
}
if (TYPE_FIELD_PACKED (type, i))
{
- value v;
+ value_ptr v;
/* Bitfields require special handling, especially due to byte
order problems. */
diff --git a/gdb/language.c b/gdb/language.c
index 86f37d4..9dcdbba 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -428,8 +428,8 @@ language_info (quietly)
#if 0 /* Currently unused */
struct type *
-binop_result_type(v1,v2)
- value v1,v2;
+binop_result_type (v1, v2)
+ value_ptr v1, v2;
{
int l1,l2,size,uns;
@@ -760,7 +760,7 @@ structured_type(type)
/* Returns non-zero if the value VAL represents a true value. */
int
value_true (val)
- value val;
+ value_ptr val;
{
/* It is possible that we should have some sort of error if a non-boolean
value is used in this context. Possibly dependent on some kind of
@@ -778,7 +778,7 @@ value_true (val)
void
binop_type_check(arg1,arg2,op)
- value arg1,arg2;
+ value_ptr arg1,arg2;
int op;
{
struct type *t1, *t2;
@@ -788,7 +788,7 @@ binop_type_check(arg1,arg2,op)
return;
t1=VALUE_TYPE(arg1);
- if (arg2!=(value)NULL)
+ if (arg2 != NULL)
t2=VALUE_TYPE(arg2);
else
t2=NULL;
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index b8a221d..ac34668 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -139,8 +139,11 @@ struct obj_section {
addresses", but that's not true; addr & endaddr are actual memory
addresses. */
CORE_ADDR offset;
-
- sec_ptr sec_ptr; /* BFD section pointer */
+
+ /* For the ptx compiler, we can't use the sec_ptr typedef when the field's
+ name is sec_ptr. We really should rename the field (or better yet,
+ the typedef should be bfd_sec_ptr). */
+ struct sec *sec_ptr; /* BFD section pointer */
/* Objfile this section is part of. Not currently used, but I'm sure
that someone will want the bfd that the sec_ptr goes with or something
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index f6be184..a9fa164 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -63,7 +63,7 @@ static CORE_ADDR last_examine_address;
/* Contents of last address examined.
This is not valid past the end of the `x' command! */
-static value last_examine_value;
+static value_ptr last_examine_value;
/* Largest offset between a symbolic value and an address, that will be
printed as `0x1234 <symbol+offset>'. */
@@ -182,7 +182,7 @@ static void
do_examine PARAMS ((struct format_data, CORE_ADDR));
static void
-print_formatted PARAMS ((value, int, int));
+print_formatted PARAMS ((value_ptr, int, int));
static struct format_data
decode_format PARAMS ((char **, int, int));
@@ -227,13 +227,6 @@ decode_format (string_ptr, oformat, osize)
break;
}
-#ifndef CC_HAS_LONG_LONG
- /* Make sure 'g' size is not used on integer types.
- Well, actually, we can handle hex. */
- if (val.size == 'g' && val.format != 'f' && val.format != 'x')
- val.size = 'w';
-#endif
-
while (*p == ' ' || *p == '\t') p++;
*string_ptr = p;
@@ -256,9 +249,24 @@ decode_format (string_ptr, oformat, osize)
{
case 'a':
case 's':
- /* Addresses must be words. */
+ /* Pick the appropriate size for an address. */
+#if TARGET_PTR_BIT == 64
+ val.size = osize ? 'g' : osize;
+ break;
+#else /* Not 64 */
+#if TARGET_PTR_BIT == 32
val.size = osize ? 'w' : osize;
break;
+#else /* Not 32 */
+#if TARGET_PTR_BIT == 16
+ val.size = osize ? 'h' : osize;
+ break;
+#else /* Not 16 */
+ #error Bad value for TARGET_PTR_BIT
+#endif /* Not 16 */
+#endif /* Not 32 */
+#endif /* Not 64 */
+ break;
case 'f':
/* Floating point has to be word or giantword. */
if (osize == 'w' || osize == 'g')
@@ -288,7 +296,7 @@ decode_format (string_ptr, oformat, osize)
static void
print_formatted (val, format, size)
- register value val;
+ register value_ptr val;
register int format;
int size;
{
@@ -750,7 +758,7 @@ print_command_1 (exp, inspect, voidprint)
struct expression *expr;
register struct cleanup *old_chain = 0;
register char format = 0;
- register value val;
+ register value_ptr val;
struct format_data fmt;
int cleanup = 0;
@@ -789,7 +797,7 @@ print_command_1 (exp, inspect, voidprint)
&& ( TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT
|| TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_UNION))
{
- value v;
+ value_ptr v;
v = value_from_vtable_info (val, TYPE_TARGET_TYPE (type));
if (v != 0)
@@ -863,7 +871,7 @@ output_command (exp, from_tty)
struct expression *expr;
register struct cleanup *old_chain;
register char format = 0;
- register value val;
+ register value_ptr val;
struct format_data fmt;
if (exp && *exp == '/')
@@ -1453,7 +1461,7 @@ print_variable_value (var, frame, stream)
FRAME frame;
GDB_FILE *stream;
{
- value val = read_var_value (var, frame);
+ value_ptr val = read_var_value (var, frame);
value_print (val, stream, 0, Val_pretty_default);
}
@@ -1477,7 +1485,7 @@ print_frame_args (func, fi, num, stream)
int first = 1;
register int i;
register struct symbol *sym;
- register value val;
+ register value_ptr val;
/* Offset of next stack argument beyond the one we have seen that is
at the highest offset.
-1 if we haven't come to a stack argument yet. */
@@ -1683,14 +1691,14 @@ printf_command (arg, from_tty)
register char *f;
register char *s = arg;
char *string;
- value *val_args;
+ value_ptr *val_args;
char *substrings;
char *current_substring;
int nargs = 0;
int allocated_args = 20;
struct cleanup *old_cleanups;
- val_args = (value *) xmalloc (allocated_args * sizeof (value));
+ val_args = (value_ptr *) xmalloc (allocated_args * sizeof (value_ptr));
old_cleanups = make_cleanup (free_current_contents, &val_args);
if (s == 0)
@@ -1722,21 +1730,38 @@ printf_command (arg, from_tty)
case '\\':
*f++ = '\\';
break;
+ case 'a':
+#ifdef __STDC__
+ *f++ = '\a';
+#else
+ *f++ = '\007'; /* Bell */
+#endif
+ break;
+ case 'b':
+ *f++ = '\b';
+ break;
+ case 'f':
+ *f++ = '\f';
+ break;
case 'n':
*f++ = '\n';
break;
+ case 'r':
+ *f++ = '\r';
+ break;
case 't':
*f++ = '\t';
break;
- case 'r':
- *f++ = '\r';
+ case 'v':
+ *f++ = '\v';
break;
case '"':
*f++ = '"';
break;
default:
/* ??? TODO: handle other escape sequences */
- error ("Unrecognized \\ escape character in format string.");
+ error ("Unrecognized escape character \\%c in format string.",
+ c);
}
break;
@@ -1834,9 +1859,9 @@ printf_command (arg, from_tty)
{
char *s1;
if (nargs == allocated_args)
- val_args = (value *) xrealloc ((char *) val_args,
- (allocated_args *= 2)
- * sizeof (value));
+ val_args = (value_ptr *) xrealloc ((char *) val_args,
+ (allocated_args *= 2)
+ * sizeof (value_ptr));
s1 = s;
val_args[nargs] = parse_to_comma_and_eval (&s1);
diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c
index 752263d..f910d7d 100644
--- a/gdb/symm-nat.c
+++ b/gdb/symm-nat.c
@@ -1,5 +1,5 @@
/* Sequent Symmetry host interface, for GDB when running under Unix.
- Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992, 1994 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,13 +24,20 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
+#include "target.h"
+/* FIXME: What is the _INKERNEL define for? */
+#define _INKERNEL
#include <signal.h>
+#undef _INKERNEL
+#include <sys/wait.h>
#include <sys/param.h>
#include <sys/user.h>
+#include <sys/proc.h>
#include <sys/dir.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+#include <sys/ptrace.h>
#include "gdbcore.h"
#include <fcntl.h>
#include <sgtty.h>
@@ -61,7 +68,7 @@ int regno;
regs.pr_fpa.fpa_regs[i] =
*(int *)&registers[REGISTER_BYTE(FP1_REGNUM+i)];
}
- PTRACE_WRITE_REGS (inferior_pid, (PTRACE_ARG3_TYPE) &regs);
+ mptrace (XPT_WREGS, inferior_pid, (PTRACE_ARG3_TYPE) &regs, 0);
}
void
@@ -74,7 +81,7 @@ fetch_inferior_registers (regno)
registers_fetched ();
- PTRACE_READ_REGS (inferior_pid, (PTRACE_ARG3_TYPE) &regs);
+ mptrace (XPT_RREGS, (pid), (regaddr), 0);
*(int *)&registers[REGISTER_BYTE(EAX_REGNUM)] = regs.pr_eax;
*(int *)&registers[REGISTER_BYTE(EBX_REGNUM)] = regs.pr_ebx;
*(int *)&registers[REGISTER_BYTE(ECX_REGNUM)] = regs.pr_ecx;
@@ -146,7 +153,7 @@ struct pt_regset ep;
for (i = 9; i >= 0; i--)
printf_unfiltered ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]);
- i387_to_double (ep.pr_fpu.fpu_stack[fpreg], (char *)&val);
+ i387_to_double ((char *)ep.pr_fpu.fpu_stack[fpreg], (char *)&val);
printf_unfiltered (" %g\n", val);
}
if (ep.pr_fpu.fpu_rsvd1)
@@ -203,24 +210,46 @@ unsigned int pcr;
if (pcr_tmp & FPA_PCR_20MHZ) printf_unfiltered(" 20MHZ");
if (pcr_tmp & FPA_PCR_CC_Z) printf_unfiltered(" Z");
if (pcr_tmp & FPA_PCR_CC_C2) printf_unfiltered(" C2");
+
+ /* Dynix defines FPA_PCR_CC_C0 to 0x100 and ptx defines
+ FPA_PCR_CC_C1 to 0x100. Use whichever is defined and assume
+ the OS knows what it is doing. */
+#ifdef FPA_PCR_CC_C1
if (pcr_tmp & FPA_PCR_CC_C1) printf_unfiltered(" C1");
- switch (pcr_tmp) {
- case FPA_PCR_CC_Z:
+#endif
+#ifdef FPA_PCR_CC_C0
+ if (pcr_tmp & FPA_PCR_CC_C1) printf_unfiltered(" C0");
+#endif
+
+ switch (pcr_tmp)
+ {
+ case FPA_PCR_CC_Z:
printf_unfiltered(" (Equal)");
break;
- case FPA_PCR_CC_C1:
+#ifdef FPA_PCR_CC_C1
+ case FPA_PCR_CC_C1:
+#endif
+#ifdef FPA_PCR_CC_C0
+ case FPA_PCR_CC_C0:
+#endif
printf_unfiltered(" (Less than)");
break;
- case 0:
+ case 0:
printf_unfiltered(" (Greater than)");
break;
- case FPA_PCR_CC_Z | FPA_PCR_CC_C1 | FPA_PCR_CC_C2:
+ case FPA_PCR_CC_Z |
+#ifdef FPA_PCR_CC_C1
+ FPA_PCR_CC_C1
+#else
+ FPA_PCR_CC_C0
+#endif
+ | FPA_PCR_CC_C2:
printf_unfiltered(" (Unordered)");
break;
- default:
+ default:
printf_unfiltered(" (Undefined)");
break;
- }
+ }
printf_unfiltered("\n");
pcr_tmp = pcr & FPA_PCR_AE;
printf_unfiltered("\tAE= %#x", pcr_tmp);
@@ -279,6 +308,7 @@ struct pt_regset ep;
}
}
+#if 0 /* disabled because it doesn't go through the target vector. */
i386_float_info ()
{
char ubuf[UPAGES*NBPG];
@@ -306,3 +336,454 @@ i386_float_info ()
print_fpu_status(regset);
print_fpa_status(regset);
}
+#endif
+
+static volatile int got_sigchld;
+
+/*ARGSUSED*/
+/* This will eventually be more interesting. */
+void
+sigchld_handler(signo)
+ int signo;
+{
+ got_sigchld++;
+}
+
+/*
+ * Signals for which the default action does not cause the process
+ * to die. See <sys/signal.h> for where this came from (alas, we
+ * can't use those macros directly)
+ */
+#ifndef sigmask
+#define sigmask(s) (1 << ((s) - 1))
+#endif
+#define SIGNALS_DFL_SAFE sigmask(SIGSTOP) | sigmask(SIGTSTP) | \
+ sigmask(SIGTTIN) | sigmask(SIGTTOU) | sigmask(SIGCHLD) | \
+ sigmask(SIGCONT) | sigmask(SIGWINCH) | sigmask(SIGPWR) | \
+ sigmask(SIGURG) | sigmask(SIGPOLL)
+
+
+/*
+ * Thanks to XPT_MPDEBUGGER, we have to mange child_wait().
+ */
+int
+child_wait(pid, status)
+ int pid;
+ struct target_waitstatus *status;
+{
+ int save_errno, rv, xvaloff, saoff, sa_hand;
+ struct pt_stop pt;
+ struct user u;
+ sigset_t set;
+ /* Host signal number for a signal which the inferior terminates with, or
+ 0 if it hasn't terminated due to a signal. */
+ static int death_by_signal = 0;
+#ifdef SVR4_SHARED_LIBS /* use this to distinguish ptx 2 vs ptx 4 */
+ prstatus_t pstatus;
+#endif
+
+ do {
+ if (attach_flag)
+ set_sigint_trap(); /* Causes SIGINT to be passed on to the
+ attached process. */
+ save_errno = errno;
+
+ got_sigchld = 0;
+
+ sigemptyset(&set);
+
+ while (got_sigchld == 0) {
+ sigsuspend(&set);
+ }
+
+ if (attach_flag)
+ clear_sigint_trap();
+
+ rv = mptrace(XPT_STOPSTAT, 0, (char *)&pt, 0);
+ if (-1 == rv) {
+ printf("XPT_STOPSTAT: errno %d\n", errno); /* DEBUG */
+ continue;
+ }
+
+ pid = pt.ps_pid;
+
+ if (pid != inferior_pid) {
+ /* NOTE: the mystery fork in csh/tcsh needs to be ignored.
+ * We should not return new children for the initial run
+ * of a process until it has done the exec.
+ */
+ /* inferior probably forked; send it on its way */
+ rv = mptrace(XPT_UNDEBUG, pid, 0, 0);
+ if (-1 == rv) {
+ printf("child_wait: XPT_UNDEBUG: pid %d: %s\n", pid,
+ safe_strerror(errno));
+ }
+ continue;
+ }
+ /* FIXME: Do we deal with fork notification correctly? */
+ switch (pt.ps_reason) {
+ case PTS_FORK:
+ /* multi proc: treat like PTS_EXEC */
+ /*
+ * Pretend this didn't happen, since gdb isn't set up
+ * to deal with stops on fork.
+ */
+ rv = ptrace(PT_CONTSIG, pid, 1, 0);
+ if (-1 == rv) {
+ printf("PTS_FORK: PT_CONTSIG: error %d\n", errno);
+ }
+ continue;
+ case PTS_EXEC:
+ /*
+ * Pretend this is a SIGTRAP.
+ */
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_TRAP;
+ break;
+ case PTS_EXIT:
+ /*
+ * Note: we stop before the exit actually occurs. Extract
+ * the exit code from the uarea. If we're stopped in the
+ * exit() system call, the exit code will be in
+ * u.u_ap[0]. An exit due to an uncaught signal will have
+ * something else in here, see the comment in the default:
+ * case, below. Finally,let the process exit.
+ */
+ if (death_by_signal)
+ {
+ status->kind = TARGET_WAITKIND_SIGNALED;
+ status->value.sig = target_signal_from_host (death_by_signal);
+ death_by_signal = 0;
+ break;
+ }
+ xvaloff = (unsigned long)&u.u_ap[0] - (unsigned long)&u;
+ errno = 0;
+ rv = ptrace(PT_RUSER, pid, (char *)xvaloff, 0);
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = rv;
+ /*
+ * addr & data to mptrace() don't matter here, since
+ * the process is already dead.
+ */
+ rv = mptrace(XPT_UNDEBUG, pid, 0, 0);
+ if (-1 == rv) {
+ printf("child_wait: PTS_EXIT: XPT_UNDEBUG: pid %d error %d\n", pid,
+ errno);
+ }
+ break;
+ case PTS_WATCHPT_HIT:
+ fatal("PTS_WATCHPT_HIT\n");
+ break;
+ default:
+ /* stopped by signal */
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = target_signal_from_host (pt.ps_reason);
+ death_by_signal = 0;
+
+ if (0 == (SIGNALS_DFL_SAFE & sigmask(pt.ps_reason))) {
+ break;
+ }
+ /* else default action of signal is to die */
+#ifdef SVR4_SHARED_LIBS
+ rv = ptrace(PT_GET_PRSTATUS, pid, (char *)&pstatus, 0);
+ if (-1 == rv)
+ error("child_wait: signal %d PT_GET_PRSTATUS: %s\n",
+ pt.ps_reason, safe_strerror(errno));
+ if (pstatus.pr_cursig != pt.ps_reason) {
+ printf("pstatus signal %d, pt signal %d\n",
+ pstatus.pr_cursig, pt.ps_reason);
+ }
+ sa_hand = (int)pstatus.pr_action.sa_handler;
+#else
+ saoff = (unsigned long)&u.u_sa[0] - (unsigned long)&u;
+ saoff += sizeof(struct sigaction) * (pt.ps_reason - 1);
+ errno = 0;
+ sa_hand = ptrace(PT_RUSER, pid, (char *)saoff, 0);
+ if (errno)
+ error("child_wait: signal %d: RUSER: %s\n",
+ pt.ps_reason, safe_strerror(errno));
+#endif
+ if ((int)SIG_DFL == sa_hand) {
+ /* we will be dying */
+ death_by_signal = pt.ps_reason;
+ }
+ break;
+ }
+
+ } while (pid != inferior_pid); /* Some other child died or stopped */
+
+ return pid;
+}
+
+
+
+/* This function simply calls ptrace with the given arguments.
+ It exists so that all calls to ptrace are isolated in this
+ machine-dependent file. */
+int
+call_ptrace (request, pid, addr, data)
+ int request, pid;
+ PTRACE_ARG3_TYPE addr;
+ int data;
+{
+ return ptrace (request, pid, addr, data);
+}
+
+int
+call_mptrace(request, pid, addr, data)
+ int request, pid;
+ PTRACE_ARG3_TYPE addr;
+ int data;
+{
+ return mptrace(request, pid, addr, data);
+}
+
+#if defined (DEBUG_PTRACE)
+/* For the rest of the file, use an extra level of indirection */
+/* This lets us breakpoint usefully on call_ptrace. */
+#define ptrace call_ptrace
+#define mptrace call_mptrace
+#endif
+
+void
+kill_inferior ()
+{
+ if (inferior_pid == 0)
+ return;
+ /*
+ * Don't use PT_KILL, since the child will stop again with a PTS_EXIT.
+ * Just hit him with SIGKILL (so he stops) and detach.
+ */
+ kill (inferior_pid, SIGKILL);
+ detach(SIGKILL);
+ target_mourn_inferior ();
+}
+
+/* Resume execution of the inferior process.
+ If STEP is nonzero, single-step it.
+ If SIGNAL is nonzero, give it that signal. */
+
+void
+child_resume (pid, step, signal)
+ int pid;
+ int step;
+ int signal;
+{
+ errno = 0;
+
+ if (pid == -1)
+ pid = inferior_pid;
+
+ /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
+ it was. (If GDB wanted it to start some other way, we have already
+ written a new PC value to the child.)
+
+ If this system does not support PT_SSTEP, a higher level function will
+ have called single_step() to transmute the step request into a
+ continue request (by setting breakpoints on all possible successor
+ instructions), so we don't have to worry about that here. */
+
+ if (step)
+ ptrace (PT_SSTEP, pid, (PTRACE_ARG3_TYPE) 1, signal);
+ else
+ ptrace (PT_CONTSIG, pid, (PTRACE_ARG3_TYPE) 1, signal);
+
+ if (errno)
+ perror_with_name ("ptrace");
+}
+
+#ifdef ATTACH_DETACH
+/* Start debugging the process whose number is PID. */
+int
+attach (pid)
+ int pid;
+{
+ sigset_t set;
+ int rv;
+
+ rv = mptrace(XPT_DEBUG, pid, 0, 0);
+ if (-1 == rv) {
+ error("mptrace(XPT_DEBUG): %s", safe_strerror(errno));
+ }
+ rv = mptrace(XPT_SIGNAL, pid, 0, SIGSTOP);
+ if (-1 == rv) {
+ error("mptrace(XPT_SIGNAL): %s", safe_strerror(errno));
+ }
+ attach_flag = 1;
+ return pid;
+}
+
+void
+detach (signo)
+ int signo;
+{
+ int rv;
+
+ rv = mptrace(XPT_UNDEBUG, inferior_pid, 1, signo);
+ if (-1 == rv) {
+ error("mptrace(XPT_UNDEBUG): %s", safe_strerror(errno));
+ }
+ attach_flag = 0;
+}
+
+#endif /* ATTACH_DETACH */
+
+/* Default the type of the ptrace transfer to int. */
+#ifndef PTRACE_XFER_TYPE
+#define PTRACE_XFER_TYPE int
+#endif
+
+
+/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
+ in the NEW_SUN_PTRACE case.
+ It ought to be straightforward. But it appears that writing did
+ not write the data that I specified. I cannot understand where
+ it got the data that it actually did write. */
+
+/* Copy LEN bytes to or from inferior's memory starting at MEMADDR
+ to debugger memory starting at MYADDR. Copy to inferior if
+ WRITE is nonzero.
+
+ Returns the length copied, which is either the LEN argument or zero.
+ This xfer function does not do partial moves, since child_ops
+ doesn't allow memory operations to cross below us in the target stack
+ anyway. */
+
+int
+child_xfer_memory (memaddr, myaddr, len, write, target)
+ CORE_ADDR memaddr;
+ char *myaddr;
+ int len;
+ int write;
+ struct target_ops *target; /* ignored */
+{
+ register int i;
+ /* Round starting address down to longword boundary. */
+ register CORE_ADDR addr = memaddr & - sizeof (PTRACE_XFER_TYPE);
+ /* Round ending address up; get number of longwords that makes. */
+ register int count
+ = (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1)
+ / sizeof (PTRACE_XFER_TYPE);
+ /* Allocate buffer of that many longwords. */
+ register PTRACE_XFER_TYPE *buffer
+ = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE));
+
+ if (write)
+ {
+ /* Fill start and end extra bytes of buffer with existing memory data. */
+
+ if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE)) {
+ /* Need part of initial word -- fetch it. */
+ buffer[0] = ptrace (PT_RTEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ 0);
+ }
+
+ if (count > 1) /* FIXME, avoid if even boundary */
+ {
+ buffer[count - 1]
+ = ptrace (PT_RTEXT, inferior_pid,
+ ((PTRACE_ARG3_TYPE)
+ (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))),
+ 0);
+ }
+
+ /* Copy data to be written over corresponding part of buffer */
+
+ memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
+ myaddr,
+ len);
+
+ /* Write the entire buffer. */
+
+ for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
+ {
+ errno = 0;
+ ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ buffer[i]);
+ if (errno)
+ {
+ /* Using the appropriate one (I or D) is necessary for
+ Gould NP1, at least. */
+ errno = 0;
+ ptrace (PT_WTEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ buffer[i]);
+ }
+ if (errno)
+ return 0;
+ }
+ }
+ else
+ {
+ /* Read all the longwords */
+ for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
+ {
+ errno = 0;
+ buffer[i] = ptrace (PT_RTEXT, inferior_pid,
+ (PTRACE_ARG3_TYPE) addr, 0);
+ if (errno)
+ return 0;
+ QUIT;
+ }
+
+ /* Copy appropriate bytes out of the buffer. */
+ memcpy (myaddr,
+ (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
+ len);
+ }
+ return len;
+}
+
+
+void
+_initialize_symm_nat ()
+{
+/*
+ * the MPDEBUGGER is necessary for process tree debugging and attach
+ * to work, but it alters the behavior of debugged processes, so other
+ * things (at least child_wait()) will have to change to accomodate
+ * that.
+ *
+ * Note that attach is not implemented in dynix 3, and not in ptx
+ * until version 2.1 of the OS.
+ */
+ int rv;
+ sigset_t set;
+ struct sigaction sact;
+
+ rv = mptrace(XPT_MPDEBUGGER, 0, 0, 0);
+ if (-1 == rv) {
+ fatal("_initialize_symm_nat(): mptrace(XPT_MPDEBUGGER): %s",
+ safe_strerror(errno));
+ }
+
+ /*
+ * Under MPDEBUGGER, we get SIGCLHD when a traced process does
+ * anything of interest.
+ */
+
+ /*
+ * Block SIGCHLD. We leave it blocked all the time, and then
+ * call sigsuspend() in child_wait() to wait for the child
+ * to do something. None of these ought to fail, but check anyway.
+ */
+ sigemptyset(&set);
+ rv = sigaddset(&set, SIGCHLD);
+ if (-1 == rv) {
+ fatal("_initialize_symm_nat(): sigaddset(SIGCHLD): %s",
+ safe_strerror(errno));
+ }
+ rv = sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
+ if (-1 == rv) {
+ fatal("_initialize_symm_nat(): sigprocmask(SIG_BLOCK): %s",
+ safe_strerror(errno));
+ }
+
+ sact.sa_handler = sigchld_handler;
+ sigemptyset(&sact.sa_mask);
+ sact.sa_flags = SA_NOCLDWAIT; /* keep the zombies away */
+ rv = sigaction(SIGCHLD, &sact, (struct sigaction *)NULL);
+ if (-1 == rv) {
+ fatal("_initialize_symm_nat(): sigaction(SIGCHLD): %s",
+ safe_strerror(errno));
+ }
+}
diff --git a/gdb/symm-tdep.c b/gdb/symm-tdep.c
index 37a7a9b..775e47c 100644
--- a/gdb/symm-tdep.c
+++ b/gdb/symm-tdep.c
@@ -1,5 +1,5 @@
-/* Sequent Symmetry target interface, for GDB when running under Unix.
- Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
+/* Sequent Symmetry target interface, for GDB.
+ Copyright (C) 1986, 1987, 1989, 1991, 1994 Free Software Foundation, Inc.
This file is part of GDB.
@@ -33,79 +33,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include <fcntl.h>
-static long i386_get_frame_setup ();
-static i386_follow_jump ();
-
-#include <sgtty.h>
-#define TERMINAL struct sgttyb
-
-/* rounds 'one' up to divide evenly by 'two' */
-
-int
-round(one,two)
-register int one, two;
-
-{
- register int temp;
- temp = (one/two)*two;
- if (one != temp) {
- temp += two;
- }
- return temp;
-}
-
-
-static CORE_ADDR codestream_next_addr;
-static CORE_ADDR codestream_addr;
-static unsigned char codestream_buf[sizeof (int)];
-static int codestream_off;
-static int codestream_cnt;
-
-#define codestream_tell() (codestream_addr + codestream_off)
-#define codestream_peek() (codestream_cnt == 0 ? \
- codestream_fill(1): codestream_buf[codestream_off])
-#define codestream_get() (codestream_cnt-- == 0 ? \
- codestream_fill(0) : codestream_buf[codestream_off++])
-
-
-static unsigned char
-codestream_fill (peek_flag)
-{
- codestream_addr = codestream_next_addr;
- codestream_next_addr += sizeof (int);
- codestream_off = 0;
- codestream_cnt = sizeof (int);
- read_memory (codestream_addr,
- (unsigned char *)codestream_buf,
- sizeof (int));
-
- if (peek_flag)
- return (codestream_peek());
- else
- return (codestream_get());
-}
-
-static void
-codestream_seek (place)
-{
- codestream_next_addr = place & -sizeof (int);
- codestream_cnt = 0;
- codestream_fill (1);
- while (codestream_tell() != place)
- codestream_get ();
-}
-
-static void
-codestream_read (buf, count)
- unsigned char *buf;
-{
- unsigned char *p;
- int i;
- p = buf;
- for (i = 0; i < count; i++)
- *p++ = codestream_get ();
-}
-
/*
* Following macro translates i386 opcode register numbers to Symmetry
* register numbers. This is used by FRAME_FIND_SAVED_REGS.
@@ -118,223 +45,6 @@ codestream_read (buf, count)
#define I386_REGNO_TO_SYMMETRY(n) \
((n)==0?0 :(n)==1?2 :(n)==2?1 :(n)==3?5 :(n)==4?14 :(n)==5?15 :(n))
-/* from i386-dep.c */
-i386_frame_find_saved_regs (fip, fsrp)
- struct frame_info *fip;
- struct frame_saved_regs *fsrp;
-{
- unsigned long locals;
- unsigned char *p;
- unsigned char op;
- CORE_ADDR dummy_bottom;
- CORE_ADDR adr;
- int i;
-
- memset (fsrp, 0, sizeof *fsrp);
-
- /* if frame is the end of a dummy, compute where the
- * beginning would be
- */
- dummy_bottom = fip->frame - 4 - NUM_REGS*4 - CALL_DUMMY_LENGTH;
-
- /* check if the PC is in the stack, in a dummy frame */
- if (dummy_bottom <= fip->pc && fip->pc <= fip->frame)
- {
- /* all regs were saved by push_call_dummy () */
- adr = fip->frame - 4;
- for (i = 0; i < NUM_REGS; i++)
- {
- fsrp->regs[i] = adr;
- adr -= 4;
- }
- return;
- }
-
- locals = i386_get_frame_setup (get_pc_function_start (fip->pc));
-
- if (locals >= 0)
- {
- adr = fip->frame - 4 - locals;
- for (i = 0; i < 8; i++)
- {
- op = codestream_get ();
- if (op < 0x50 || op > 0x57)
- break;
- fsrp->regs[I386_REGNO_TO_SYMMETRY(op - 0x50)] = adr;
- adr -= 4;
- }
- }
-
- fsrp->regs[PC_REGNUM] = fip->frame + 4;
- fsrp->regs[FP_REGNUM] = fip->frame;
-}
-
-static long
-i386_get_frame_setup (pc)
-{
- unsigned char op;
-
- codestream_seek (pc);
-
- i386_follow_jump ();
-
- op = codestream_get ();
-
- if (op == 0x58) /* popl %eax */
- {
- /*
- * this function must start with
- *
- * popl %eax 0x58
- * xchgl %eax, (%esp) 0x87 0x04 0x24
- * or xchgl %eax, 0(%esp) 0x87 0x44 0x24 0x00
- *
- * (the system 5 compiler puts out the second xchg
- * inst, and the assembler doesn't try to optimize it,
- * so the 'sib' form gets generated)
- *
- * this sequence is used to get the address of the return
- * buffer for a function that returns a structure
- */
- int pos;
- unsigned char buf[4];
- static unsigned char proto1[3] = { 0x87,0x04,0x24 };
- static unsigned char proto2[4] = { 0x87,0x44,0x24,0x00 };
- pos = codestream_tell ();
- codestream_read (buf, 4);
- if (memcmp (buf, proto1, 3) == 0)
- pos += 3;
- else if (memcmp (buf, proto2, 4) == 0)
- pos += 4;
-
- codestream_seek (pos);
- op = codestream_get (); /* update next opcode */
- }
-
- if (op == 0x55) /* pushl %esp */
- {
- if (codestream_get () != 0x8b) /* movl %esp, %ebp (2bytes) */
- return (-1);
- if (codestream_get () != 0xec)
- return (-1);
- /*
- * check for stack adjustment
- *
- * subl $XXX, %esp
- *
- * note: you can't subtract a 16 bit immediate
- * from a 32 bit reg, so we don't have to worry
- * about a data16 prefix
- */
- op = codestream_peek ();
- if (op == 0x83) /* subl with 8 bit immed */
- {
- codestream_get ();
- if (codestream_get () != 0xec)
- return (-1);
- /* subl with signed byte immediate
- * (though it wouldn't make sense to be negative)
- */
- return (codestream_get());
- }
- else if (op == 0x81) /* subl with 32 bit immed */
- {
- int locals;
- if (codestream_get () != 0xec)
- return (-1);
- /* subl with 32 bit immediate */
- codestream_read ((unsigned char *)&locals, 4);
- return (locals);
- }
- else
- {
- return (0);
- }
- }
- else if (op == 0xc8)
- {
- /* enter instruction: arg is 16 unsigned immed */
- unsigned short slocals;
- codestream_read ((unsigned char *)&slocals, 2);
- codestream_get (); /* flush final byte of enter instruction */
- return (slocals);
- }
- return (-1);
-}
-
-/* next instruction is a jump, move to target */
-static
-i386_follow_jump ()
-{
- int long_delta;
- short short_delta;
- char byte_delta;
- int data16;
- int pos;
-
- pos = codestream_tell ();
-
- data16 = 0;
- if (codestream_peek () == 0x66)
- {
- codestream_get ();
- data16 = 1;
- }
-
- switch (codestream_get ())
- {
- case 0xe9:
- /* relative jump: if data16 == 0, disp32, else disp16 */
- if (data16)
- {
- codestream_read ((unsigned char *)&short_delta, 2);
- pos += short_delta + 3; /* include size of jmp inst */
- }
- else
- {
- codestream_read ((unsigned char *)&long_delta, 4);
- pos += long_delta + 5;
- }
- break;
- case 0xeb:
- /* relative jump, disp8 (ignore data16) */
- codestream_read ((unsigned char *)&byte_delta, 1);
- pos += byte_delta + 2;
- break;
- }
- codestream_seek (pos + data16);
-}
-
-/* return pc of first real instruction */
-/* from i386-dep.c */
-
-i386_skip_prologue (pc)
-{
- unsigned char op;
- int i;
-
- if (i386_get_frame_setup (pc) < 0)
- return (pc);
-
- /* found valid frame setup - codestream now points to
- * start of push instructions for saving registers
- */
-
- /* skip over register saves */
- for (i = 0; i < 8; i++)
- {
- op = codestream_peek ();
- /* break if not pushl inst */
- if (op < 0x50 || op > 0x57)
- break;
- codestream_get ();
- }
-
- i386_follow_jump ();
-
- return (codestream_tell ());
-}
-
void
symmetry_extract_return_value(type, regbuf, valbuf)
struct type *type;
@@ -393,97 +103,3 @@ symmetry_extract_return_value(type, regbuf, valbuf)
memcpy (valbuf, regbuf, TYPE_LENGTH (type));
}
}
-
-#ifdef _SEQUENT_ /* ptx, not dynix */
-/*
- * Convert compiler register number to gdb internal
- * register number. The PTX C compiler only really
- * puts things in %edi, %esi and %ebx, but it can't hurt
- * to be complete here.
- */
-int
-ptx_coff_regno_to_gdb(regno)
- int regno;
-{
- return I386_REGNO_TO_SYMMETRY(regno);
-}
-
-/* For ptx, the value in blockend will be meaningless. This function
- merely returns the proper offset given the register number. This
- is much easier, because under ptx, the upage is set up with the
- user struct on "top", and the registers "beneath" it (and thus defines
- TRAD_CORE_USER_OFFSET in bfd). */
-
-/* The following table is for ptx 1.3. In theory it should not change with
- the OS version, but if it does we should (if possible) figure out a way
- to accept both the old and the new formats. */
-
-static unsigned int reg_offsets[NUM_REGS] = {
-/*
- * u.u_ar0 = 0xfffff8d0
- * VA_UBLOCK = 0xffffe000
- * VA_UAREA = 0xfffff8e8
- * struct user at ublock offset 0x18e8
- * registers at ublock offset 0x18d0
- */
-0x18d0, /* eax */
-0x18c8, /* eax */
-0x18cc, /* eax */
-0x1be0, /* st0 */
-0x1bea, /* st1 */
-0x18c4, /* ebx */
-0x18b8, /* esi */
-0x18b4, /* edi */
-0x1bf4, /* st2 */
-0x1bfe, /* st3 */
-0x1c08, /* st4 */
-0x1c12, /* st5 */
-0x1c1c, /* st6 */
-0x1c26, /* st7 */
-0x18e0, /* esp */
-0x18bc, /* ebp */
-0x18d4, /* eip */
-0x18dc, /* flags */
-0x1c38, /* fp1 */
-0x1c3c, /* fp2 */
-0x1c40, /* fp3 */
-0x1c44, /* fp4 */
-0x1c48, /* fp5 */
-0x1c4c, /* fp6 */
-0x1c50, /* fp7 */
-0x1c54, /* fp8 */
-0x1c58, /* fp9 */
-0x1c5c, /* fp10 */
-0x1c60, /* fp11 */
-0x1c64, /* fp12 */
-0x1c68, /* fp13 */
-0x1c6c, /* fp14 */
-0x1c70, /* fp15 */
-0x1c74, /* fp16 */
-0x1c78, /* fp17 */
-0x1c7c, /* fp18 */
-0x1c80, /* fp19 */
-0x1c84, /* fp20 */
-0x1c88, /* fp21 */
-0x1c8c, /* fp22 */
-0x1c90, /* fp23 */
-0x1c94, /* fp24 */
-0x1c98, /* fp25 */
-0x1c9c, /* fp26 */
-0x1ca0, /* fp27 */
-0x1ca4, /* fp28 */
-0x1ca8, /* fp29 */
-0x1cac, /* fp30 */
-0x1cb0, /* fp31 */
-};
-
-unsigned int
-register_addr (regno, blockend)
- int regno, blockend;
-{
- if ((regno < 0) || (regno >= NUM_REGS)) {
- error("Invalid register number %d.", regno);
- }
- return reg_offsets[regno];
-}
-#endif /* _SEQUENT_ */
diff --git a/gdb/target.h b/gdb/target.h
index 29f5131..1e9ea2a 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -579,7 +579,12 @@ pop_target PARAMS ((void));
struct section_table {
CORE_ADDR addr; /* Lowest address in section */
CORE_ADDR endaddr; /* 1+highest address in section */
- sec_ptr sec_ptr; /* BFD section pointer */
+
+ /* For the ptx compiler, we can't use the sec_ptr typedef when the field's
+ name is sec_ptr. We really should rename the field (or better yet,
+ the typedef should be bfd_sec_ptr). */
+ struct sec *sec_ptr; /* BFD section pointer */
+
bfd *bfd; /* BFD file pointer */
};
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 92e2614..785ec61 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -72,7 +72,7 @@ whatis_exp (exp, show)
int show;
{
struct expression *expr;
- register value val;
+ register value_ptr val;
register struct cleanup *old_chain = NULL;
if (exp)
@@ -249,7 +249,7 @@ maintenance_print_type (typename, from_tty)
char *typename;
int from_tty;
{
- register value val;
+ register value_ptr val;
register struct type *type;
register struct cleanup *old_chain;
struct expression *expr;
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 7826cf7..1d1fbc0 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -60,8 +60,8 @@ set_output_radix PARAMS ((char *, int, struct cmd_list_element *));
static void
set_output_radix_1 PARAMS ((int, unsigned));
-static void
-value_print_array_elements PARAMS ((value, GDB_FILE *, int, enum val_prettyprint));
+static void value_print_array_elements PARAMS ((value_ptr, GDB_FILE *, int,
+ enum val_prettyprint));
/* Maximum number of chars to print for a string pointer value or vector
contents, or UINT_MAX for no limit. Note that "set print elements 0"
@@ -158,7 +158,7 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty)
int
value_print (val, stream, format, pretty)
- value val;
+ value_ptr val;
GDB_FILE *stream;
int format;
enum val_prettyprint pretty;
@@ -650,7 +650,7 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
static void
value_print_array_elements (val, stream, format, pretty)
- value val;
+ value_ptr val;
GDB_FILE *stream;
int format;
enum val_prettyprint pretty;
diff --git a/gdb/value.h b/gdb/value.h
index 87ead1b..c71c960 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -109,7 +109,7 @@ struct value
};
-typedef struct value *value;
+typedef struct value *value_ptr;
#define VALUE_TYPE(val) (val)->type
#define VALUE_LAZY(val) (val)->lazy
@@ -123,8 +123,7 @@ typedef struct value *value;
#define VALUE_CONTENTS_RAW(val) ((char *) (val)->aligner.contents)
#define VALUE_CONTENTS(val) ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)),\
VALUE_CONTENTS_RAW(val))
-extern int
-value_fetch_lazy PARAMS ((value val));
+extern int value_fetch_lazy PARAMS ((value_ptr val));
#define VALUE_LVAL(val) (val)->lval
#define VALUE_ADDRESS(val) (val)->location.address
@@ -180,7 +179,7 @@ struct internalvar
{
struct internalvar *next;
char *name;
- value value;
+ value_ptr value;
};
/* Pointer to member function. Depends on compiler implementation. */
@@ -202,222 +201,198 @@ struct fn_field;
extern void
print_address_demangle PARAMS ((CORE_ADDR, GDB_FILE *, int));
-extern LONGEST
-value_as_long PARAMS ((value val));
+extern LONGEST value_as_long PARAMS ((value_ptr val));
-extern double
-value_as_double PARAMS ((value val));
+extern double value_as_double PARAMS ((value_ptr val));
-extern CORE_ADDR
-value_as_pointer PARAMS ((value val));
+extern CORE_ADDR value_as_pointer PARAMS ((value_ptr val));
-extern LONGEST
-unpack_long PARAMS ((struct type *type, char *valaddr));
+extern LONGEST unpack_long PARAMS ((struct type *type, char *valaddr));
-extern double
-unpack_double PARAMS ((struct type *type, char *valaddr, int *invp));
+extern double unpack_double PARAMS ((struct type *type, char *valaddr,
+ int *invp));
extern CORE_ADDR unpack_pointer PARAMS ((struct type *type, char *valaddr));
extern LONGEST unpack_field_as_long PARAMS ((struct type *type, char *valaddr,
int fieldno));
-extern value value_from_longest PARAMS ((struct type *type, LONGEST num));
+extern value_ptr value_from_longest PARAMS ((struct type *type, LONGEST num));
-extern value value_from_double PARAMS ((struct type *type, double num));
+extern value_ptr value_from_double PARAMS ((struct type *type, double num));
-extern value value_at PARAMS ((struct type *type, CORE_ADDR addr));
+extern value_ptr value_at PARAMS ((struct type *type, CORE_ADDR addr));
-extern value value_at_lazy PARAMS ((struct type *type, CORE_ADDR addr));
+extern value_ptr value_at_lazy PARAMS ((struct type *type, CORE_ADDR addr));
/* FIXME: Assumes equivalence of "struct frame_info *" and "FRAME" */
-extern value value_from_register PARAMS ((struct type *type, int regnum,
+extern value_ptr value_from_register PARAMS ((struct type *type, int regnum,
struct frame_info * frame));
-extern value value_of_variable PARAMS ((struct symbol *var, struct block *b));
+extern value_ptr value_of_variable PARAMS ((struct symbol *var,
+ struct block *b));
-extern value value_of_register PARAMS ((int regnum));
+extern value_ptr value_of_register PARAMS ((int regnum));
extern int symbol_read_needs_frame PARAMS ((struct symbol *));
/* FIXME: Assumes equivalence of "struct frame_info *" and "FRAME" */
-extern value read_var_value PARAMS ((struct symbol *var,
- struct frame_info *frame));
+extern value_ptr read_var_value PARAMS ((struct symbol *var,
+ struct frame_info *frame));
/* FIXME: Assumes equivalence of "struct frame_info *" and "FRAME" */
-extern value locate_var_value PARAMS ((struct symbol *var,
+extern value_ptr locate_var_value PARAMS ((struct symbol *var,
struct frame_info *frame));
-extern value allocate_value PARAMS ((struct type *type));
+extern value_ptr allocate_value PARAMS ((struct type *type));
-extern value allocate_repeat_value PARAMS ((struct type *type, int count));
+extern value_ptr allocate_repeat_value PARAMS ((struct type *type, int count));
-extern value value_mark PARAMS ((void));
+extern value_ptr value_mark PARAMS ((void));
-extern void value_free_to_mark PARAMS ((value mark));
+extern void value_free_to_mark PARAMS ((value_ptr mark));
-extern value value_string PARAMS ((char *ptr, int len));
+extern value_ptr value_string PARAMS ((char *ptr, int len));
-extern value value_array PARAMS ((int lowbound, int highbound,
- value *elemvec));
+extern value_ptr value_array PARAMS ((int lowbound, int highbound,
+ value_ptr *elemvec));
-extern value value_concat PARAMS ((value arg1, value arg2));
+extern value_ptr value_concat PARAMS ((value_ptr arg1, value_ptr arg2));
-extern value value_binop PARAMS ((value arg1, value arg2, enum exp_opcode op));
+extern value_ptr value_binop PARAMS ((value_ptr arg1, value_ptr arg2,
+ enum exp_opcode op));
-extern value value_add PARAMS ((value arg1, value arg2));
+extern value_ptr value_add PARAMS ((value_ptr arg1, value_ptr arg2));
-extern value value_sub PARAMS ((value arg1, value arg2));
+extern value_ptr value_sub PARAMS ((value_ptr arg1, value_ptr arg2));
-extern value value_coerce_array PARAMS ((value arg1));
+extern value_ptr value_coerce_array PARAMS ((value_ptr arg1));
-extern value value_coerce_function PARAMS ((value arg1));
+extern value_ptr value_coerce_function PARAMS ((value_ptr arg1));
-extern value value_ind PARAMS ((value arg1));
+extern value_ptr value_ind PARAMS ((value_ptr arg1));
-extern value value_addr PARAMS ((value arg1));
+extern value_ptr value_addr PARAMS ((value_ptr arg1));
-extern value value_assign PARAMS ((value toval, value fromval));
+extern value_ptr value_assign PARAMS ((value_ptr toval, value_ptr fromval));
-extern value value_neg PARAMS ((value arg1));
+extern value_ptr value_neg PARAMS ((value_ptr arg1));
-extern value value_complement PARAMS ((value arg1));
+extern value_ptr value_complement PARAMS ((value_ptr arg1));
-extern value value_struct_elt PARAMS ((value *argp, value *args, char *name,
- int *static_memfuncp, char *err));
+extern value_ptr value_struct_elt PARAMS ((value_ptr *argp, value *args,
+ char *name,
+ int *static_memfuncp, char *err));
-extern value value_struct_elt_for_reference PARAMS ((struct type *domain,
- int offset,
- struct type *curtype,
- char *name,
- struct type *intype));
+extern value_ptr value_struct_elt_for_reference PARAMS ((struct type *domain,
+ int offset,
+ struct type *curtype,
+ char *name,
+ struct type *intype));
-extern value value_field PARAMS ((value arg1, int fieldno));
+extern value_ptr value_field PARAMS ((value_ptr arg1, int fieldno));
-extern value value_primitive_field PARAMS ((value arg1, int offset,
- int fieldno,
- struct type *arg_type));
+extern value_ptr value_primitive_field PARAMS ((value_ptr arg1, int offset,
+ int fieldno,
+ struct type *arg_type));
-extern value value_cast PARAMS ((struct type *type, value arg2));
+extern value_ptr value_cast PARAMS ((struct type *type, value_ptr arg2));
-extern value value_zero PARAMS ((struct type *type, enum lval_type lv));
+extern value_ptr value_zero PARAMS ((struct type *type, enum lval_type lv));
-extern value value_repeat PARAMS ((value arg1, int count));
+extern value_ptr value_repeat PARAMS ((value_ptr arg1, int count));
-extern value value_subscript PARAMS ((value array, value idx));
+extern value_ptr value_subscript PARAMS ((value_ptr array, value_ptr idx));
-extern value value_from_vtable_info PARAMS ((value arg, struct type *type));
+extern value_ptr value_from_vtable_info PARAMS ((value_ptr arg,
+ struct type *type));
-extern value value_being_returned PARAMS ((struct type *valtype,
- char retbuf[REGISTER_BYTES],
- int struct_return));
+extern value_ptr value_being_returned PARAMS ((struct type *valtype,
+ char retbuf[REGISTER_BYTES],
+ int struct_return));
-extern value value_in PARAMS ((value element, value set));
+extern value_ptr value_in PARAMS ((value_ptr element, value_ptr set));
extern int value_bit_index PARAMS ((struct type *type, char *addr, int index));
-extern int
-using_struct_return PARAMS ((value function, CORE_ADDR funcaddr,
- struct type *value_type, int gcc_p));
+extern int using_struct_return PARAMS ((value_ptr function, CORE_ADDR funcaddr,
+ struct type *value_type, int gcc_p));
-extern void
-set_return_value PARAMS ((value val));
+extern void set_return_value PARAMS ((value_ptr val));
-extern value
-evaluate_expression PARAMS ((struct expression *exp));
+extern value_ptr evaluate_expression PARAMS ((struct expression *exp));
-extern value
-evaluate_type PARAMS ((struct expression *exp));
+extern value_ptr evaluate_type PARAMS ((struct expression *exp));
-extern value
-parse_and_eval PARAMS ((char *exp));
+extern value_ptr parse_and_eval PARAMS ((char *exp));
-extern value
-parse_to_comma_and_eval PARAMS ((char **expp));
+extern value_ptr parse_to_comma_and_eval PARAMS ((char **expp));
-extern struct type *
-parse_and_eval_type PARAMS ((char *p, int length));
+extern struct type *parse_and_eval_type PARAMS ((char *p, int length));
-extern CORE_ADDR
-parse_and_eval_address PARAMS ((char *exp));
+extern CORE_ADDR parse_and_eval_address PARAMS ((char *exp));
-extern CORE_ADDR
-parse_and_eval_address_1 PARAMS ((char **expptr));
+extern CORE_ADDR parse_and_eval_address_1 PARAMS ((char **expptr));
-extern value
-access_value_history PARAMS ((int num));
+extern value_ptr access_value_history PARAMS ((int num));
-extern value
-value_of_internalvar PARAMS ((struct internalvar *var));
+extern value_ptr value_of_internalvar PARAMS ((struct internalvar *var));
-extern void
-set_internalvar PARAMS ((struct internalvar *var, value val));
+extern void set_internalvar PARAMS ((struct internalvar *var, value_ptr val));
-extern void
-set_internalvar_component PARAMS ((struct internalvar *var, int offset,
- int bitpos, int bitsize,
- value newvalue));
+extern void set_internalvar_component PARAMS ((struct internalvar *var,
+ int offset,
+ int bitpos, int bitsize,
+ value_ptr newvalue));
-extern struct internalvar *
-lookup_internalvar PARAMS ((char *name));
+extern struct internalvar *lookup_internalvar PARAMS ((char *name));
-extern int
-value_equal PARAMS ((value arg1, value arg2));
+extern int value_equal PARAMS ((value_ptr arg1, value_ptr arg2));
-extern int
-value_less PARAMS ((value arg1, value arg2));
+extern int value_less PARAMS ((value_ptr arg1, value_ptr arg2));
-extern int
-value_logical_not PARAMS ((value arg1));
+extern int value_logical_not PARAMS ((value_ptr arg1));
/* C++ */
-extern value
-value_of_this PARAMS ((int complain));
+extern value_ptr value_of_this PARAMS ((int complain));
-extern value
-value_x_binop PARAMS ((value arg1, value arg2, enum exp_opcode op,
- enum exp_opcode otherop));
+extern value_ptr value_x_binop PARAMS ((value_ptr arg1, value_ptr arg2,
+ enum exp_opcode op,
+ enum exp_opcode otherop));
-extern value
-value_x_unop PARAMS ((value arg1, enum exp_opcode op));
+extern value_ptr value_x_unop PARAMS ((value_ptr arg1, enum exp_opcode op));
-extern value
-value_fn_field PARAMS ((value *arg1p, struct fn_field *f, int j,
- struct type* type, int offset));
+extern value_ptr value_fn_field PARAMS ((value_ptr *arg1p, struct fn_field *f,
+ int j,
+ struct type* type, int offset));
-extern value
-value_virtual_fn_field PARAMS ((value *arg1p, struct fn_field *f, int j,
- struct type *type, int offset));
+extern value_ptr value_virtual_fn_field PARAMS ((value_ptr *arg1p,
+ struct fn_field *f, int j,
+ struct type *type,
+ int offset));
-extern int
-binop_user_defined_p PARAMS ((enum exp_opcode op, value arg1, value arg2));
+extern int binop_user_defined_p PARAMS ((enum exp_opcode op,
+ value_ptr arg1, value_ptr arg2));
-extern int
-unop_user_defined_p PARAMS ((enum exp_opcode op, value arg1));
+extern int unop_user_defined_p PARAMS ((enum exp_opcode op, value_ptr arg1));
-extern int
-destructor_name_p PARAMS ((const char *name, const struct type *type));
+extern int destructor_name_p PARAMS ((const char *name,
+ const struct type *type));
#define value_free(val) free ((PTR)val)
-extern void
-free_all_values PARAMS ((void));
+extern void free_all_values PARAMS ((void));
-extern void
-release_value PARAMS ((value val));
+extern void release_value PARAMS ((value_ptr val));
-extern int
-record_latest_value PARAMS ((value val));
+extern int record_latest_value PARAMS ((value_ptr val));
-extern void
-registers_changed PARAMS ((void));
+extern void registers_changed PARAMS ((void));
-extern void
-read_register_bytes PARAMS ((int regbyte, char *myaddr, int len));
+extern void read_register_bytes PARAMS ((int regbyte, char *myaddr, int len));
-extern void
-write_register_bytes PARAMS ((int regbyte, char *myaddr, int len));
+extern void write_register_bytes PARAMS ((int regbyte, char *myaddr, int len));
extern void
read_register_gen PARAMS ((int regno, char *myaddr));
@@ -444,9 +419,9 @@ extern void
type_print PARAMS ((struct type *type, char *varstring, GDB_FILE *stream,
int show));
-extern char *
-baseclass_addr PARAMS ((struct type *type, int index, char *valaddr,
- value *valuep, int *errp));
+extern char *baseclass_addr PARAMS ((struct type *type, int index,
+ char *valaddr,
+ value_ptr *valuep, int *errp));
extern void
print_longest PARAMS ((GDB_FILE *stream, int format, int use_local,
@@ -455,9 +430,8 @@ print_longest PARAMS ((GDB_FILE *stream, int format, int use_local,
extern void
print_floating PARAMS ((char *valaddr, struct type *type, GDB_FILE *stream));
-extern int
-value_print PARAMS ((value val, GDB_FILE *stream, int format,
- enum val_prettyprint pretty));
+extern int value_print PARAMS ((value_ptr val, GDB_FILE *stream, int format,
+ enum val_prettyprint pretty));
extern int
val_print PARAMS ((struct type *type, char *valaddr, CORE_ADDR address,
@@ -472,11 +446,9 @@ extern void
print_variable_value PARAMS ((struct symbol *var, struct frame_info *frame,
GDB_FILE *stream));
-extern value
-value_arg_coerce PARAMS ((value));
+extern value_ptr value_arg_coerce PARAMS ((value_ptr));
-extern int
-check_field PARAMS ((value, const char *));
+extern int check_field PARAMS ((value_ptr, const char *));
extern void
c_typedef_print PARAMS ((struct type *type, struct symbol *new, GDB_FILE *stream));
@@ -492,15 +464,12 @@ clear_internalvars PARAMS ((void));
/* From values.c */
-extern value
-value_copy PARAMS ((value));
+extern value_ptr value_copy PARAMS ((value_ptr));
-extern int
-baseclass_offset PARAMS ((struct type *, int, value, int));
+extern int baseclass_offset PARAMS ((struct type *, int, value_ptr, int));
/* From valops.c */
-extern value
-call_function_by_hand PARAMS ((value, int, value *));
+extern value_ptr call_function_by_hand PARAMS ((value_ptr, int, value_ptr *));
#endif /* !defined (VALUE_H) */
diff --git a/gdb/values.c b/gdb/values.c
index 34ea2d1..bdabfb5 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -31,14 +31,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Local function prototypes. */
-static value
-value_headof PARAMS ((value, struct type *, struct type *));
+static value_ptr value_headof PARAMS ((value, struct type *, struct type *));
-static void
-show_values PARAMS ((char *, int));
+static void show_values PARAMS ((char *, int));
-static void
-show_convenience PARAMS ((char *, int));
+static void show_convenience PARAMS ((char *, int));
/* The value-history records all the values printed
by print commands during this session. Each chunk
@@ -51,7 +48,7 @@ show_convenience PARAMS ((char *, int));
struct value_history_chunk
{
struct value_history_chunk *next;
- value values[VALUE_HISTORY_CHUNK];
+ value_ptr values[VALUE_HISTORY_CHUNK];
};
/* Chain of chunks now in use. */
@@ -64,19 +61,19 @@ static int value_history_count; /* Abs number of last entry stored */
(except for those released by calls to release_value)
This is so they can be freed after each command. */
-static value all_values;
+static value_ptr all_values;
/* Allocate a value that has the correct length for type TYPE. */
-value
+value_ptr
allocate_value (type)
struct type *type;
{
- register value val;
+ register value_ptr val;
check_stub_type (type);
- val = (value) xmalloc (sizeof (struct value) + TYPE_LENGTH (type));
+ val = (struct value *) xmalloc (sizeof (struct value) + TYPE_LENGTH (type));
VALUE_NEXT (val) = all_values;
all_values = val;
VALUE_TYPE (val) = type;
@@ -98,14 +95,15 @@ allocate_value (type)
/* Allocate a value that has the correct length
for COUNT repetitions type TYPE. */
-value
+value_ptr
allocate_repeat_value (type, count)
struct type *type;
int count;
{
- register value val;
+ register value_ptr val;
- val = (value) xmalloc (sizeof (struct value) + TYPE_LENGTH (type) * count);
+ val =
+ (value_ptr) xmalloc (sizeof (struct value) + TYPE_LENGTH (type) * count);
VALUE_NEXT (val) = all_values;
all_values = val;
VALUE_TYPE (val) = type;
@@ -126,7 +124,7 @@ allocate_repeat_value (type, count)
/* Return a mark in the value chain. All values allocated after the
mark is obtained (except for those released) are subject to being freed
if a subsequent value_free_to_mark is passed the mark. */
-value
+value_ptr
value_mark ()
{
return all_values;
@@ -136,9 +134,9 @@ value_mark ()
(except for those released). */
void
value_free_to_mark (mark)
- value mark;
+ value_ptr mark;
{
- value val, next;
+ value_ptr val, next;
for (val = all_values; val && val != mark; val = next)
{
@@ -154,7 +152,7 @@ value_free_to_mark (mark)
void
free_all_values ()
{
- register value val, next;
+ register value_ptr val, next;
for (val = all_values; val; val = next)
{
@@ -170,9 +168,9 @@ free_all_values ()
void
release_value (val)
- register value val;
+ register value_ptr val;
{
- register value v;
+ register value_ptr v;
if (all_values == val)
{
@@ -194,11 +192,11 @@ release_value (val)
It contains the same contents, for same memory address,
but it's a different block of storage. */
-value
+value_ptr
value_copy (arg)
- value arg;
+ value_ptr arg;
{
- register value val;
+ register value_ptr val;
register struct type *type = VALUE_TYPE (arg);
if (VALUE_REPEATED (arg))
val = allocate_repeat_value (type, VALUE_REPETITIONS (arg));
@@ -230,7 +228,7 @@ value_copy (arg)
int
record_latest_value (val)
- value val;
+ value_ptr val;
{
int i;
@@ -278,7 +276,7 @@ record_latest_value (val)
/* Return a copy of the value in the history with sequence number NUM. */
-value
+value_ptr
access_value_history (num)
int num;
{
@@ -322,7 +320,7 @@ clear_value_history ()
{
register struct value_history_chunk *next;
register int i;
- register value val;
+ register value_ptr val;
while (value_history_chain)
{
@@ -342,7 +340,7 @@ show_values (num_exp, from_tty)
int from_tty;
{
register int i;
- register value val;
+ register value_ptr val;
static int num = 1;
if (num_exp)
@@ -414,11 +412,11 @@ lookup_internalvar (name)
return var;
}
-value
+value_ptr
value_of_internalvar (var)
struct internalvar *var;
{
- register value val;
+ register value_ptr val;
#ifdef IS_TRAPPED_INTERNALVAR
if (IS_TRAPPED_INTERNALVAR (var->name))
@@ -437,7 +435,7 @@ void
set_internalvar_component (var, offset, bitpos, bitsize, newval)
struct internalvar *var;
int offset, bitpos, bitsize;
- value newval;
+ value_ptr newval;
{
register char *addr = VALUE_CONTENTS (var->value) + offset;
@@ -456,7 +454,7 @@ set_internalvar_component (var, offset, bitpos, bitsize, newval)
void
set_internalvar (var, val)
struct internalvar *var;
- value val;
+ value_ptr val;
{
#ifdef IS_TRAPPED_INTERNALVAR
if (IS_TRAPPED_INTERNALVAR (var->name))
@@ -533,7 +531,7 @@ use \"set\" as in \"set $foo = 5\" to define them.\n");
LONGEST
value_as_long (val)
- register value val;
+ register value_ptr val;
{
/* This coerces arrays and functions, which is necessary (e.g.
in disassemble_command). It also dereferences references, which
@@ -545,7 +543,7 @@ value_as_long (val)
double
value_as_double (val)
- register value val;
+ register value_ptr val;
{
double foo;
int inv;
@@ -559,7 +557,7 @@ value_as_double (val)
Does not deallocate the value. */
CORE_ADDR
value_as_pointer (val)
- value val;
+ value_ptr val;
{
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
@@ -696,14 +694,14 @@ unpack_pointer (type, valaddr)
For C++, must also be able to return values from static fields */
-value
+value_ptr
value_primitive_field (arg1, offset, fieldno, arg_type)
- register value arg1;
+ register value_ptr arg1;
int offset;
register int fieldno;
register struct type *arg_type;
{
- register value v;
+ register value_ptr v;
register struct type *type;
check_stub_type (arg_type);
@@ -744,9 +742,9 @@ value_primitive_field (arg1, offset, fieldno, arg_type)
For C++, must also be able to return values from static fields */
-value
+value_ptr
value_field (arg1, fieldno)
- register value arg1;
+ register value_ptr arg1;
register int fieldno;
{
return value_primitive_field (arg1, 0, fieldno, VALUE_TYPE (arg1));
@@ -756,22 +754,22 @@ value_field (arg1, fieldno)
F is the list of member functions which contains the desired method.
J is an index into F which provides the desired method. */
-value
+value_ptr
value_fn_field (arg1p, f, j, type, offset)
- value *arg1p;
+ value_ptr *arg1p;
struct fn_field *f;
int j;
struct type *type;
int offset;
{
- register value v;
+ register value_ptr v;
register struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
struct symbol *sym;
sym = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
0, VAR_NAMESPACE, 0, NULL);
if (! sym)
- return (value)NULL;
+ return NULL;
/*
error ("Internal error: could not find physical method named %s",
TYPE_FN_FIELD_PHYSNAME (f, j));
@@ -803,22 +801,22 @@ value_fn_field (arg1p, f, j, type, offset)
J is an index into F which provides the desired virtual function.
TYPE is the type in which F is located. */
-value
+value_ptr
value_virtual_fn_field (arg1p, f, j, type, offset)
- value *arg1p;
+ value_ptr *arg1p;
struct fn_field *f;
int j;
struct type *type;
int offset;
{
- value arg1 = *arg1p;
+ value_ptr arg1 = *arg1p;
/* First, get the virtual function table pointer. That comes
with a strange type, so cast it to type `pointer to long' (which
should serve just fine as a function type). Then, index into
the table, and convert final value to appropriate function type. */
- value entry, vfn, vtbl;
- value vi = value_from_longest (builtin_type_int,
- (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
+ value_ptr entry, vfn, vtbl;
+ value_ptr vi = value_from_longest (builtin_type_int,
+ (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j);
struct type *context;
if (fcontext == NULL)
@@ -879,14 +877,14 @@ value_virtual_fn_field (arg1p, f, j, type, offset)
FIXME-tiemann: should work with dossier entries as well. */
-static value
+static value_ptr
value_headof (in_arg, btype, dtype)
- value in_arg;
+ value_ptr in_arg;
struct type *btype, *dtype;
{
/* First collect the vtables we must look at for this object. */
/* FIXME-tiemann: right now, just look at top-most vtable. */
- value arg, vtbl, entry, best_entry = 0;
+ value_ptr arg, vtbl, entry, best_entry = 0;
int i, nelems;
int offset, best_offset = 0;
struct symbol *sym;
@@ -968,9 +966,9 @@ value_headof (in_arg, btype, dtype)
of its baseclasses) to figure out the most derived type that ARG
could actually be a pointer to. */
-value
+value_ptr
value_from_vtable_info (arg, type)
- value arg;
+ value_ptr arg;
struct type *type;
{
/* Take care of preliminaries. */
@@ -1043,7 +1041,7 @@ int
baseclass_offset (type, index, arg, offset)
struct type *type;
int index;
- value arg;
+ value_ptr arg;
int offset;
{
struct type *basetype = TYPE_BASECLASS (type, index);
@@ -1105,7 +1103,7 @@ baseclass_addr (type, index, valaddr, valuep, errp)
struct type *type;
int index;
char *valaddr;
- value *valuep;
+ value_ptr *valuep;
int *errp;
{
struct type *basetype = TYPE_BASECLASS (type, index);
@@ -1125,7 +1123,7 @@ baseclass_addr (type, index, valaddr, valuep, errp)
{
if (vb_match (type, i, basetype))
{
- value val = allocate_value (basetype);
+ value_ptr val = allocate_value (basetype);
CORE_ADDR addr;
int status;
@@ -1275,12 +1273,12 @@ modify_field (addr, fieldval, bitpos, bitsize)
/* Convert C numbers into newly allocated values */
-value
+value_ptr
value_from_longest (type, num)
struct type *type;
register LONGEST num;
{
- register value val = allocate_value (type);
+ register value_ptr val = allocate_value (type);
register enum type_code code = TYPE_CODE (type);
register int len = TYPE_LENGTH (type);
@@ -1306,12 +1304,12 @@ value_from_longest (type, num)
return val;
}
-value
+value_ptr
value_from_double (type, num)
struct type *type;
double num;
{
- register value val = allocate_value (type);
+ register value_ptr val = allocate_value (type);
register enum type_code code = TYPE_CODE (type);
register int len = TYPE_LENGTH (type);
@@ -1339,14 +1337,14 @@ value_from_double (type, num)
0 when it is using the value returning conventions (this often
means returning pointer to where structure is vs. returning value). */
-value
+value_ptr
value_being_returned (valtype, retbuf, struct_return)
register struct type *valtype;
char retbuf[REGISTER_BYTES];
int struct_return;
/*ARGSUSED*/
{
- register value val;
+ register value_ptr val;
CORE_ADDR addr;
#if defined (EXTRACT_STRUCT_VALUE_ADDRESS)
@@ -1398,7 +1396,7 @@ value_being_returned (valtype, retbuf, struct_return)
int
using_struct_return (function, funcaddr, value_type, gcc_p)
- value function;
+ value_ptr function;
CORE_ADDR funcaddr;
struct type *value_type;
int gcc_p;
@@ -1423,7 +1421,7 @@ using_struct_return (function, funcaddr, value_type, gcc_p)
void
set_return_value (val)
- value val;
+ value_ptr val;
{
register enum type_code code = TYPE_CODE (VALUE_TYPE (val));
double dbuf;