From 09af58685445072bdf77e9257632da71f979162c Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 21 Oct 1995 13:14:53 +0000 Subject: * alpha-tdep.c, mips-tdep.c (init_extra_frame_info): Do not set saved registers from heuristics for a sigtramp frame. * dwarfread.c (enum_type): Determine signedness of enum type from enumerators. * mips-tdep.c: Include gdb_string.h, gcc -Wall lint. * rs6000-nat.c (xcoff_relocate_core): Fix typo. * valops.c (value_repeat): Fix length of memory transfer to match recent allocate_repeat_value change. --- gdb/ChangeLog | 23 ++++++++++++++++++-- gdb/alpha-tdep.c | 23 ++++++++++++++------ gdb/dwarfread.c | 5 +++++ gdb/mips-tdep.c | 26 ++++++++++++++++------- gdb/rs6000-nat.c | 2 +- gdb/valops.c | 64 +++++++++++++++++++++++++++++++------------------------- 6 files changed, 99 insertions(+), 44 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 62622c9..86a1e45 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,22 @@ +Sat Oct 21 06:11:49 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * alpha-tdep.c, mips-tdep.c (init_extra_frame_info): + Do not set saved registers from heuristics for a sigtramp frame. + + * dwarfread.c (enum_type): Determine signedness of enum type + from enumerators. + + * mips-tdep.c: Include gdb_string.h, gcc -Wall lint. + + * rs6000-nat.c (xcoff_relocate_core): Fix typo. + + * valops.c (value_repeat): Fix length of memory transfer to + match recent allocate_repeat_value change. + +Thu Oct 19 19:04:35 1995 Per Bothner + + * gdbtypes.c (get_discrete_bounds): Fix typo. + Thu Oct 19 12:15:37 1995 Stan Shebs * defs.h (SEEK_SET, SEEK_CUR): Add default definitions. @@ -110,7 +129,7 @@ Thu Oct 12 13:36:15 1995 Jeffrey A Law (law@cygnus.com) * irix5-nat.c (solib_add): Update the to_sections and to_sections_end fields in core_ops here if needed. * osfsolib.c (solib_add): Likewise. - * rs6000-nat.c (xcoff_reload_core): Likewise. + * rs6000-nat.c (xcoff_relocate_core): Likewise. * solib.c (solib_add): Likewise. * somsolib.c (solib_add): Likewise. @@ -195,7 +214,7 @@ Fri Oct 6 11:56:49 1995 Jim Wilson Thu Oct 5 17:28:09 1995 Per Bothner - * values.c allocate_repeat_value): Allocate an array type, and + * values.c (allocate_repeat_value): Allocate an array type, and a value of that type; use that instead of setting VALUE_REPEATED. * value.h (struct value): Remove fields repetitions and repeated. (VALUE_REPEATED, VALUE_REPETITIONS): Removed, no longer used. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index f3ba0eb..6ec6f6d 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -132,7 +132,7 @@ struct linked_proc_info } *linked_proc_desc_table = NULL; -/* Guaranteed to set fci->saved_regs to some values (it never leaves it +/* Guaranteed to set frame->saved_regs to some values (it never leaves it NULL). */ void @@ -652,11 +652,22 @@ init_extra_frame_info (frame) if (proc_desc == &temp_proc_desc) { - frame->saved_regs = (struct frame_saved_regs*) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); - *frame->saved_regs = temp_saved_regs; - frame->saved_regs->regs[PC_REGNUM] = frame->saved_regs->regs[RA_REGNUM]; + char *name; + + /* Do not set the saved registers for a sigtramp frame, + alpha_find_saved_registers will do that for us. + We can't use frame->signal_handler_caller, it is not yet set. */ + find_pc_partial_function (frame->pc, &name, + (CORE_ADDR *)NULL,(CORE_ADDR *)NULL); + if (!IN_SIGTRAMP (frame->pc, name)) + { + frame->saved_regs = (struct frame_saved_regs*) + obstack_alloc (&frame_cache_obstack, + sizeof (struct frame_saved_regs)); + *frame->saved_regs = temp_saved_regs; + frame->saved_regs->regs[PC_REGNUM] + = frame->saved_regs->regs[RA_REGNUM]; + } } } } diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index bd92ad1..a68cdf1 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1689,6 +1689,7 @@ enum_type (dip, objfile) unsigned short blocksz; struct symbol *sym; int nbytes; + int unsigned_enum = 1; if ((type = lookup_utype (dip -> die_ref)) == NULL) { @@ -1749,6 +1750,8 @@ enum_type (dip, objfile) SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_TYPE (sym) = type; SYMBOL_VALUE (sym) = list -> field.bitpos; + if (SYMBOL_VALUE (sym) < 0) + unsigned_enum = 0; add_symbol_to_list (sym, list_in_scope); } /* Now create the vector of fields, and record how big it is. This is @@ -1758,6 +1761,8 @@ enum_type (dip, objfile) vector. */ if (nfields > 0) { + if (unsigned_enum) + TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; TYPE_NFIELDS (type) = nfields; TYPE_FIELDS (type) = (struct field *) obstack_alloc (&objfile->symbol_obstack, sizeof (struct field) * nfields); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 2bd7127..7c95a4f 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -18,9 +18,10 @@ GNU General Public License for more details. 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. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "gdb_string.h" #include "frame.h" #include "inferior.h" #include "symtab.h" @@ -665,11 +666,22 @@ init_extra_frame_info(fci) if (proc_desc == &temp_proc_desc) { - fci->saved_regs = (struct frame_saved_regs*) - obstack_alloc (&frame_cache_obstack, - sizeof (struct frame_saved_regs)); - *fci->saved_regs = temp_saved_regs; - fci->saved_regs->regs[PC_REGNUM] = fci->saved_regs->regs[RA_REGNUM]; + char *name; + + /* Do not set the saved registers for a sigtramp frame, + mips_find_saved_registers will do that for us. + We can't use fci->signal_handler_caller, it is not yet set. */ + find_pc_partial_function (fci->pc, &name, + (CORE_ADDR *)NULL,(CORE_ADDR *)NULL); + if (!IN_SIGTRAMP (fci->pc, name)) + { + fci->saved_regs = (struct frame_saved_regs*) + obstack_alloc (&frame_cache_obstack, + sizeof (struct frame_saved_regs)); + *fci->saved_regs = temp_saved_regs; + fci->saved_regs->regs[PC_REGNUM] + = fci->saved_regs->regs[RA_REGNUM]; + } } /* hack: if argument regs are saved, guess these contain args */ @@ -1026,7 +1038,7 @@ mips_do_registers_info (regnum, fpregs) } else { - int did_newline; + int did_newline = 0; for (regnum = 0; regnum < NUM_REGS; ) { diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c index e6e90ee..51ddf44 100644 --- a/gdb/rs6000-nat.c +++ b/gdb/rs6000-nat.c @@ -742,7 +742,7 @@ xcoff_relocate_core (target) /* We must update the to_sections field in the core_ops structure now to avoid dangling pointer dereferences. */ - update_coreops = core_ops.to_sections === target->to_sections; + update_coreops = core_ops.to_sections == target->to_sections; count = target->to_sections_end - target->to_sections; count += 2; diff --git a/gdb/valops.c b/gdb/valops.c index b4bfde8..a5520ec 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -56,47 +56,52 @@ static value_ptr cast_into_complex PARAMS ((struct type *, value_ptr)); #define VALUE_SUBSTRING_START(VAL) VALUE_FRAME(VAL) -/* Allocate NBYTES of space in the inferior using the inferior's malloc - and return a value that is a pointer to the allocated space. */ +/* Find the address of function name NAME in the inferior. */ -static CORE_ADDR -allocate_space_in_inferior (len) - int len; +value_ptr +find_function_in_inferior (name) + char *name; { - register value_ptr val; register struct symbol *sym; - struct minimal_symbol *msymbol; - struct type *type; - value_ptr blocklen; - LONGEST maddr; - - /* Find the address of malloc in the inferior. */ - - sym = lookup_symbol ("malloc", 0, VAR_NAMESPACE, 0, NULL); + sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL); if (sym != NULL) { if (SYMBOL_CLASS (sym) != LOC_BLOCK) { - error ("\"malloc\" exists in this program but is not a function."); + error ("\"%s\" exists in this program but is not a function.", + name); } - val = value_of_variable (sym, NULL); + return value_of_variable (sym, NULL); } else { - msymbol = lookup_minimal_symbol ("malloc", NULL, NULL); + struct minimal_symbol *msymbol = lookup_minimal_symbol(name, NULL, NULL); if (msymbol != NULL) { + struct type *type; + LONGEST maddr; type = lookup_pointer_type (builtin_type_char); type = lookup_function_type (type); type = lookup_pointer_type (type); maddr = (LONGEST) SYMBOL_VALUE_ADDRESS (msymbol); - val = value_from_longest (type, maddr); + return value_from_longest (type, maddr); } else { - error ("evaluation of this expression requires the program to have a function \"malloc\"."); + error ("evaluation of this expression requires the program to have a function \"%s\".", name); } } +} + +/* Allocate NBYTES of space in the inferior using the inferior's malloc + and return a value that is a pointer to the allocated space. */ + +value_ptr +value_allocate_space_in_inferior (len) + int len; +{ + value_ptr blocklen; + register value_ptr val = find_function_in_inferior ("malloc"); blocklen = value_from_longest (builtin_type_int, (LONGEST) len); val = call_function_by_hand (val, 1, &blocklen); @@ -104,7 +109,14 @@ allocate_space_in_inferior (len) { error ("No memory available to program."); } - return (value_as_long (val)); + return val; +} + +static CORE_ADDR +allocate_space_in_inferior (len) + int len; +{ + return value_as_long (value_allocate_space_in_inferior (len)); } /* Cast value ARG2 to type TYPE and return as a value. @@ -151,8 +163,7 @@ value_cast (type, arg2) } if (current_language->c_style_arrays - && (VALUE_REPEATED (arg2) - || TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_ARRAY)) + && TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_ARRAY) arg2 = value_coerce_array (arg2); if (TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_FUNC) @@ -622,14 +633,12 @@ value_repeat (arg1, count) error ("Only values in memory can be extended with '@'."); if (count < 1) error ("Invalid number %d of repetitions.", count); - if (VALUE_REPEATED (arg1)) - error ("Cannot create artificial arrays of artificial arrays."); val = allocate_repeat_value (VALUE_TYPE (arg1), count); read_memory (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1), VALUE_CONTENTS_RAW (val), - TYPE_LENGTH (VALUE_TYPE (val)) * count); + TYPE_LENGTH (VALUE_TYPE (val))); VALUE_LVAL (val) = lval_memory; VALUE_ADDRESS (val) = VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1); @@ -854,8 +863,7 @@ value_arg_coerce (arg, param_type) #if 1 /* FIXME: This is only a temporary patch. -fnf */ if (current_language->c_style_arrays - && (VALUE_REPEATED (arg) - || TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY)) + && TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY) arg = value_coerce_array (arg); #endif @@ -1464,7 +1472,7 @@ typecmp (staticp, t1, t2) /* We should be doing hairy argument matching, as below. */ && (TYPE_CODE (TYPE_TARGET_TYPE (tt1)) == TYPE_CODE (tt2))) { - if (TYPE_CODE (tt2) == TYPE_CODE_ARRAY || VALUE_REPEATED (t2[i])) + if (TYPE_CODE (tt2) == TYPE_CODE_ARRAY) t2[i] = value_coerce_array (t2[i]); else t2[i] = value_addr (t2[i]); -- cgit v1.1