From b8d56208c522b6a27efe7790770ef65a3031da7b Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Sun, 16 May 2010 00:18:02 +0000 Subject: [PATCH] 2010-05-15 Michael Snyder * m2-lang.c: White space. * m2-valprint.c: White space. * macrocmd.c: White space. * macroexp.c: White space. * macroscope.c: White space. * macrotab.c: White space. * main.c: White space. * maint.c: White space. * mdebugread.c: White space. * memattr.c: White space. * minsyms.c: White space. * monitor.c: White space. --- gdb/ChangeLog | 15 +++++++++++++++ gdb/m2-lang.c | 11 +++++++---- gdb/m2-valprint.c | 8 ++++++++ gdb/macrocmd.c | 3 +++ gdb/macroexp.c | 6 ++++++ gdb/macroscope.c | 1 + gdb/macrotab.c | 6 ++++++ gdb/main.c | 2 ++ gdb/maint.c | 5 +++-- gdb/mdebugread.c | 24 +++++++++++++++++------- gdb/memattr.c | 17 +++++++++-------- gdb/minsyms.c | 8 ++++++++ gdb/monitor.c | 23 +++++++++++++++++++++-- 13 files changed, 106 insertions(+), 23 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1d067266eab..1819a544ff0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2010-05-15 Michael Snyder + + * m2-lang.c: White space. + * m2-valprint.c: White space. + * macrocmd.c: White space. + * macroexp.c: White space. + * macroscope.c: White space. + * macrotab.c: White space. + * main.c: White space. + * maint.c: White space. + * mdebugread.c: White space. + * memattr.c: White space. + * minsyms.c: White space. + * monitor.c: White space. + 2010-05-14 Michael Snyder * jv-lang.c: White space. diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 9cc64bc5893..ade52d98525 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -194,6 +194,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, struct value *arg1; struct value *arg2; struct type *type; + switch (op) { case UNOP_HIGH: @@ -210,6 +211,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, if (m2_is_unbounded_array (type)) { struct value *temp = arg1; + type = TYPE_FIELD_TYPE (type, 1); /* i18n: Do not translate the "_m2_high" part! */ arg1 = value_struct_elt (&temp, NULL, "_m2_high", NULL, @@ -239,10 +241,11 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, { struct value *temp = arg1; type = TYPE_FIELD_TYPE (type, 0); - if (type == NULL || (TYPE_CODE (type) != TYPE_CODE_PTR)) { - warning (_("internal error: unbounded array structure is unknown")); - return evaluate_subexp_standard (expect_type, exp, pos, noside); - } + if (type == NULL || (TYPE_CODE (type) != TYPE_CODE_PTR)) + { + warning (_("internal error: unbounded array structure is unknown")); + return evaluate_subexp_standard (expect_type, exp, pos, noside); + } /* i18n: Do not translate the "_m2_contents" part! */ arg1 = value_struct_elt (&temp, NULL, "_m2_contents", NULL, _("unbounded structure " diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index a4ed4b1d28f..edfd3245d7a 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -259,6 +259,7 @@ print_variable_at_address (struct type *type, { struct value *deref_val = value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr)); + common_val_print (deref_val, stream, recurse, options, current_language); } else @@ -395,6 +396,7 @@ m2_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) @@ -409,6 +411,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr + embedded_offset)); + common_val_print (deref_val, stream, recurse, options, current_language); } @@ -483,6 +486,7 @@ m2_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 + embedded_offset, type, @@ -520,6 +524,7 @@ m2_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 + embedded_offset, type, @@ -533,6 +538,7 @@ m2_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 + embedded_offset, type, @@ -596,6 +602,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, { int element = value_bit_index (type, valaddr + embedded_offset, i); + if (element < 0) { i = element; @@ -615,6 +622,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, ++i)) { int j = i; + fputs_filtered ("..", stream); while (i + 1 <= high_bound && value_bit_index (type, diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c index eab815b64a0..74aa05221a6 100644 --- a/gdb/macrocmd.c +++ b/gdb/macrocmd.c @@ -50,6 +50,7 @@ macro_expand_command (char *exp, int from_tty) struct macro_scope *ms = NULL; char *expanded = NULL; struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &ms); + make_cleanup (free_current_contents, &expanded); /* You know, when the user doesn't specify any expression, it would be @@ -249,6 +250,7 @@ free_macro_definition_ptr (void *ptr) { int i; struct macro_definition *loc = (struct macro_definition *) ptr; + for (i = 0; i < loc->argc; ++i) xfree ((char *) loc->argv[i]); xfree ((char *) loc->argv); @@ -362,6 +364,7 @@ print_one_macro (const char *name, const struct macro_definition *macro, if (macro->kind == macro_function_like) { int i; + fprintf_filtered (gdb_stdout, "("); for (i = 0; i < macro->argc; ++i) fprintf_filtered (gdb_stdout, "%s%s", (i > 0) ? ", " : "", diff --git a/gdb/macroexp.c b/gdb/macroexp.c index 0bd65f6efaa..73e68d76df5 100644 --- a/gdb/macroexp.c +++ b/gdb/macroexp.c @@ -525,6 +525,7 @@ get_token (struct macro_buffer *tok, { /* How many characters did we consume, including whitespace? */ int consumed = p - src->text + tok->len; + src->text += consumed; src->len -= consumed; return 1; @@ -767,6 +768,7 @@ gather_arguments (const char *name, struct macro_buffer *src, paren. */ { struct macro_buffer temp; + init_shared_buffer (&temp, src->text, src->len); if (! get_token (&tok, &temp) @@ -1016,6 +1018,7 @@ substitute_args (struct macro_buffer *dest, { int arg = find_parameter (&tok, is_varargs, va_arg_name, def->argc, def->argv); + if (arg != -1) appendmem (dest, argv[arg].text, argv[arg].len); else @@ -1055,6 +1058,7 @@ substitute_args (struct macro_buffer *dest, { int arg = find_parameter (&tok, is_varargs, va_arg_name, def->argc, def->argv); + if (arg != -1) appendmem (dest, argv[arg].text, argv[arg].len); else @@ -1193,6 +1197,7 @@ expand (const char *id, else { int len = strlen (def->argv[def->argc - 1]); + if (len > 3 && strcmp (def->argv[def->argc - 1] + len - 3, "...") == 0) { @@ -1297,6 +1302,7 @@ maybe_expand (struct macro_buffer *dest, lookup function expects. */ char *id = xmalloc (src_first->len + 1); struct cleanup *back_to = make_cleanup (xfree, id); + memcpy (id, src_first->text, src_first->len); id[src_first->len] = 0; diff --git a/gdb/macroscope.c b/gdb/macroscope.c index 0344301c3ee..844e2e5b298 100644 --- a/gdb/macroscope.c +++ b/gdb/macroscope.c @@ -88,6 +88,7 @@ struct macro_scope * user_macro_scope (void) { struct macro_scope *ms; + ms = XNEW (struct macro_scope); ms->file = macro_main (macro_user_macros); ms->line = -1; diff --git a/gdb/macrotab.c b/gdb/macrotab.c index 4dd63822303..93651ab39aa 100644 --- a/gdb/macrotab.c +++ b/gdb/macrotab.c @@ -113,6 +113,7 @@ macro_bcache (struct macro_table *t, const void *addr, int len) else { void *copy = xmalloc (len); + memcpy (copy, addr, len); return copy; } @@ -316,6 +317,7 @@ key_compare (struct macro_key *key, const char *name, struct macro_source_file *file, int line) { int names = strcmp (key->name, name); + if (names) return names; @@ -879,6 +881,7 @@ macro_definition_location (struct macro_source_file *source, if (n) { struct macro_key *key = (struct macro_key *) n->key; + *definition_line = key->start_line; return key->start_file; } @@ -905,6 +908,7 @@ foreach_macro (splay_tree_node node, void *arg) struct macro_for_each_data *datum = (struct macro_for_each_data *) arg; struct macro_key *key = (struct macro_key *) node->key; struct macro_definition *def = (struct macro_definition *) node->value; + (*datum->fn) (key->name, def, datum->user_data); return 0; } @@ -915,6 +919,7 @@ macro_for_each (struct macro_table *table, macro_callback_fn fn, void *user_data) { struct macro_for_each_data datum; + datum.fn = fn; datum.user_data = user_data; datum.file = NULL; @@ -946,6 +951,7 @@ macro_for_each_in_scope (struct macro_source_file *file, int line, macro_callback_fn fn, void *user_data) { struct macro_for_each_data datum; + datum.fn = fn; datum.user_data = user_data; datum.file = file; diff --git a/gdb/main.c b/gdb/main.c index 030c6818df9..254e74d4d19 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -143,6 +143,7 @@ relocate_directory (const char *progname, const char *initial, int flag) if (*dir) { char *canon_sysroot = lrealpath (dir); + if (canon_sysroot) { xfree (dir); @@ -742,6 +743,7 @@ Excess command line arguments ignored. (%s%s)\n"), { /* Find it. */ struct interp *interp = interp_lookup (interpreter_p); + if (interp == NULL) error (_("Interpreter `%s' unrecognized"), interpreter_p); /* Install it. */ diff --git a/gdb/maint.c b/gdb/maint.c index 7a3ff0aeda6..1673e93dbaf 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -354,6 +354,7 @@ print_objfile_section_info (bfd *abfd, { struct gdbarch *gdbarch = gdbarch_from_bfd (abfd); int addr_size = gdbarch_addr_bit (gdbarch) / 8; + maint_print_section_info (name, flags, obj_section_addr (asect), obj_section_endaddr (asect), @@ -425,6 +426,7 @@ maintenance_print_architecture (char *args, int from_tty) { struct cleanup *cleanups; struct ui_file *file = gdb_fopen (args, "w"); + if (file == NULL) perror_with_name (_("maintenance print architecture")); cleanups = make_cleanup_ui_file_delete (file); @@ -571,7 +573,6 @@ the command you want to undeprecate.\n")); static void maintenance_do_deprecate (char *text, int deprecate) { - struct cmd_list_element *alias = NULL; struct cmd_list_element *prefix_cmd = NULL; struct cmd_list_element *cmd = NULL; @@ -618,7 +619,6 @@ maintenance_do_deprecate (char *text, int deprecate) memory. */ if (alias) { - if (alias->flags & MALLOCED_REPLACEMENT) xfree (alias->replacement); @@ -722,6 +722,7 @@ maintenance_set_profile_cmd (char *args, int from_tty, struct cmd_list_element * else { extern void _mcleanup (void); + _mcleanup (); } } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 5fb9c49abeb..2e18fa461bb 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -271,7 +271,6 @@ static char *mdebug_next_symbol_text (struct objfile *); static void mdebug_psymtab_to_symtab (struct partial_symtab *pst) { - if (!pst) return; @@ -753,6 +752,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (sh->st == stProc) { struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st); + /* The next test should normally be true, but provides a hook for nested functions (which we don't want to make global). */ @@ -1154,6 +1154,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); i++) { struct block *b_bad = BLOCKVECTOR_BLOCK (bv, i); + if (BLOCK_SUPERBLOCK (b_bad) == b && BLOCK_START (b_bad) == top_stack->procadr && BLOCK_END (b_bad) == top_stack->procadr) @@ -1174,6 +1175,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (nparams > 0) { struct dict_iterator iter; + TYPE_NFIELDS (ftype) = nparams; TYPE_FIELDS (ftype) = (struct field *) TYPE_ALLOC (ftype, nparams * sizeof (struct field)); @@ -1576,6 +1578,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, if (t->fBitfield) { int width = AUX_GET_WIDTH (bigend, ax); + /* Inhibit core dumps if TIR is corrupted. */ if (bs == (int *) NULL) { @@ -1663,7 +1666,6 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, } else { - /* Usually, TYPE_CODE(tp) is already type_code. The main exception is if we guessed wrong re struct/union/enum. But for struct vs. union a wrong guess is harmless, so @@ -1968,6 +1970,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab, the same name exists, lookup_symbol will eventually read in the symtab for the global function and clobber cur_fdr. */ FDR *save_cur_fdr = cur_fdr; + s = lookup_symbol (sh_name, NULL, VAR_DOMAIN, 0); cur_fdr = save_cur_fdr; #else @@ -2401,6 +2404,7 @@ parse_partial_symbols (struct objfile *objfile) fdr_to_pst++; { struct partial_symtab *pst = new_psymtab ("", objfile); + fdr_to_pst[-1].pst = pst; FDR_IDX (pst) = -1; } @@ -2809,6 +2813,7 @@ parse_partial_symbols (struct objfile *objfile) { char *stabstring = debug_info->ss + fh->issBase + sh.iss; int len = strlen (stabstring); + while (stabstring[len - 1] == '\\') { SYMR sh2; @@ -2845,6 +2850,7 @@ parse_partial_symbols (struct objfile *objfile) switch (type_code) { char *p; + /* * Standard, external, non-debugger, symbols */ @@ -2951,7 +2957,7 @@ parse_partial_symbols (struct objfile *objfile) past_first_source_file = 1; if (prev_so_symnum != symnum - 1) - { /* Here if prev stab wasn't N_SO */ + { /* Here if prev stab wasn't N_SO */ first_so_symnum = symnum; if (pst) @@ -2997,6 +3003,7 @@ parse_partial_symbols (struct objfile *objfile) case N_SOL: { enum language tmp_language; + /* Mark down an include file in the current psymtab */ /* SET_NAMESTRING ();*/ @@ -3025,8 +3032,10 @@ parse_partial_symbols (struct objfile *objfile) in a binary tree, if profiling shows this is a major hog). */ if (pst && strcmp (namestring, pst->filename) == 0) continue; + { int i; + for (i = 0; i < includes_used; i++) if (strcmp (namestring, psymtab_include_list[i]) == 0) @@ -3232,6 +3241,7 @@ parse_partial_symbols (struct objfile *objfile) { int name_len = p - namestring; char *name = xmalloc (name_len + 1); + memcpy (name, namestring, name_len); name[name_len] = '\0'; function_outside_compilation_unit_complaint (name); @@ -3253,6 +3263,7 @@ parse_partial_symbols (struct objfile *objfile) { int name_len = p - namestring; char *name = xmalloc (name_len + 1); + memcpy (name, namestring, name_len); name[name_len] = '\0'; function_outside_compilation_unit_complaint (name); @@ -4031,9 +4042,9 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) /* Make up special symbol to contain procedure specific info */ struct mdebug_extra_func_info *e = - ((struct mdebug_extra_func_info *) - obstack_alloc (¤t_objfile->objfile_obstack, - sizeof (struct mdebug_extra_func_info))); + ((struct mdebug_extra_func_info *) + obstack_alloc (¤t_objfile->objfile_obstack, + sizeof (struct mdebug_extra_func_info))); struct symbol *s = new_symbol (MDEBUG_EFI_SYMBOL_NAME); memset (e, 0, sizeof (struct mdebug_extra_func_info)); @@ -4730,7 +4741,6 @@ new_linetable (int size) static struct linetable * shrink_linetable (struct linetable *lt) { - return (struct linetable *) xrealloc ((void *) lt, (sizeof (struct linetable) + ((lt->nitems - 1) diff --git a/gdb/memattr.c b/gdb/memattr.c index 3fcc45eb6dc..4284da4eb2e 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -440,6 +440,7 @@ mem_info_command (char *args, int from_tty) for (ix = 0; VEC_iterate (mem_region_s, mem_region_list, ix, m); ix++) { char *tmp; + printf_filtered ("%-3d %-3c\t", m->number, m->enabled_p ? 'y' : 'n'); @@ -452,17 +453,17 @@ mem_info_command (char *args, int from_tty) if (gdbarch_addr_bit (target_gdbarch) <= 32) { - if (m->hi == 0) - tmp = "0x100000000"; - else - tmp = hex_string_custom ((unsigned long) m->hi, 8); + if (m->hi == 0) + tmp = "0x100000000"; + else + tmp = hex_string_custom ((unsigned long) m->hi, 8); } else { - if (m->hi == 0) - tmp = "0x10000000000000000"; - else - tmp = hex_string_custom ((unsigned long) m->hi, 16); + if (m->hi == 0) + tmp = "0x10000000000000000"; + else + tmp = hex_string_custom ((unsigned long) m->hi, 16); } printf_filtered ("%s ", tmp); diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 287f9de875e..cb4545c06fc 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -82,6 +82,7 @@ unsigned int msymbol_hash_iw (const char *string) { unsigned int hash = 0; + while (*string && *string != '(') { while (isspace (*string)) @@ -101,6 +102,7 @@ unsigned int msymbol_hash (const char *string) { unsigned int hash = 0; + for (; *string; ++string) hash = hash * 67 + *string - 113; return hash; @@ -115,6 +117,7 @@ add_minsym_to_hash_table (struct minimal_symbol *sym, { unsigned int hash = msymbol_hash (SYMBOL_LINKAGE_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE; + sym->hash_next = table[hash]; table[hash] = sym; } @@ -130,6 +133,7 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym, { unsigned int hash = msymbol_hash_iw (SYMBOL_SEARCH_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE; + sym->demangled_hash_next = table[hash]; table[hash] = sym; } @@ -195,6 +199,7 @@ lookup_minimal_symbol (const char *name, const char *sfile, if (sfile != NULL) { char *p = strrchr (sfile, '/'); + if (p != NULL) sfile = p + 1; } @@ -204,6 +209,7 @@ lookup_minimal_symbol (const char *name, const char *sfile, if (current_language->la_language == language_cplus) { char *cname = cp_canonicalize_string (name); + if (cname) { modified_name = cname; @@ -1161,6 +1167,7 @@ install_minimal_symbols (struct objfile *objfile) mixing ABIs then the user will need to "set cp-abi" manually. */ const char *name = SYMBOL_LINKAGE_NAME (&objfile->msymbols[i]); + if (name[0] == '_' && name[1] == 'Z' && SYMBOL_DEMANGLED_NAME (&objfile->msymbols[i]) != NULL) { @@ -1239,6 +1246,7 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) SYMBOL_LINKAGE_NAME (tsymbol)) == 0) { CORE_ADDR func; + func = gdbarch_convert_from_func_ptr_addr (get_objfile_arch (objfile), SYMBOL_VALUE_ADDRESS (msymbol), diff --git a/gdb/monitor.c b/gdb/monitor.c index b11450e36b1..c9df269a3d3 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -133,6 +133,7 @@ monitor_debug (const char *fmt, ...) if (monitor_debug_p) { va_list args; + va_start (args, fmt); vfprintf_filtered (gdb_stdlog, fmt, args); va_end (args); @@ -212,6 +213,7 @@ monitor_error (char *function, char *message, { int real_len = (len == 0 && string != (char *) 0) ? strlen (string) : len; char *safe_string = alloca ((real_len * 4) + 1); + monitor_printable_string (safe_string, string, real_len); if (final_char) @@ -326,6 +328,7 @@ monitor_printf_noecho (char *pattern,...) if (monitor_debug_p) { char *safe_string = (char *) alloca ((strlen (sndbuf) * 4) + 1); + monitor_printable_string (safe_string, sndbuf, 0); fprintf_unfiltered (gdb_stdlog, "sent[%s]\n", safe_string); } @@ -354,6 +357,7 @@ monitor_printf (char *pattern,...) if (monitor_debug_p) { char *safe_string = (char *) alloca ((len * 4) + 1); + monitor_printable_string (safe_string, sndbuf, 0); fprintf_unfiltered (gdb_stdlog, "sent[%s]\n", safe_string); } @@ -437,6 +441,7 @@ readchar (int timeout) if (monitor_debug_p || remote_debug) { char buf[2]; + buf[0] = c; buf[1] = '\0'; puts_debug ("read -->", buf, "<--"); @@ -594,6 +599,7 @@ monitor_expect_regexp (struct re_pattern_buffer *pat, char *buf, int buflen) { char *mybuf; char *p; + monitor_debug ("MON Expecting regexp\n"); if (buf) mybuf = buf; @@ -960,6 +966,7 @@ parse_register_dump (struct regcache *regcache, char *buf, int len) { int regnamelen, vallen; char *regname, *val; + /* Element 0 points to start of register name, and element 1 points to the start of the register value. */ struct re_registers register_strings; @@ -1044,6 +1051,7 @@ monitor_wait_filter (char *buf, struct target_waitstatus *status) { int resp_len; + do { resp_len = monitor_expect_prompt (buf, bufmax); @@ -1206,6 +1214,7 @@ monitor_fetch_register (struct regcache *regcache, int regno) if (current_monitor->flags & MO_HEX_PREFIX) { int c; + c = readchar (timeout); while (c == ' ') c = readchar (timeout); @@ -1223,6 +1232,7 @@ monitor_fetch_register (struct regcache *regcache, int regno) for (i = 0; i < register_size (get_regcache_arch (regcache), regno) * 2; i++) { int c; + c = readchar (timeout); while (c == ' ') c = readchar (timeout); @@ -1268,6 +1278,7 @@ monitor_dump_reg_block (struct regcache *regcache, char *block_cmd) { char buf[TARGET_BUF_SIZE]; int resp_len; + monitor_printf (block_cmd); resp_len = monitor_expect_prompt (buf, sizeof (buf)); parse_register_dump (regcache, buf, resp_len); @@ -1283,6 +1294,7 @@ monitor_dump_regs (struct regcache *regcache) { char buf[TARGET_BUF_SIZE]; int resp_len; + if (current_monitor->dumpregs) (*(current_monitor->dumpregs)) (regcache); /* call supplied function */ else if (current_monitor->dump_registers) /* default version */ @@ -1483,7 +1495,6 @@ monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len) monitor_printf_noecho (cmd, memaddr, val); else if (current_monitor->flags & MO_SETMEM_INTERACTIVE) { - monitor_printf_noecho (cmd, memaddr); if (current_monitor->setmem.resp_delim) @@ -1499,7 +1510,7 @@ monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len) monitor_printf ("%x\r", val); } if (current_monitor->setmem.term_cmd) - { /* Emit this to get out of the memory editing state */ + { /* Emit this to get out of the memory editing state */ monitor_printf ("%s", current_monitor->setmem.term_cmd); /* Drop through to expecting a prompt */ } @@ -1518,6 +1529,7 @@ monitor_write_memory_bytes (CORE_ADDR memaddr, char *myaddr, int len) { unsigned char val; int written = 0; + if (len == 0) return 0; /* Enter the sub mode */ @@ -1546,6 +1558,7 @@ longlongendswap (unsigned char *a) { int i, j; unsigned char x; + i = 0; j = 7; while (i < 4) @@ -1573,10 +1586,12 @@ longlong_hexchars (unsigned long long value, unsigned char *scan, *limit; /* loop controls */ unsigned char c, nib; int leadzero = 1; + scan = disbuf; limit = scan + 8; { unsigned long long *dp; + dp = (unsigned long long *) scan; *dp = value; } @@ -1613,6 +1628,7 @@ monitor_write_memory_longlongs (CORE_ADDR memaddr, char *myaddr, int len) long long *llptr; long long value; int written = 0; + llptr = (unsigned long long *) myaddr; if (len == 0) return 0; @@ -1657,6 +1673,7 @@ static int monitor_write_memory_block (CORE_ADDR memaddr, char *myaddr, int len) { int written; + written = 0; /* FIXME: This would be a good place to put the zero test */ #if 1 @@ -1744,6 +1761,7 @@ monitor_read_memory_single (CORE_ADDR memaddr, char *myaddr, int len) { int i; + for (i = 0; i < len * 2; i++) { int c; @@ -1883,6 +1901,7 @@ monitor_read_memory (CORE_ADDR memaddr, char *myaddr, int len) { int retval, tmp; struct re_registers resp_strings; + monitor_debug ("MON getmem.resp_delim %s\n", current_monitor->getmem.resp_delim); memset (&resp_strings, 0, sizeof (struct re_registers)); -- 2.30.2