From e6cbd02ac2c4dd07c92d152b10c03c7bb24aec2b Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Tue, 6 Feb 2001 20:05:42 +0000 Subject: [PATCH] 2001-02-06 Michael Snyder Submitted by Paul Hilfinger (hilfingr@gnat.com) and Andrei Petrov (and@genesyslab.com). * findvar.c: Buffers of size MAX_REGISTER_RAW_SIZE or REGISTER_BYTES must be allocated dynamically, since these are no longer constants. * infcmd.c: Ditto. * regcache.c: Ditto. * remote.c: Ditto. * sol-thread.c: Ditto. * valops.c: Ditto. * config/sparc/sun4sol2.mh (MH_CFLAGS): Add -I/usr/include/v9, as a work-around for a missing Sun header file in solaris for sparc64. --- gdb/ChangeLog | 13 +++++++++++++ gdb/config/sparc/sun4sol2.mh | 5 ++++- gdb/findvar.c | 8 ++++---- gdb/infcmd.c | 4 ++-- gdb/regcache.c | 2 +- gdb/remote.c | 4 ++-- gdb/sol-thread.c | 2 +- gdb/valops.c | 6 +++--- 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 70beb845f1f..168b63a6afb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2001-02-06 Michael Snyder + Submitted by Paul Hilfinger (hilfingr@gnat.com) + and Andrei Petrov (and@genesyslab.com). + * findvar.c: Buffers of size MAX_REGISTER_RAW_SIZE or REGISTER_BYTES + must be allocated dynamically, since these are no longer constants. + * infcmd.c: Ditto. + * regcache.c: Ditto. + * remote.c: Ditto. + * sol-thread.c: Ditto. + * valops.c: Ditto. + * config/sparc/sun4sol2.mh (MH_CFLAGS): Add -I/usr/include/v9, as a + work-around for a missing Sun header file in solaris for sparc64. + 2001-02-04 Philip Blundell * config/arm/linux.mh (NATDEPFILES): Add proc-service.o, diff --git a/gdb/config/sparc/sun4sol2.mh b/gdb/config/sparc/sun4sol2.mh index 4ab69c514eb..9d246979921 100644 --- a/gdb/config/sparc/sun4sol2.mh +++ b/gdb/config/sparc/sun4sol2.mh @@ -8,6 +8,9 @@ NAT_FILE= nm-sun4sol2.h NATDEPFILES= corelow.o core-sol2.o solib.o solib-svr4.o fork-child.o procfs.o \ proc-api.o proc-events.o proc-flags.o proc-why.o +# /usr/include/v9 is needed only by core-sol2.c when including +# v9/sys/privregs.h, or rather the headers it in turn includes. +MH_CFLAGS=-I/usr/include/v9 # If you are compiling with Sun's compiler, add the -xs option to CC # (e.g. `make CC="cc -xs"'). # Sun's compilers require the -xs option to produce debug information @@ -15,5 +18,5 @@ NATDEPFILES= corelow.o core-sol2.o solib.o solib-svr4.o fork-child.o procfs.o \ # files only, with undocumented pointers to it in the linked executable. # This is commented out because we don't assume that the Sun compiler # is in use. -#MH_CFLAGS=-xs +#MH_CFLAGS=-xs -I/usr/include/v9 HOST_IPC=-DBSD_IPC diff --git a/gdb/findvar.c b/gdb/findvar.c index 002f3f32843..ea6cccf0255 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -393,7 +393,7 @@ value_of_register (int regnum) CORE_ADDR addr; int optim; register value_ptr reg_val; - char raw_buffer[MAX_REGISTER_RAW_SIZE]; + char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); enum lval_type lval; get_saved_register (raw_buffer, &optim, &addr, @@ -606,7 +606,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i case LOC_BASEREG: case LOC_BASEREG_ARG: { - char buf[MAX_REGISTER_RAW_SIZE]; + char *buf = (char*) alloca (MAX_REGISTER_RAW_SIZE); get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var), NULL); addr = extract_address (buf, REGISTER_RAW_SIZE (SYMBOL_BASEREG (var))); @@ -616,7 +616,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i case LOC_THREAD_LOCAL_STATIC: { - char buf[MAX_REGISTER_RAW_SIZE]; + char *buf = (char*) alloca (MAX_REGISTER_RAW_SIZE); get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var), NULL); @@ -711,7 +711,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i value_ptr value_from_register (struct type *type, int regnum, struct frame_info *frame) { - char raw_buffer[MAX_REGISTER_RAW_SIZE]; + char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); CORE_ADDR addr; int optim; value_ptr v = allocate_value (type); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 6f43eba65a6..6eb3d83a387 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1467,8 +1467,8 @@ do_registers_info (int regnum, int fpregs) for (i = 0; i < numregs; i++) { - char raw_buffer[MAX_REGISTER_RAW_SIZE]; - char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE]; + char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); + char *virtual_buffer = (char*) alloca (MAX_REGISTER_VIRTUAL_SIZE); /* Decide between printing all regs, nonfloat regs, or specific reg. */ if (regnum == -1) diff --git a/gdb/regcache.c b/gdb/regcache.c index 6e5a2c19580..db963f769dc 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -558,7 +558,7 @@ write_register_bytes (int myregstart, char *myaddr, int inlen) /* The register partially overlaps the range being written. */ else { - char regbuf[MAX_REGISTER_RAW_SIZE]; + char *regbuf = (char*) alloca (MAX_REGISTER_RAW_SIZE); /* What's the overlap between this register's bytes and those the caller wants to write? */ int overlapstart = max (regstart, myregstart); diff --git a/gdb/remote.c b/gdb/remote.c index 2a000363937..b79634d3260 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2604,7 +2604,7 @@ remote_wait (int pid, struct target_waitstatus *status) { int i; long regno; - char regs[MAX_REGISTER_RAW_SIZE]; + char* regs = (char*) alloca (MAX_REGISTER_RAW_SIZE); /* Expedited reply, containing Signal, {regno, reg} repeat */ /* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where @@ -2825,7 +2825,7 @@ remote_async_wait (int pid, struct target_waitstatus *status) { int i; long regno; - char regs[MAX_REGISTER_RAW_SIZE]; + char* regs = (char*) alloca (MAX_REGISTER_RAW_SIZE); /* Expedited reply, containing Signal, {regno, reg} repeat */ /* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index d4325a071f4..f7727b483d8 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -685,7 +685,7 @@ sol_thread_store_registers (int regno) if (regno != -1) { /* Not writing all the regs */ /* save new register value */ - char old_value[REGISTER_SIZE]; + char* old_value = (char*) alloca (REGISTER_SIZE); memcpy (old_value, ®isters[REGISTER_BYTE (regno)], REGISTER_SIZE); val = p_td_thr_getgregs (&thandle, gregset); diff --git a/gdb/valops.c b/gdb/valops.c index 9a90e3d749a..ce15c2007eb 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -570,7 +570,7 @@ value_assign (register value_ptr toval, register value_ptr fromval) { register struct type *type; register value_ptr val; - char raw_buffer[MAX_REGISTER_RAW_SIZE]; + char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); int use_buffer = 0; if (!toval->modifiable) @@ -1027,7 +1027,7 @@ CORE_ADDR push_word (CORE_ADDR sp, ULONGEST word) { register int len = REGISTER_SIZE; - char buffer[MAX_REGISTER_RAW_SIZE]; + char *buffer = alloca (MAX_REGISTER_RAW_SIZE); store_unsigned_integer (buffer, len, word); if (INNER_THAN (1, 2)) @@ -1665,7 +1665,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name); SAVE_DUMMY_FRAME_TOS (sp); { - char retbuf[REGISTER_BYTES]; + char *retbuf = (char*) alloca (REGISTER_BYTES); char *name; struct symbol *symbol; -- 2.30.2