diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-10-12 15:30:05 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-10-12 15:30:05 +0000 |
commit | f6e56ab396717b198eb7a8eded5d0d2d24483c5e (patch) | |
tree | eb430bcca0168e2fd3e9b78241c1ea81f9828900 /gdb | |
parent | 3a99f02f77a073c934e5f6514b28bc417223cda6 (diff) | |
download | gdb-f6e56ab396717b198eb7a8eded5d0d2d24483c5e.zip gdb-f6e56ab396717b198eb7a8eded5d0d2d24483c5e.tar.gz gdb-f6e56ab396717b198eb7a8eded5d0d2d24483c5e.tar.bz2 |
* cris-tdep.c (cris_push_dummy_call): Support arguments passed by
reference. Fix endianness bugs.
(cris_reg_struct_has_address): Remove.
(cris_gdbarch_init): Remove set_gdbarch_deprecated_reg_struct_has_addr
and set_gdbarch_deprecated_use_struct_convention calls.
* gdbarch.sh (deprecated_reg_struct_has_addr): Remove.
* gdbarch.c, gdbarch.h: Regenerate.
* infcall.c (call_function_by_hand): Remove handling of
deprecated_reg_struct_has_addr.
doc/ChangeLog:
* gdbint.texi (Target Conditionals): Remove documentation of
and references to DEPRECATED_REG_STRUCT_HAS_ADDR.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/cris-tdep.c | 39 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 12 | ||||
-rw-r--r-- | gdb/gdbarch.c | 33 | ||||
-rw-r--r-- | gdb/gdbarch.h | 9 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 3 | ||||
-rw-r--r-- | gdb/infcall.c | 55 |
8 files changed, 36 insertions, 133 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 010a42c..76e3fa1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2007-10-12 Ulrich Weigand <uweigand@de.ibm.com> + + * cris-tdep.c (cris_push_dummy_call): Support arguments passed by + reference. Fix endianness bugs. + (cris_reg_struct_has_address): Remove. + (cris_gdbarch_init): Remove set_gdbarch_deprecated_reg_struct_has_addr + and set_gdbarch_deprecated_use_struct_convention calls. + + * gdbarch.sh (deprecated_reg_struct_has_addr): Remove. + * gdbarch.c, gdbarch.h: Regenerate. + * infcall.c (call_function_by_hand): Remove handling of + deprecated_reg_struct_has_addr. + 2007-10-11 Daniel Jacobowitz <dan@codesourcery.com> Kazu Hirata <kazu@codesourcery.com> diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 7d8bdb2..a2999a5 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -938,8 +938,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Data passed by value. Fits in available register(s). */ for (i = 0; i < reg_demand; i++) { - regcache_cooked_write_unsigned (regcache, argreg, - *(unsigned long *) val); + regcache_cooked_write (regcache, argreg, val); argreg++; val += 4; } @@ -952,8 +951,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { if (argreg <= ARG4_REGNUM) { - regcache_cooked_write_unsigned (regcache, argreg, - *(unsigned long *) val); + regcache_cooked_write (regcache, argreg, val); argreg++; val += 4; } @@ -968,8 +966,22 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else if (len > (2 * 4)) { - /* FIXME */ - internal_error (__FILE__, __LINE__, _("We don't do this")); + /* Data passed by reference. Push copy of data onto stack + and pass pointer to this copy as argument. */ + sp = (sp - len) & ~3; + write_memory (sp, val, len); + + if (argreg <= ARG4_REGNUM) + { + regcache_cooked_write_unsigned (regcache, argreg, sp); + argreg++; + } + else + { + gdb_byte buf[4]; + store_unsigned_integer (buf, 4, sp); + si = push_stack_item (si, buf, 4); + } } else { @@ -1931,18 +1943,6 @@ cris_return_value (struct gdbarch *gdbarch, struct type *type, return RETURN_VALUE_REGISTER_CONVENTION; } -/* Returns 1 if the given type will be passed by pointer rather than - directly. */ - -/* In the CRIS ABI, arguments shorter than or equal to 64 bits are passed - by value. */ - -static int -cris_reg_struct_has_addr (int gcc_p, struct type *type) -{ - return (TYPE_LENGTH (type) > 8); -} - /* Calculates a value that measures how good inst_args constraints an instruction. It stems from cris_constraint, found in cris-dis.c. */ @@ -4120,9 +4120,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } set_gdbarch_return_value (gdbarch, cris_return_value); - set_gdbarch_deprecated_reg_struct_has_addr (gdbarch, - cris_reg_struct_has_addr); - set_gdbarch_deprecated_use_struct_convention (gdbarch, always_use_struct_convention); set_gdbarch_sp_regnum (gdbarch, 14); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 68474c2..83b123f 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2007-10-12 Ulrich Weigand <uweigand@de.ibm.com> + + * gdbint.texi (Target Conditionals): Remove documentation of + and references to DEPRECATED_REG_STRUCT_HAS_ADDR. + 2007-10-11 Kazu Hirata <kazu@codesourcery.com> * gdb.texinfo: Mention that inaccessible-by-default is on by diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index d8dbcb0..21b3c90 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3889,14 +3889,10 @@ This should only need to be defined if @code{gdbarch_read_pc} and @item int gdbarch_stabs_argument_has_addr (@var{gdbarch}, @var{type}) @findex gdbarch_stabs_argument_has_addr -@findex DEPRECATED_REG_STRUCT_HAS_ADDR @anchor{gdbarch_stabs_argument_has_addr} Define this function to return nonzero if a function argument of type @var{type} is passed by reference instead of value. -This method replaces @code{DEPRECATED_REG_STRUCT_HAS_ADDR} -(@pxref{DEPRECATED_REG_STRUCT_HAS_ADDR}). - @item PROCESS_LINENUMBER_HOOK @findex PROCESS_LINENUMBER_HOOK A hook defined for XCOFF reading. @@ -3944,14 +3940,6 @@ This method replaces @w{@code{gdbarch_call_dummy_location (@var{gdbarch})}} and Return the name of register @var{regnr} as a string. May return @code{NULL} to indicate that @var{regnr} is not a valid register. -@item DEPRECATED_REG_STRUCT_HAS_ADDR (@var{gcc_p}, @var{type}) -@findex DEPRECATED_REG_STRUCT_HAS_ADDR -@anchor{DEPRECATED_REG_STRUCT_HAS_ADDR}Define this to return 1 if the -given type will be passed by pointer rather than directly. - -This method has been replaced by @code{gdbarch_stabs_argument_has_addr} -(@pxref{gdbarch_stabs_argument_has_addr}). - @item SAVE_DUMMY_FRAME_TOS (@var{sp}) @findex SAVE_DUMMY_FRAME_TOS @anchor{SAVE_DUMMY_FRAME_TOS} Used in @samp{call_function_by_hand} to diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 685a87e..de6c50c 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -200,7 +200,6 @@ struct gdbarch gdbarch_unwind_sp_ftype *unwind_sp; gdbarch_frame_num_args_ftype *frame_num_args; gdbarch_frame_align_ftype *frame_align; - gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr; gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr; int frame_red_zone_size; gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr; @@ -323,7 +322,6 @@ struct gdbarch startup_gdbarch = 0, /* unwind_sp */ 0, /* frame_num_args */ 0, /* frame_align */ - 0, /* deprecated_reg_struct_has_addr */ default_stabs_argument_has_addr, /* stabs_argument_has_addr */ 0, /* frame_red_zone_size */ convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */ @@ -571,7 +569,6 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* Skip verify of unwind_sp, has predicate */ /* Skip verify of frame_num_args, has predicate */ /* Skip verify of frame_align, has predicate */ - /* Skip verify of deprecated_reg_struct_has_addr, has predicate */ /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */ /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */ /* Skip verify of addr_bits_remove, invalid_p == 0 */ @@ -738,12 +735,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) "gdbarch_dump: deprecated_function_start_offset = 0x%s\n", paddr_nz (current_gdbarch->deprecated_function_start_offset)); fprintf_unfiltered (file, - "gdbarch_dump: gdbarch_deprecated_reg_struct_has_addr_p() = %d\n", - gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch)); - fprintf_unfiltered (file, - "gdbarch_dump: deprecated_reg_struct_has_addr = <0x%lx>\n", - (long) current_gdbarch->deprecated_reg_struct_has_addr); - fprintf_unfiltered (file, "gdbarch_dump: deprecated_use_struct_convention = <0x%lx>\n", (long) current_gdbarch->deprecated_use_struct_convention); fprintf_unfiltered (file, @@ -2425,30 +2416,6 @@ set_gdbarch_frame_align (struct gdbarch *gdbarch, } int -gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch) -{ - gdb_assert (gdbarch != NULL); - return gdbarch->deprecated_reg_struct_has_addr != NULL; -} - -int -gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->deprecated_reg_struct_has_addr != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_reg_struct_has_addr called\n"); - return gdbarch->deprecated_reg_struct_has_addr (gcc_p, type); -} - -void -set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, - gdbarch_deprecated_reg_struct_has_addr_ftype deprecated_reg_struct_has_addr) -{ - gdbarch->deprecated_reg_struct_has_addr = deprecated_reg_struct_has_addr; -} - -int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 95a2391..e24f2da 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -469,15 +469,6 @@ typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADD extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address); extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align); -/* deprecated_reg_struct_has_addr has been replaced by - stabs_argument_has_addr. */ - -extern int gdbarch_deprecated_reg_struct_has_addr_p (struct gdbarch *gdbarch); - -typedef int (gdbarch_deprecated_reg_struct_has_addr_ftype) (int gcc_p, struct type *type); -extern int gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, int gcc_p, struct type *type); -extern void set_gdbarch_deprecated_reg_struct_has_addr (struct gdbarch *gdbarch, gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr); - typedef int (gdbarch_stabs_argument_has_addr_ftype) (struct gdbarch *gdbarch, struct type *type); extern int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type); extern void set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 89682a3..6ad44f6 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -546,9 +546,6 @@ M::CORE_ADDR:unwind_sp:struct frame_info *next_frame:next_frame F::int:frame_num_args:struct frame_info *frame:frame # M::CORE_ADDR:frame_align:CORE_ADDR address:address -# deprecated_reg_struct_has_addr has been replaced by -# stabs_argument_has_addr. -F::int:deprecated_reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type m::int:stabs_argument_has_addr:struct type *type:type::default_stabs_argument_has_addr::0 v::int:frame_red_zone_size # diff --git a/gdb/infcall.c b/gdb/infcall.c index 3012d7f..fe9b168 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -624,61 +624,6 @@ You must use a pointer to function type variable. Command ignored."), arg_name); } } - if (gdbarch_deprecated_reg_struct_has_addr_p (current_gdbarch)) - { - int i; - /* This is a machine like the sparc, where we may need to pass a - pointer to the structure, not the structure itself. */ - for (i = nargs - 1; i >= 0; i--) - { - struct type *arg_type = check_typedef (value_type (args[i])); - if ((TYPE_CODE (arg_type) == TYPE_CODE_STRUCT - || TYPE_CODE (arg_type) == TYPE_CODE_UNION - || TYPE_CODE (arg_type) == TYPE_CODE_ARRAY - || TYPE_CODE (arg_type) == TYPE_CODE_STRING - || TYPE_CODE (arg_type) == TYPE_CODE_BITSTRING - || TYPE_CODE (arg_type) == TYPE_CODE_SET - || (TYPE_CODE (arg_type) == TYPE_CODE_FLT - && TYPE_LENGTH (arg_type) > 8) - ) - && gdbarch_deprecated_reg_struct_has_addr - (current_gdbarch, using_gcc, arg_type)) - { - CORE_ADDR addr; - int len; /* = TYPE_LENGTH (arg_type); */ - int aligned_len; - arg_type = check_typedef (value_enclosing_type (args[i])); - len = TYPE_LENGTH (arg_type); - - aligned_len = len; - if (gdbarch_inner_than (current_gdbarch, 1, 2)) - { - /* stack grows downward */ - sp -= aligned_len; - /* ... so the address of the thing we push is the - stack pointer after we push it. */ - addr = sp; - } - else - { - /* The stack grows up, so the address of the thing - we push is the stack pointer before we push it. */ - addr = sp; - sp += aligned_len; - } - /* Push the structure. */ - write_memory (addr, value_contents_all (args[i]), len); - /* The value we're going to pass is the address of the - thing we just pushed. */ - /*args[i] = value_from_longest (lookup_pointer_type (values_type), - (LONGEST) addr); */ - args[i] = value_from_pointer (lookup_pointer_type (arg_type), - addr); - } - } - } - - /* Reserve space for the return structure to be written on the stack, if necessary. Make certain that the value is correctly aligned. */ |