From bb9bcb69cdddee8069bf24321f9a0e91ffd22f32 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Fri, 14 May 2010 19:27:05 +0000 Subject: [PATCH] 2010-05-14 Michael Snyder * findcmd.c: White space. * findvar.c: White space. * fork-child.c: White space. * frame-base.c: White space. * frame.c: White space. * frame-unwind.c: White space. * f-valprint.c: White space. --- gdb/ChangeLog | 8 ++++++++ gdb/f-valprint.c | 15 ++++++++++----- gdb/findcmd.c | 4 ++++ gdb/findvar.c | 14 +++++++++----- gdb/fork-child.c | 1 + gdb/frame-base.c | 4 ++++ gdb/frame-unwind.c | 1 + gdb/frame.c | 8 ++++++++ 8 files changed, 45 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2b0de0957d0..a602665cf53 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2010-05-14 Michael Snyder + * findcmd.c: White space. + * findvar.c: White space. + * fork-child.c: White space. + * frame-base.c: White space. + * frame.c: White space. + * frame-unwind.c: White space. + * f-valprint.c: White space. + * elfread.c: White space. * environ.c: White space. * eval.c: White space. diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 6760308b182..acd648758be 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -311,6 +311,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, { CORE_ADDR addr = extract_typed_address (valaddr + embedded_offset, type); + fprintf_filtered (stream, "@"); fputs_filtered (paddress (gdbarch, addr), stream); if (options->deref_ref) @@ -322,9 +323,10 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) { struct value *deref_val = - value_at - (TYPE_TARGET_TYPE (type), - unpack_pointer (type, valaddr + embedded_offset)); + value_at + (TYPE_TARGET_TYPE (type), + unpack_pointer (type, valaddr + embedded_offset)); + common_val_print (deref_val, stream, recurse, options, current_language); } @@ -352,6 +354,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, if (options->format || options->output_format) { struct value_print_options opts = *options; + opts.format = (options->format ? options->format : options->output_format); print_scalar_formatted (valaddr, type, &opts, 0, stream); @@ -403,6 +406,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, if (options->format || options->output_format) { struct value_print_options opts = *options; + opts.format = (options->format ? options->format : options->output_format); print_scalar_formatted (valaddr, type, &opts, 0, stream); @@ -451,6 +455,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, for (index = 0; index < TYPE_NFIELDS (type); index++) { int offset = TYPE_FIELD_BITPOS (type, index) / 8; + f_val_print (TYPE_FIELD_TYPE (type, index), valaddr + offset, embedded_offset, address, stream, recurse, options); if (index != TYPE_NFIELDS (type) - 1) @@ -537,7 +542,7 @@ info_common_command (char *comname, int from_tty) else { struct minimal_symbol *msymbol = - lookup_minimal_symbol_by_pc (get_frame_pc (fi)); + lookup_minimal_symbol_by_pc (get_frame_pc (fi)); if (msymbol != NULL) funname = SYMBOL_LINKAGE_NAME (msymbol); @@ -626,7 +631,7 @@ there_is_a_visible_common_named (char *comname) else { struct minimal_symbol *msymbol = - lookup_minimal_symbol_by_pc (fi->pc); + lookup_minimal_symbol_by_pc (fi->pc); if (msymbol != NULL) funname = SYMBOL_LINKAGE_NAME (msymbol); diff --git a/gdb/findcmd.c b/gdb/findcmd.c index c752316bcc5..8e9a4b8c41d 100644 --- a/gdb/findcmd.c +++ b/gdb/findcmd.c @@ -126,6 +126,7 @@ parse_find_args (char *args, ULONGEST *max_countp, if (*s == '+') { LONGEST len; + ++s; v = parse_to_comma_and_eval (&s); len = value_as_long (v); @@ -145,6 +146,7 @@ parse_find_args (char *args, ULONGEST *max_countp, else { CORE_ADDR end_addr; + v = parse_to_comma_and_eval (&s); end_addr = value_as_address (v); if (start_addr > end_addr) @@ -179,6 +181,7 @@ parse_find_args (char *args, ULONGEST *max_countp, > pattern_buf_size) { size_t current_offset = pattern_buf_end - pattern_buf; + pattern_buf_size *= 2; pattern_buf = xrealloc (pattern_buf, pattern_buf_size); pattern_buf_end = pattern_buf + current_offset; @@ -298,6 +301,7 @@ find_command (char *args, int from_tty) if (found_count > 0) { struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; + set_internalvar (lookup_internalvar ("_"), value_from_pointer (ptr_type, last_found_addr)); } diff --git a/gdb/findvar.c b/gdb/findvar.c index e117a8ed577..e0ca12c81f9 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -321,6 +321,7 @@ unsigned_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + return extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); } @@ -329,6 +330,7 @@ signed_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + return extract_signed_integer (buf, TYPE_LENGTH (type), byte_order); } @@ -339,6 +341,7 @@ unsigned_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr); } @@ -347,6 +350,7 @@ address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + store_signed_integer (buf, TYPE_LENGTH (type), byte_order, addr); } @@ -439,6 +443,7 @@ read_var_value (struct symbol *var, struct frame_info *frame) CORE_ADDR addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), SYMBOL_OBJ_SECTION (var)); + store_typed_address (value_contents_raw (v), type, addr); } else @@ -448,11 +453,9 @@ read_var_value (struct symbol *var, struct frame_info *frame) return v; case LOC_CONST_BYTES: - { - memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), len); - VALUE_LVAL (v) = not_lval; - return v; - } + memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), len); + VALUE_LVAL (v) = not_lval; + return v; case LOC_STATIC: if (overlay_debugging) @@ -473,6 +476,7 @@ read_var_value (struct symbol *var, struct frame_info *frame) { struct value *ref; CORE_ADDR argref; + argref = get_frame_args_address (frame); if (!argref) return 0; diff --git a/gdb/fork-child.c b/gdb/fork-child.c index 98d4935e55c..2b085ffe6ae 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -178,6 +178,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env, assuming that every other character is a separate argument. */ int argc = (strlen (allargs) + 1) / 2 + 2; + argv = (char **) xmalloc (argc * sizeof (*argv)); argv[0] = exec_file; breakup_args (allargs, &argv[1]); diff --git a/gdb/frame-base.c b/gdb/frame-base.c index db9547b7721..656ab259017 100644 --- a/gdb/frame-base.c +++ b/gdb/frame-base.c @@ -73,6 +73,7 @@ frame_base_init (struct obstack *obstack) { struct frame_base_table *table = OBSTACK_ZALLOC (obstack, struct frame_base_table); + table->tail = &table->head; table->default_base = &default_frame_base; return table; @@ -83,6 +84,7 @@ frame_base_append_sniffer (struct gdbarch *gdbarch, frame_base_sniffer_ftype *sniffer) { struct frame_base_table *table = gdbarch_data (gdbarch, frame_base_data); + (*table->tail) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_base_table_entry); (*table->tail)->sniffer = sniffer; table->tail = &(*table->tail)->next; @@ -93,6 +95,7 @@ frame_base_set_default (struct gdbarch *gdbarch, const struct frame_base *default_base) { struct frame_base_table *table = gdbarch_data (gdbarch, frame_base_data); + table->default_base = default_base; } @@ -106,6 +109,7 @@ frame_base_find_by_frame (struct frame_info *this_frame) for (entry = table->head; entry != NULL; entry = entry->next) { const struct frame_base *desc = NULL; + desc = entry->sniffer (this_frame); if (desc != NULL) return desc; diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c index aaf950a1fde..62e37f63d69 100644 --- a/gdb/frame-unwind.c +++ b/gdb/frame-unwind.c @@ -49,6 +49,7 @@ frame_unwind_init (struct obstack *obstack) { struct frame_unwind_table *table = OBSTACK_ZALLOC (obstack, struct frame_unwind_table); + /* Start the table out with a few default sniffers. OSABI code can't override this. */ table->list = OBSTACK_ZALLOC (obstack, struct frame_unwind_table_entry); diff --git a/gdb/frame.c b/gdb/frame.c index 650b2798193..a7258d0af98 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -592,6 +592,7 @@ frame_find_by_id (struct frame_id id) for (frame = get_current_frame (); ; frame = prev_frame) { struct frame_id this = get_frame_id (frame); + if (frame_id_eq (id, this)) /* An exact match. */ return frame; @@ -620,6 +621,7 @@ frame_unwind_pc (struct frame_info *this_frame) if (!this_frame->prev_pc.p) { CORE_ADDR pc; + if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame))) { /* The right way. The `pure' way. The one true way. This @@ -942,6 +944,7 @@ put_frame_register (struct frame_info *frame, int regnum, /* FIXME: write_memory doesn't yet take constant buffers. Arrrg! */ gdb_byte tmp[MAX_REGISTER_SIZE]; + memcpy (tmp, buf, register_size (gdbarch, regnum)); write_memory (addr, tmp, register_size (gdbarch, regnum)); break; @@ -998,6 +1001,7 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, for (i = regnum; i < numregs; i++) { int thissize = register_size (gdbarch, i); + if (thissize == 0) break; /* This register is not available on this architecture. */ maxsize += thissize; @@ -1013,6 +1017,7 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, while (len > 0) { int curr_len = register_size (gdbarch, regnum) - offset; + if (curr_len > len) curr_len = len; @@ -1024,6 +1029,7 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, else { gdb_byte buf[MAX_REGISTER_SIZE]; + if (!frame_register_read (frame, regnum, buf)) return 0; memcpy (myaddr, buf + offset, curr_len); @@ -1055,6 +1061,7 @@ put_frame_register_bytes (struct frame_info *frame, int regnum, while (len > 0) { int curr_len = register_size (gdbarch, regnum) - offset; + if (curr_len > len) curr_len = len; @@ -1065,6 +1072,7 @@ put_frame_register_bytes (struct frame_info *frame, int regnum, else { gdb_byte buf[MAX_REGISTER_SIZE]; + frame_register_read (frame, regnum, buf); memcpy (buf + offset, myaddr, curr_len); put_frame_register (frame, regnum, buf); -- 2.30.2