This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: Patch to allow compilation by Sun cc
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Subject: Re: RFC: Patch to allow compilation by Sun cc
- From: Michael Snyder <msnyder at cygnus dot com>
- Date: Thu, 01 Feb 2001 17:02:56 -0800
- CC: Hilfinger at cs dot berkeley dot edu, gdb-patches at sourceware dot cygnus dot com
- Organization: Red Hat
- References: <200102011905.LAA21374@tully.CS.Berkeley.EDU> <3A79B50E.6F40844E@cygnus.com>
Andrew Cagney wrote:
>
> Paul Hilfinger wrote:
> >
> > OK, this was annoying:
> >
> > 1. That particular parameter is actually an enum target_signal, and
> > some calls of this macro supply that.
> > 2. So I ought to declare it as enum target_signal in the header file,
> > BUT
> > 3. We apparently can't count on enum target_signal being defined when
> > the header is included.
>
> See the currently tabled patch:
>
> http://sources.redhat.com/ml/gdb-patches/2001-01/msg00206.html
>
> part of it moves the enum to defs.h. I think it is less of a compromise
> than a cast.
Paul, Andrew,
Would you both find this modification of the patch acceptable?
I've made the following two changes:
1) Made all three versions of software_single_step use unsigned int
as the first parameter (and included Paul's cast to unsigned int
in the #define in all three cases).
2) Removed the " * sizeof (char)" from all the alloca calls, since
it is never used in other contexts where these constants are sent
to alloca (not to introduce a new inconsistancy).
Index: gdb/findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.15
diff -c -3 -p -r1.15 findvar.c
*** findvar.c 2000/07/30 01:48:25 1.15
--- findvar.c 2001/02/02 00:51:16
*************** value_of_register (int regnum)
*** 393,399 ****
CORE_ADDR addr;
int optim;
register value_ptr reg_val;
! char raw_buffer[MAX_REGISTER_RAW_SIZE];
enum lval_type lval;
get_saved_register (raw_buffer, &optim, &addr,
--- 393,399 ----
CORE_ADDR addr;
int optim;
register value_ptr reg_val;
! char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
enum lval_type lval;
get_saved_register (raw_buffer, &optim, &addr,
*************** addresses have not been bound by the dyn
*** 606,612 ****
case LOC_BASEREG:
case LOC_BASEREG_ARG:
{
! char buf[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)));
--- 606,612 ----
case LOC_BASEREG:
case LOC_BASEREG_ARG:
{
! 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)));
*************** addresses have not been bound by the dyn
*** 616,622 ****
case LOC_THREAD_LOCAL_STATIC:
{
! char buf[MAX_REGISTER_RAW_SIZE];
get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
NULL);
--- 616,622 ----
case LOC_THREAD_LOCAL_STATIC:
{
! char *buf = (char*) alloca (MAX_REGISTER_RAW_SIZE);
get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
NULL);
*************** addresses have not been bound by the dyn
*** 711,717 ****
value_ptr
value_from_register (struct type *type, int regnum, struct frame_info *frame)
{
! char raw_buffer[MAX_REGISTER_RAW_SIZE];
CORE_ADDR addr;
int optim;
value_ptr v = allocate_value (type);
--- 711,717 ----
value_ptr
value_from_register (struct type *type, int regnum, struct frame_info *frame)
{
! char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
CORE_ADDR addr;
int optim;
value_ptr v = allocate_value (type);
Index: gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.19
diff -c -3 -p -r1.19 infcmd.c
*** infcmd.c 2001/01/31 01:24:01 1.19
--- infcmd.c 2001/02/02 00:51:16
*************** do_registers_info (int regnum, int fpreg
*** 1467,1474 ****
for (i = 0; i < numregs; i++)
{
! char raw_buffer[MAX_REGISTER_RAW_SIZE];
! char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
/* Decide between printing all regs, nonfloat regs, or specific reg. */
if (regnum == -1)
--- 1467,1474 ----
for (i = 0; i < numregs; i++)
{
! 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)
Index: gdb/regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 regcache.c
*** regcache.c 2001/01/09 00:12:48 1.14
--- regcache.c 2001/02/02 00:51:16
*************** write_register_bytes (int myregstart, ch
*** 558,564 ****
/* The register partially overlaps the range being written. */
else
{
! char regbuf[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);
--- 558,564 ----
/* The register partially overlaps the range being written. */
else
{
! 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);
Index: gdb/remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.35
diff -c -3 -p -r1.35 remote.c
*** remote.c 2001/01/23 22:48:56 1.35
--- remote.c 2001/02/02 00:51:16
*************** remote_wait (int pid, struct target_wait
*** 2605,2611 ****
{
int i;
long regno;
! char regs[MAX_REGISTER_RAW_SIZE];
/* Expedited reply, containing Signal, {regno, reg} repeat */
/* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where
--- 2605,2611 ----
{
int i;
long regno;
! 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
*************** remote_async_wait (int pid, struct targe
*** 2826,2832 ****
{
int i;
long regno;
! char regs[MAX_REGISTER_RAW_SIZE];
/* Expedited reply, containing Signal, {regno, reg} repeat */
/* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where
--- 2826,2832 ----
{
int i;
long regno;
! 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
Index: gdb/sol-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/sol-thread.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 sol-thread.c
*** sol-thread.c 2001/01/24 21:01:02 1.20
--- sol-thread.c 2001/02/02 00:51:16
*************** sol_thread_store_registers (int regno)
*** 685,691 ****
if (regno != -1)
{ /* Not writing all the regs */
/* save new register value */
! char old_value[REGISTER_SIZE];
memcpy (old_value, ®isters[REGISTER_BYTE (regno)], REGISTER_SIZE);
val = p_td_thr_getgregs (&thandle, gregset);
--- 685,691 ----
if (regno != -1)
{ /* Not writing all the regs */
/* save new register value */
! char* old_value = (char*) alloca (REGISTER_SIZE);
memcpy (old_value, ®isters[REGISTER_BYTE (regno)], REGISTER_SIZE);
val = p_td_thr_getgregs (&thandle, gregset);
Index: gdb/sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.12
diff -c -3 -p -r1.12 sparc-tdep.c
*** sparc-tdep.c 2001/01/02 20:37:11 1.12
--- sparc-tdep.c 2001/02/02 00:51:16
*************** static branch_type isbranch (long, CORE_
*** 208,214 ****
set up a simulated single-step, we undo our damage. */
void
! sparc_software_single_step (enum target_signal ignore, /* pid, but we don't need it */
int insert_breakpoints_p)
{
branch_type br;
--- 208,214 ----
set up a simulated single-step, we undo our damage. */
void
! sparc_software_single_step (unsigned int ignore, /* sig, which we don't need */
int insert_breakpoints_p)
{
branch_type br;
Index: gdb/arc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arc-tdep.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 arc-tdep.c
*** arc-tdep.c 2001/01/31 01:24:00 1.5
--- arc-tdep.c 2001/02/02 00:51:16
*************** get_insn_type (unsigned long insn, CORE_
*** 520,526 ****
set up a simulated single-step, we undo our damage. */
void
! arc_software_single_step (enum target_signal ignore, /* sig but we don't need it */
int insert_breakpoints_p)
{
static CORE_ADDR next_pc, target;
--- 520,526 ----
set up a simulated single-step, we undo our damage. */
void
! arc_software_single_step (unsigned int ignore, /* sig, which we don't need */
int insert_breakpoints_p)
{
static CORE_ADDR next_pc, target;
Index: gdb/rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.17
diff -c -3 -p -r1.17 rs6000-tdep.c
*** rs6000-tdep.c 2000/11/18 05:50:11 1.17
--- rs6000-tdep.c 2001/02/02 00:51:17
*************** rs6000_breakpoint_from_pc (CORE_ADDR *bp
*** 297,303 ****
/* AIX does not support PT_STEP. Simulate it. */
void
! rs6000_software_single_step (unsigned int signal, int insert_breakpoints_p)
{
#define INSNLEN(OPCODE) 4
--- 297,304 ----
/* AIX does not support PT_STEP. Simulate it. */
void
! rs6000_software_single_step (unsigned int ignore, /* sig which we don't need */
! int insert_breakpoints_p)
{
#define INSNLEN(OPCODE) 4
Index: gdb/valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 valops.c
*** valops.c 2001/01/04 19:58:31 1.29
--- valops.c 2001/02/02 00:51:17
*************** value_assign (register value_ptr toval,
*** 559,565 ****
{
register struct type *type;
register value_ptr val;
! char raw_buffer[MAX_REGISTER_RAW_SIZE];
int use_buffer = 0;
if (!toval->modifiable)
--- 559,565 ----
{
register struct type *type;
register value_ptr val;
! char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
int use_buffer = 0;
if (!toval->modifiable)
*************** CORE_ADDR
*** 1016,1022 ****
push_word (CORE_ADDR sp, ULONGEST word)
{
register int len = REGISTER_SIZE;
! char buffer[MAX_REGISTER_RAW_SIZE];
store_unsigned_integer (buffer, len, word);
if (INNER_THAN (1, 2))
--- 1016,1022 ----
push_word (CORE_ADDR sp, ULONGEST word)
{
register int len = REGISTER_SIZE;
! char *buffer = alloca (MAX_REGISTER_RAW_SIZE);
store_unsigned_integer (buffer, len, word);
if (INNER_THAN (1, 2))
*************** You must use a pointer to function type
*** 1654,1660 ****
SAVE_DUMMY_FRAME_TOS (sp);
{
! char retbuf[REGISTER_BYTES];
char *name;
struct symbol *symbol;
--- 1654,1660 ----
SAVE_DUMMY_FRAME_TOS (sp);
{
! char *retbuf = (char*) alloca (REGISTER_BYTES);
char *name;
struct symbol *symbol;
Index: gdb/config/sparc/sun4sol2.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/sun4sol2.mh,v
retrieving revision 1.3
diff -c -3 -p -r1.3 sun4sol2.mh
*** sun4sol2.mh 2000/10/24 20:05:36 1.3
--- sun4sol2.mh 2001/02/02 00:51:17
*************** NAT_FILE= nm-sun4sol2.h
*** 8,13 ****
--- 8,16 ----
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
*************** NATDEPFILES= corelow.o core-sol2.o solib
*** 15,19 ****
# 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
HOST_IPC=-DBSD_IPC
--- 18,22 ----
# 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 -I/usr/include/v9
HOST_IPC=-DBSD_IPC
Index: gdb/config/sparc/tm-sparc.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/tm-sparc.h,v
retrieving revision 1.5
diff -c -3 -p -r1.5 tm-sparc.h
*** tm-sparc.h 2000/05/28 01:12:41 1.5
--- tm-sparc.h 2001/02/02 00:51:17
*************** extern void sparc32_extract_return_value
*** 738,744 ****
#define SOFTWARE_SINGLE_STEP_P 1
extern void sparc_software_single_step (unsigned int, int);
! #define SOFTWARE_SINGLE_STEP(sig,bp_p) sparc_software_single_step (sig,bp_p)
/* We need more arguments in a frame specification for the
"frame" or "info frame" command. */
--- 738,745 ----
#define SOFTWARE_SINGLE_STEP_P 1
extern void sparc_software_single_step (unsigned int, int);
! #define SOFTWARE_SINGLE_STEP(sig,bp_p) \
! sparc_software_single_step ((unsigned int) (sig), bp_p)
/* We need more arguments in a frame specification for the
"frame" or "info frame" command. */
Index: gdb/config/arc/tm-arc.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arc/tm-arc.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 tm-arc.h
*** tm-arc.h 2000/05/28 01:12:34 1.3
--- tm-arc.h 2001/02/02 00:51:17
*************** extern CORE_ADDR arc_skip_prologue (CORE
*** 63,69 ****
??? We do have a cycle single step facility, but that won't work. */
#define SOFTWARE_SINGLE_STEP_P 1
extern void arc_software_single_step (unsigned int, int);
! #define SOFTWARE_SINGLE_STEP(sig,bp_p) arc_software_single_step (sig, bp_p)
/* FIXME: Need to set STEP_SKIPS_DELAY. */
--- 63,70 ----
??? We do have a cycle single step facility, but that won't work. */
#define SOFTWARE_SINGLE_STEP_P 1
extern void arc_software_single_step (unsigned int, int);
! #define SOFTWARE_SINGLE_STEP(sig,bp_p) \
! arc_software_single_step ((unsigned int) sig, bp_p)
/* FIXME: Need to set STEP_SKIPS_DELAY. */
Index: gdb/config/rs6000/tm-rs6000.h
===================================================================
RCS file: /cvs/src/src/gdb/config/rs6000/tm-rs6000.h,v
retrieving revision 1.9
diff -c -3 -p -r1.9 tm-rs6000.h
*** tm-rs6000.h 2000/11/09 09:49:00 1.9
--- tm-rs6000.h 2001/02/02 00:51:17
*************** extern void aix_process_linenos (void);
*** 99,105 ****
#define SOFTWARE_SINGLE_STEP_P 1
extern void rs6000_software_single_step (unsigned int, int);
! #define SOFTWARE_SINGLE_STEP(sig,bp_p) rs6000_software_single_step (sig, bp_p)
/* Notice when a new child process is started. */
--- 99,106 ----
#define SOFTWARE_SINGLE_STEP_P 1
extern void rs6000_software_single_step (unsigned int, int);
! #define SOFTWARE_SINGLE_STEP(sig,bp_p) \
! rs6000_software_single_step ((unsigned int) sig, bp_p)
/* Notice when a new child process is started. */