diff options
Diffstat (limited to 'gdb')
91 files changed, 1054 insertions, 676 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 709fc16..bf964d8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,224 @@ 2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> + * defs.h (strlen_paddr, paddr, paddr_nz): Remove. + (paddress): Add GDBARCH parameter. + * utils.c (strlen_paddr, paddr, paddr_nz): Remove. + (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. + * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. + * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, + use it instead of current_gdbarch. + + Update calls to ui_out_field_core_addr to pass architecture: + * ada-lang.c (print_one_exception): Update. + * breakpoint.c (print_one_breakpoint_location, + print_one_exception_catchpoint): Update. + * disasm.c (dump_insns): Update. + * darwin-nat-info.c (darwin_debug_regions_recurse): Update. + * mi/mi-main.c (mi_cmd_data_read_memory): Update. + * mi/mi-symbol-cmds.c: Include "objfiles.h". + (mi_cmd_symbol_list_lines): Update. + * stack.c (print_frame_info, print_frame): Update. + + Update callers of paddress to pass architecture: + * ada-tasks.c (info_task): Update. + * ada-valprint.c (ada_val_print_1): Update. + * annotate.c (annotate_source, annotate_frame_begin): Update. + * breakpoint.c (insert_bp_location, describe_other_breakpoints, + mention): Update. + * cli/cli-cmds.c (edit_command, list_command, print_disassembly): + Update. + * corefile.c (memory_error): Update. + * c-valprint.c (print_function_pointer_address, c_val_print): Update. + * disasm.c (dis_asm_print_address): Update. + * exec.c (print_section_info): Update. + * f-valprint.c (f_val_print): Update. + * infcmd.c: Include "arch-utils.h". + (jump_command, program_info): Update. + * linux-fork.c: Include "arch-utils.h". + (info_forks_command): Update. + * m2-valprint.c (print_function_pointer_address, + print_unpacked_pointer, print_variable_at_address, + m2_val_print): Update. + * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): + Update. + * printcmd.c (print_address, print_address_demangle, address_info): + Update. + * p-valprint.c (pascal_val_print): Update. + * source.c: Include "arch-utils.h". + (line_info): Update. + * stack.c (frame_info, print_block_frame_labels): Update. + * symfile.c (add_symbol_file_command, list_overlays_command): Update. + * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, + print_symbol, print_partial_symbols, maintenance_info_psymtabs, + maintenance_check_symtabs): Update. + * symtab.c (find_pc_sect_symtab): Update. + * target.c (deprecated_debug_xfer_memory): Update. + * tracepoint.c (scope_info): Update. + * tui/tui-stack.c (tui_make_status_line): Update. + * valprint.c (val_print_string): Update. + + Update callers of paddr_nz to use paddress instead (keeping + user-visible output identical): + * alpha-tdep.c (alpha_heuristic_proc_start): Update. + * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, + amd64_displaced_step_fixup): Update. + * arch-utils.c (simple_displaced_step_copy_insn): Update. + * auxv.c (fprint_target_auxv): Update. + * breakpoint.c (insert_single_step_breakpoint): Update. + * buildsym.c (finish_block): Update. + * cli/cli-dump.c (restore_section_callback): Update. + * fbsd-nat.c (fbsd_find_memory_regions): Update. + * frame.c (frame_unwind_register_value): Update. + * gcore.c (gcore_create_callback): Update. + * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. + * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, + i386_record_lea_modrm_addr, i386_record_lea_modrm, + i386_process_record): Update. + * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, + ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, + ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. + * infrun.c (displaced_step_prepare, displaced_step_fixup, + handle_inferior_event, insert_step_resume_breakpoint_at_sal, + insert_longjmp_resume_breakpoint): Update. + * linux-nat.c (linux_nat_find_memory_regions): Update. + * linux-record.c (record_linux_system_call): Update. + * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, + mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, + mips_o64_push_dummy_call): Update. + * monitor.c (monitor_error, monitor_remove_breakpoint): Update. + * record.c (record_arch_list_add_mem, record_wait, + record_xfer_partial): Update. + * remote-mips.c (mips_fetch_word, mips_check_lsi_error, + mips_common_breakpoint): Update. + * remote-sim.c (gdbsim_xfer_inferior_memory): Update. + * rs6000-tdep.c (ppc_displaced_step_fixup): Update. + * solib-som.c (som_current_sos): Update. + * symfile.c (load_progress, generic_load): Update. + * symfile-mem.c (add_vsyscall_page): Update. + * valops.c (value_fetch_lazy): Update. + * windows-tdep.c (windows_xfer_shared_library): Update. + + Update callers of paddr_nz to use paddress instead (changing + user-visible output to make it more correct): + * dwarf2loc.c (locexpr_describe_location): Update. + * ia64-tdep.c (ia64_memory_insert_breakpoint, + ia64_memory_remove_breakpoint): Update. + * jv-valprint.c (java_value_print): Update. + * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. + * monitor.c (monitor_read_memory): Update. + + Update callers of paddr to use paddress instead (changing + user-visible output to make it more correct): + * arm-tdep.c (arm_push_dummy_call): Update. + * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, + create_breakpoint): Update. + * darwin-nat-info.c (darwin_debug_regions): Update. + * dcache.c (dcache_info): Update. + * dsrec.c (load_srec, make_srec): Update. + * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, + dwarf2_frame_cache): Update. + * gcore.c (gcore_copy_callback): Update. + * gnu-nat.c (gnu_xfer_memory): Update. + * mips-linux-nat.c (mips_show_dr): Update. + * monitor.c (monitor_write_memory, monitor_insert_breakpoint, + monitor_remove_breakpoint): Update. + * remote.c (compare_sections_command): Update. + * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, + m32r_remove_breakpoint, m32r_insert_watchpoint, + m32r_remove_watchpoint): Update. + * sol-thread.c (info_cb): Update. + * symfile.c (load_progress): Update. + + Update callers of paddress or paddr_nz to use hex_string instead + (changes output of internal/error/debug messages only): + * dwarf2read.c (dump_die_shallow): Update. + * frame.c (fprint_field, fprint_frame, frame_pc_unwind, + get_frame_func, create_new_frame): Update. + * hppa-tdep.c (find_unwind_entry, unwind_command): Update. + * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, + ia64_get_dyn_info_list): Update. + * maint.c (maintenance_translate_address): Update. + * mi/mi-cmd-var.c (mi_cmd_var_create): Update. + * target.c (target_flash_erase): Update. + + Update callers of paddr/paddr_nz to use phex/phex_nz instead, + using an appropriate address size. Remove use of strlen_paddr. + * exec.c (exec_files_info): Update. + * i386-nat.c (i386_show_dr): Update. + * remote.c (remote_flash_erase): Update. + * m32r-rom.c (m32r_load_section): Update. + * monitor.c (monitor_vsprintf, monitor_store_register): Update. + * remote.c (remote_check_symbols, remote_search_memory): Update. + * remote-mips.c (mips_request, mips_common_breakpoint): Update. + * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. + * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. + * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, + sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, + sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, + sh_dsp_show_regs): Update. + * xcoffsolib.c (sharedlibrary_command): Update. + + + * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. + Use hex_string_custom instead of paddr. + (print_bfd_section_info): Pass address size. + (print_objfile_section_info): Likewise. + + * annotate.h (annotate_source): Add GDBARCH parameter. + (annotate_frame_begin): Likewise. + * annotate.c (annotate_source): Add GDBARCH parameter. + (annotate_frame_begin): Likewise. + * source.c (identify_source_line): Update call to annotate_source. + * stack.c (print_frame_info, print_frame): Update call to + annotate_frame_begin. + + * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. + (create_breakpoint, create_ada_exception_breakpoint): Update call. + + * stack.c (print_block_frame_labels): Add GDBARCH parameter. + (print_frame_label_vars): Update call. + + * symmisc.c (print_partial_symbols): Add GDBARCH parameter. + (dump_psymtab): Update call to print_partial_symbols. + (struct print_symbol_args): Add GDBARCH member. + (dump_symtab_1): Set print_symbol_args architecture member. + (print_symbol): Use it. + + * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH + parameter. + * windows-tdep.c (windows_xfer_shared_library): Likewise. + * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. + (core_process_module_section): Pass architecture from cpms_data to + windows_xfer_shared_library. + (windows_core_xfer_shared_libraries): Initialize cmps_data + architecture member. + * windows-nat.c (windows_xfer_shared_libraries): Pass architecture + to windows_xfer_shared_library. + + * defs.h (print_address): Add GDBARCH parameter. + * printcmd.c (print_address): Add GDBARCH parameter. + (print_scalar_formatted, do_examine): Update call. + * findcmd.c (find_command): Update call. + * tracepoint.c: Include "arch-utils.h". + (trace_find_line_command): Update call. + * tui/tui-disasm.c (tui_disassemble): Update call. + + * value.h (print_address_demangle): Add GDBARCH parameter. + * printcmd.c (print_address_demangle): Add GDBARCH parameter. + * c-valprint.c (print_function_pointer_address, c_val_print): + Update call. + * f-valprint.c (f_val_print): Update call. + * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. + * jv-valprint.c (java_val_print): Update call. + * m2-valprint.c (print_function_pointer_address, m2_val_print): + Update call. + * p-valprint.c (pascal_val_print): Update call. + + * disasm.c (gdb_disassemble_info): Install architecture into + di.application_data field. + +2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> + * disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index e7ca5a9..2eac705 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10301,7 +10301,7 @@ print_one_exception (enum exception_catchpoint_kind ex, if (opts.addressprint) { annotate_field (4); - ui_out_field_core_addr (uiout, "addr", b->loc->address); + ui_out_field_core_addr (uiout, "addr", b->loc->gdbarch, b->loc->address); } annotate_field (5); diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 20eca50..68cc696 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -752,7 +752,8 @@ info_task (char *taskno_str, int from_tty) task_info = VEC_index (ada_task_info_s, task_list, taskno - 1); /* Print the Ada task ID. */ - printf_filtered (_("Ada Task: %s\n"), paddr_nz (task_info->task_id)); + printf_filtered (_("Ada Task: %s\n"), + paddress (target_gdbarch, task_info->task_id)); /* Print the name of the task. */ if (task_info->name[0] != '\0') diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 418ba44..adc8186 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -795,13 +795,12 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0, struct gdbarch *gdbarch = get_type_arch (type); struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; + CORE_ADDR addr = extract_typed_address (valaddr, ptr_type); fprintf_filtered (stream, "("); type_print (type, "", stream, -1); fprintf_filtered (stream, ") "); - fputs_filtered (paddress (extract_typed_address - (valaddr, ptr_type)), - stream); + fputs_filtered (paddress (gdbarch, addr), stream); } else { diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index ad12b3e..28ce8b1 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -959,10 +959,10 @@ alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc) if (fence == tdep->vm_min_address) warning (_("Hit beginning of text section without finding \ -enclosing function for address 0x%s"), paddr_nz (orig_pc)); +enclosing function for address %s"), paddress (gdbarch, orig_pc)); else warning (_("Hit heuristic-fence-post without finding \ -enclosing function for address 0x%s"), paddr_nz (orig_pc)); +enclosing function for address %s"), paddress (gdbarch, orig_pc)); if (!blurb_printed) { diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 59434e2..d39c5e0 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -1075,9 +1075,9 @@ fixup_riprel (struct gdbarch *gdbarch, struct displaced_step_closure *dsc, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, "displaced: %%rip-relative addressing used.\n" - "displaced: using temp reg %d, old value 0x%s, new value 0x%s\n", - dsc->tmp_regno, paddr_nz (dsc->tmp_save), - paddr_nz (rip_base)); + "displaced: using temp reg %d, old value %s, new value %s\n", + dsc->tmp_regno, paddress (gdbarch, dsc->tmp_save), + paddress (gdbarch, rip_base)); } static void @@ -1144,8 +1144,8 @@ amd64_displaced_step_copy_insn (struct gdbarch *gdbarch, if (debug_displaced) { - fprintf_unfiltered (gdb_stdlog, "displaced: copy 0x%s->0x%s: ", - paddr_nz (from), paddr_nz (to)); + fprintf_unfiltered (gdb_stdlog, "displaced: copy %s->%s: ", + paddress (gdbarch, from), paddress (gdbarch, to)); displaced_step_dump_bytes (gdb_stdlog, buf, len); } @@ -1258,17 +1258,18 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, - "displaced: fixup (0x%s, 0x%s), " + "displaced: fixup (%s, %s), " "insn = 0x%02x 0x%02x ...\n", - paddr_nz (from), paddr_nz (to), insn[0], insn[1]); + paddress (gdbarch, from), paddress (gdbarch, to), + insn[0], insn[1]); /* If we used a tmp reg, restore it. */ if (dsc->tmp_used) { if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: restoring reg %d to 0x%s\n", - dsc->tmp_regno, paddr_nz (dsc->tmp_save)); + fprintf_unfiltered (gdb_stdlog, "displaced: restoring reg %d to %s\n", + dsc->tmp_regno, paddress (gdbarch, dsc->tmp_save)); regcache_cooked_write_unsigned (regs, dsc->tmp_regno, dsc->tmp_save); } @@ -1332,8 +1333,9 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, "displaced: " - "relocated %%rip from 0x%s to 0x%s\n", - paddr_nz (orig_rip), paddr_nz (rip)); + "relocated %%rip from %s to %s\n", + paddress (gdbarch, orig_rip), + paddress (gdbarch, rip)); } } @@ -1358,10 +1360,10 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, - "displaced: relocated return addr at 0x%s " - "to 0x%s\n", - paddr_nz (rsp), - paddr_nz (retaddr)); + "displaced: relocated return addr at %s " + "to %s\n", + paddress (gdbarch, rsp), + paddress (gdbarch, retaddr)); } } diff --git a/gdb/annotate.c b/gdb/annotate.c index 707b1c0..6f52296 100644 --- a/gdb/annotate.c +++ b/gdb/annotate.c @@ -410,7 +410,8 @@ annotate_arg_end (void) } void -annotate_source (char *filename, int line, int character, int mid, CORE_ADDR pc) +annotate_source (char *filename, int line, int character, int mid, + struct gdbarch *gdbarch, CORE_ADDR pc) { if (annotation_level > 1) printf_filtered (("\n\032\032source ")); @@ -418,14 +419,15 @@ annotate_source (char *filename, int line, int character, int mid, CORE_ADDR pc) printf_filtered (("\032\032")); printf_filtered (("%s:%d:%d:%s:%s\n"), filename, line, character, - mid ? "middle" : "beg", paddress (pc)); + mid ? "middle" : "beg", paddress (gdbarch, pc)); } void -annotate_frame_begin (int level, CORE_ADDR pc) +annotate_frame_begin (int level, struct gdbarch *gdbarch, CORE_ADDR pc) { if (annotation_level > 1) - printf_filtered (("\n\032\032frame-begin %d %s\n"), level, paddress (pc)); + printf_filtered (("\n\032\032frame-begin %d %s\n"), + level, paddress (gdbarch, pc)); } void diff --git a/gdb/annotate.h b/gdb/annotate.h index 5c2b9eb..326a8db 100644 --- a/gdb/annotate.h +++ b/gdb/annotate.h @@ -76,9 +76,10 @@ extern void annotate_arg_name_end (void); extern void annotate_arg_value (struct type *); extern void annotate_arg_end (void); -extern void annotate_source (char *, int, int, int, CORE_ADDR); +extern void annotate_source (char *, int, int, int, + struct gdbarch *, CORE_ADDR); -extern void annotate_frame_begin (int, CORE_ADDR); +extern void annotate_frame_begin (int, struct gdbarch *, CORE_ADDR); extern void annotate_function_call (void); extern void annotate_signal_handler_caller (void); extern void annotate_frame_address (void); diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 76c96e5..996f149 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -51,8 +51,8 @@ simple_displaced_step_copy_insn (struct gdbarch *gdbarch, if (debug_displaced) { - fprintf_unfiltered (gdb_stdlog, "displaced: copy 0x%s->0x%s: ", - paddr_nz (from), paddr_nz (to)); + fprintf_unfiltered (gdb_stdlog, "displaced: copy %s->%s: ", + paddress (gdbarch, from), paddress (gdbarch, to)); displaced_step_dump_bytes (gdb_stdlog, buf, len); } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index ffc0863..bba869e 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1423,9 +1423,9 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (struct_return) { if (arm_debug) - fprintf_unfiltered (gdb_stdlog, "struct return in %s = 0x%s\n", + fprintf_unfiltered (gdb_stdlog, "struct return in %s = %s\n", gdbarch_register_name (gdbarch, argreg), - paddr (struct_addr)); + paddress (gdbarch, struct_addr)); regcache_cooked_write_unsigned (regcache, argreg, struct_addr); argreg++; } @@ -237,14 +237,14 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops) fprintf_filtered (file, "%s\n", plongest (val)); break; case hex: - fprintf_filtered (file, "0x%s\n", paddr_nz (val)); + fprintf_filtered (file, "%s\n", paddress (target_gdbarch, val)); break; case str: { struct value_print_options opts; get_user_print_options (&opts); if (opts.addressprint) - fprintf_filtered (file, "0x%s", paddr_nz (val)); + fprintf_filtered (file, "%s", paddress (target_gdbarch, val)); val_print_string (builtin_type (target_gdbarch)->builtin_char, val, -1, file, &opts); fprintf_filtered (file, "\n"); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index cb4c3d7..cbcc7df 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -117,7 +117,8 @@ static CORE_ADDR adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr, enum bptype bptype); -static void describe_other_breakpoints (CORE_ADDR, struct obj_section *, int); +static void describe_other_breakpoints (struct gdbarch *, CORE_ADDR, + struct obj_section *, int); static void breakpoints_info (char *, int); @@ -1140,7 +1141,7 @@ Note: automatically using hardware breakpoints for read-only addresses.\n")); else if (bpt->loc_type == bp_loc_software_breakpoint && mr->attrib.mode != MEM_RW) warning (_("cannot set software breakpoint at readonly address %s"), - paddr (bpt->address)); + paddress (bpt->gdbarch, bpt->address)); } } @@ -1240,7 +1241,8 @@ Note: automatically using hardware breakpoints for read-only addresses.\n")); bpt->owner->number); fprintf_filtered (tmp_error_stream, "Error accessing memory address "); - fputs_filtered (paddress (bpt->address), tmp_error_stream); + fputs_filtered (paddress (bpt->gdbarch, bpt->address), + tmp_error_stream); fprintf_filtered (tmp_error_stream, ": %s.\n", safe_strerror (val)); } @@ -3726,7 +3728,8 @@ print_one_breakpoint_location (struct breakpoint *b, else if (b->loc == NULL || loc->shlib_disabled) ui_out_field_string (uiout, "addr", "<PENDING>"); else - ui_out_field_core_addr (uiout, "addr", loc->address); + ui_out_field_core_addr (uiout, "addr", + loc->gdbarch, loc->address); } annotate_field (5); if (!header_of_multiple) @@ -3760,7 +3763,8 @@ print_one_breakpoint_location (struct breakpoint *b, ui_out_text (uiout, "\tstop only in stack frame at "); /* FIXME: cagney/2002-12-01: Shouldn't be poeking around inside the frame ID. */ - ui_out_field_core_addr (uiout, "frame", b->frame_id.stack_addr); + ui_out_field_core_addr (uiout, "frame", + b->gdbarch, b->frame_id.stack_addr); ui_out_text (uiout, "\n"); } @@ -4110,8 +4114,8 @@ breakpoint_has_pc (struct breakpoint *b, /* Print a message describing any breakpoints set at PC. */ static void -describe_other_breakpoints (CORE_ADDR pc, struct obj_section *section, - int thread) +describe_other_breakpoints (struct gdbarch *gdbarch, CORE_ADDR pc, + struct obj_section *section, int thread) { int others = 0; struct breakpoint *b; @@ -4144,7 +4148,7 @@ describe_other_breakpoints (CORE_ADDR pc, struct obj_section *section, : ((others == 1) ? " and" : "")); } printf_filtered (_("also set at pc ")); - fputs_filtered (paddress (pc), gdb_stdout); + fputs_filtered (paddress (gdbarch, pc), gdb_stdout); printf_filtered (".\n"); } } @@ -4606,7 +4610,8 @@ create_thread_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address) b->enable_state = bp_enabled; /* addr_string has to be used or breakpoint_re_set will delete me. */ - b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address)); + b->addr_string + = xstrprintf ("*%s", paddress (b->loc->gdbarch, b->loc->address)); update_global_location_list_nothrow (1); @@ -5289,7 +5294,8 @@ mention (struct breakpoint *b) if (opts.addressprint || b->source_file == NULL) { printf_filtered (" at "); - fputs_filtered (paddress (b->loc->address), gdb_stdout); + fputs_filtered (paddress (b->loc->gdbarch, b->loc->address), + gdb_stdout); } if (b->source_file) printf_filtered (": file %s, line %d.", @@ -5408,7 +5414,14 @@ create_breakpoint (struct gdbarch *gdbarch, struct bp_location *loc; if (from_tty) - describe_other_breakpoints (sal.pc, sal.section, thread); + { + struct gdbarch *loc_gdbarch = get_sal_arch (sal); + if (!loc_gdbarch) + loc_gdbarch = gdbarch; + + describe_other_breakpoints (loc_gdbarch, + sal.pc, sal.section, thread); + } if (i == 0) { @@ -5447,7 +5460,8 @@ create_breakpoint (struct gdbarch *gdbarch, else /* addr_string has to be used or breakpoint_re_set will delete me. */ - b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address)); + b->addr_string + = xstrprintf ("*%s", paddress (b->loc->gdbarch, b->loc->address)); b->ops = ops; mention (b); @@ -6859,7 +6873,8 @@ print_one_exception_catchpoint (struct breakpoint *b, struct bp_location **last_ if (b->loc == NULL || b->loc->shlib_disabled) ui_out_field_string (uiout, "addr", "<PENDING>"); else - ui_out_field_core_addr (uiout, "addr", b->loc->address); + ui_out_field_core_addr (uiout, "addr", + b->loc->gdbarch, b->loc->address); } annotate_field (5); if (b->loc) @@ -6980,7 +6995,11 @@ create_ada_exception_breakpoint (struct gdbarch *gdbarch, if (from_tty) { - describe_other_breakpoints (sal.pc, sal.section, -1); + struct gdbarch *loc_gdbarch = get_sal_arch (sal); + if (!loc_gdbarch) + loc_gdbarch = gdbarch; + + describe_other_breakpoints (loc_gdbarch, sal.pc, sal.section, -1); /* FIXME: brobecker/2006-12-28: Actually, re-implement a special version for exception catchpoints, because two catchpoints used for different exception names will use the same address. @@ -8386,8 +8405,8 @@ insert_single_step_breakpoint (struct gdbarch *gdbarch, CORE_ADDR next_pc) *bpt_p = deprecated_insert_raw_breakpoint (gdbarch, next_pc); if (*bpt_p == NULL) - error (_("Could not insert single-step breakpoint at 0x%s"), - paddr_nz (next_pc)); + error (_("Could not insert single-step breakpoint at %s"), + paddress (gdbarch, next_pc)); } /* Remove and delete any breakpoints used for software single step. */ diff --git a/gdb/buildsym.c b/gdb/buildsym.c index e1d2461..9324a14 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -235,6 +235,7 @@ finish_block (struct symbol *symbol, struct pending **listhead, CORE_ADDR start, CORE_ADDR end, struct objfile *objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct pending *next, *next1; struct block *block; struct pending_block *pblock; @@ -331,8 +332,9 @@ finish_block (struct symbol *symbol, struct pending **listhead, else { complaint (&symfile_complaints, - _("block end address 0x%s less than block start address 0x%s (patched it)"), - paddr_nz (BLOCK_END (block)), paddr_nz (BLOCK_START (block))); + _("block end address %s less than block start address %s (patched it)"), + paddress (gdbarch, BLOCK_END (block)), + paddress (gdbarch, BLOCK_START (block))); } /* Better than nothing */ BLOCK_END (block) = BLOCK_START (block); @@ -368,11 +370,11 @@ finish_block (struct symbol *symbol, struct pending **listhead, else { complaint (&symfile_complaints, - _("inner block (0x%s-0x%s) not inside outer block (0x%s-0x%s)"), - paddr_nz (BLOCK_START (pblock->block)), - paddr_nz (BLOCK_END (pblock->block)), - paddr_nz (BLOCK_START (block)), - paddr_nz (BLOCK_END (block))); + _("inner block (%s-%s) not inside outer block (%s-%s)"), + paddress (gdbarch, BLOCK_START (pblock->block)), + paddress (gdbarch, BLOCK_END (pblock->block)), + paddress (gdbarch, BLOCK_START (block)), + paddress (gdbarch, BLOCK_END (block))); } if (BLOCK_START (pblock->block) < BLOCK_START (block)) BLOCK_START (pblock->block) = BLOCK_START (block); diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 463ff4d..64b30c2 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -47,10 +47,10 @@ print_function_pointer_address (struct gdbarch *gdbarch, CORE_ADDR address, if (addressprint && func_addr != address) { fputs_filtered ("@", stream); - fputs_filtered (paddress (address), stream); + fputs_filtered (paddress (gdbarch, address), stream); fputs_filtered (": ", stream); } - print_address_demangle (func_addr, stream, demangle); + print_address_demangle (gdbarch, func_addr, stream, demangle); } @@ -272,7 +272,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, } if (options->addressprint) - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); /* For a pointer to a textual type, also print the string pointed to, unless pointer is null. */ @@ -342,7 +342,7 @@ c_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 (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); if (options->deref_ref) fputs_filtered (": ", stream); } @@ -440,7 +440,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ - print_address_demangle (address, stream, demangle); + print_address_demangle (gdbarch, address, stream, demangle); break; case TYPE_CODE_BOOL: diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index c9cdfbe..37b027b 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -672,17 +672,22 @@ edit_command (char *arg, int from_tty) of all known source files, not that user failed to give a filename. */ if (*arg == '*') { + struct gdbarch *gdbarch; if (sal.symtab == 0) /* FIXME-32x64--assumes sal.pc fits in long. */ error (_("No source file for address %s."), hex_string ((unsigned long) sal.pc)); + + gdbarch = get_objfile_arch (sal.symtab->objfile); sym = find_pc_function (sal.pc); if (sym) - printf_filtered ("%s is in %s (%s:%d).\n", paddress (sal.pc), - SYMBOL_PRINT_NAME (sym), sal.symtab->filename, - sal.line); + printf_filtered ("%s is in %s (%s:%d).\n", + paddress (gdbarch, sal.pc), + SYMBOL_PRINT_NAME (sym), + sal.symtab->filename, sal.line); else - printf_filtered ("%s is at %s:%d.\n", paddress (sal.pc), + printf_filtered ("%s is at %s:%d.\n", + paddress (gdbarch, sal.pc), sal.symtab->filename, sal.line); } @@ -832,17 +837,22 @@ list_command (char *arg, int from_tty) of all known source files, not that user failed to give a filename. */ if (*arg == '*') { + struct gdbarch *gdbarch; if (sal.symtab == 0) /* FIXME-32x64--assumes sal.pc fits in long. */ error (_("No source file for address %s."), hex_string ((unsigned long) sal.pc)); + + gdbarch = get_objfile_arch (sal.symtab->objfile); sym = find_pc_function (sal.pc); if (sym) printf_filtered ("%s is in %s (%s:%d).\n", - paddress (sal.pc), SYMBOL_PRINT_NAME (sym), + paddress (gdbarch, sal.pc), + SYMBOL_PRINT_NAME (sym), sal.symtab->filename, sal.line); else - printf_filtered ("%s is at %s:%d.\n", paddress (sal.pc), + printf_filtered ("%s is at %s:%d.\n", + paddress (gdbarch, sal.pc), sal.symtab->filename, sal.line); } @@ -904,7 +914,8 @@ print_disassembly (struct gdbarch *gdbarch, const char *name, if (name != NULL) printf_filtered ("for function %s:\n", name); else - printf_filtered ("from %s to %s:\n", paddress (low), paddress (high)); + printf_filtered ("from %s to %s:\n", + paddress (gdbarch, low), paddress (gdbarch, high)); /* Dump the specified range. */ gdb_disassembly (gdbarch, uiout, 0, mixed, -1, low, high); diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 82062a1..79d468e 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -488,11 +488,13 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args) (unsigned long) sec_end); if (data->load_offset != 0 || data->load_start != 0 || data->load_end != 0) - printf_filtered (" into memory (0x%s to 0x%s)\n", - paddr_nz ((unsigned long) sec_start + printf_filtered (" into memory (%s to %s)\n", + paddress (target_gdbarch, + (unsigned long) sec_start + sec_offset + data->load_offset), - paddr_nz ((unsigned long) sec_start + sec_offset - + data->load_offset + sec_load_count)); + paddress (target_gdbarch, + (unsigned long) sec_start + sec_offset + + data->load_offset + sec_load_count)); else puts_filtered ("\n"); diff --git a/gdb/corefile.c b/gdb/corefile.c index e74630b..3039e8c 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -219,11 +219,11 @@ memory_error (int status, CORE_ADDR memaddr) bounds. */ throw_error (MEMORY_ERROR, _("Cannot access memory at address %s"), - paddress (memaddr)); + paddress (target_gdbarch, memaddr)); else throw_error (MEMORY_ERROR, _("Error accessing memory address %s: %s."), - paddress (memaddr), + paddress (target_gdbarch, memaddr), safe_strerror (status)); } diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c index bcedce0..60f2e45 100644 --- a/gdb/darwin-nat-info.c +++ b/gdb/darwin-nat-info.c @@ -576,8 +576,8 @@ darwin_debug_regions (task_t task, mach_vm_address_t address, int max) if (print) { printf_filtered (_("%s-%s %s/%s %s %s %s"), - paddr(prev_address), - paddr(prev_address + prev_size), + paddress (target_gdbarch, prev_address), + paddress (target_gdbarch, prev_address + prev_size), unparse_protection (prev_info.protection), unparse_protection (prev_info.max_protection), unparse_inheritance (prev_info.inheritance), @@ -661,8 +661,8 @@ darwin_debug_regions_recurse (task_t task) break; row_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "regions-row"); - ui_out_field_core_addr (uiout, "start", r_start); - ui_out_field_core_addr (uiout, "end", r_start + r_size); + ui_out_field_core_addr (uiout, "start", target_gdbarch, r_start); + ui_out_field_core_addr (uiout, "end", target_gdbarch, r_start + r_size); ui_out_field_string (uiout, "min-prot", unparse_protection (r_info.protection)); ui_out_field_string (uiout, "max-prot", diff --git a/gdb/dcache.c b/gdb/dcache.c index ae5a479..30776e9 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -569,7 +569,7 @@ dcache_info (char *exp, int tty) { int j; printf_filtered (_("Line at %s, referenced %d times\n"), - paddr (p->addr), p->refs); + paddress (target_gdbarch, p->addr), p->refs); for (j = 0; j < LINE_SIZE; j++) printf_filtered ("%02x", p->data[j] & 0xFF); @@ -515,14 +515,9 @@ extern void gdb_print_host_address (const void *addr, struct ui_file *stream); extern const char *host_address_to_string (const void *addr); -/* Convert a CORE_ADDR into a HEX string. paddr() is like %08lx. - paddr_nz() is like %lx. */ -extern int strlen_paddr (void); -extern char *paddr (CORE_ADDR addr); -extern char *paddr_nz (CORE_ADDR addr); - -/* Like 0x%lx. */ -extern const char *paddress (CORE_ADDR addr); +/* Convert CORE_ADDR to string in platform-specific manner. + This is usually formatted similar to 0x%lx. */ +extern const char *paddress (struct gdbarch *gdbarch, CORE_ADDR addr); /* %d for LONGEST */ extern char *plongest (LONGEST l); @@ -533,8 +528,8 @@ extern char *phex (ULONGEST l, int sizeof_l); extern char *phex_nz (ULONGEST l, int sizeof_l); extern char *int_string (LONGEST, int, int, int, int); -/* Like paddr() only print/scan raw CORE_ADDR. The output from - core_addr_to_string() can be passed direct to +/* Convert a CORE_ADDR into a HEX string with leading zeros. + The output from core_addr_to_string() can be passed direct to string_to_core_addr(). */ extern const char *core_addr_to_string (const CORE_ADDR addr); extern const char *core_addr_to_string_nz (const CORE_ADDR addr); @@ -612,7 +607,7 @@ extern int build_address_symbolic (CORE_ADDR addr, int *line, int *unmapped); -extern void print_address (CORE_ADDR, struct ui_file *); +extern void print_address (struct gdbarch *, CORE_ADDR, struct ui_file *); /* From source.c */ diff --git a/gdb/disasm.c b/gdb/disasm.c index 8812b1c..dcb0633 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -63,7 +63,8 @@ dis_asm_memory_error (int status, bfd_vma memaddr, static void dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) { - print_address (addr, info->stream); + struct gdbarch *gdbarch = info->application_data; + print_address (gdbarch, addr, info->stream); } static int @@ -112,7 +113,7 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, num_displayed++; } ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_core_addr (uiout, "address", pc); + ui_out_field_core_addr (uiout, "address", gdbarch, pc); if (!build_address_symbolic (pc, 0, &name, &offset, &filename, &line, &unmapped)) @@ -347,6 +348,7 @@ gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file) di.mach = gdbarch_bfd_arch_info (gdbarch)->mach; di.endian = gdbarch_byte_order (gdbarch); di.endian_code = gdbarch_byte_order_for_code (gdbarch); + di.application_data = gdbarch; disassemble_init_for_target (&di); return di; } diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index d3ee3c5..f5d4950 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,6 +1,11 @@ 2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> - * gdbint.texi (Examples of Use of @code{ui_out} functions): + * gdbint.texinfo (Item Output Functions): Update signature + for ui_out_field_core_addr. + +2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> + + * gdbint.texinfo (Examples of Use of @code{ui_out} functions): Update example code extrated from breakpoint.c. 2009-06-28 Paul Pluzhnikov <ppluzhnikov@google.com> diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 8df45c6..a51f077 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -1400,8 +1400,8 @@ This function outputs a value of an @code{int} variable. It differs from the name of the field. @end deftypefun -@deftypefun void ui_out_field_core_addr (struct ui_out *@var{uiout}, const char *@var{fldname}, CORE_ADDR @var{address}) -This function outputs an address. +@deftypefun void ui_out_field_core_addr (struct ui_out *@var{uiout}, const char *@var{fldname}, struct gdbarch *@var{gdbarch}, CORE_ADDR @var{address}) +This function outputs an address as appropriate for @var{gdbarch}. @end deftypefun @deftypefun void ui_out_field_string (struct ui_out *@var{uiout}, const char *@var{fldname}, const char *@var{string}) diff --git a/gdb/dsrec.c b/gdb/dsrec.c index 94ccca9..60f2898 100644 --- a/gdb/dsrec.c +++ b/gdb/dsrec.c @@ -97,10 +97,10 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset, In the below, GDB's is used so that the address is consistent with the rest of GDB. BFD's printf_vma() could have also been used. cagney 1999-09-01 */ - printf_filtered ("%s\t: 0x%s .. 0x%s ", + printf_filtered ("%s\t: %s .. %s ", section_name, - paddr (addr), - paddr (addr + size)); + paddress (target_gdbarch, addr), + paddress (target_gdbarch, addr + size)); gdb_flush (gdb_stdout); data_count += size; @@ -252,8 +252,8 @@ make_srec (char *srec, CORE_ADDR targ_addr, bfd *abfd, asection *sect, addr_size = 4; else internal_error (__FILE__, __LINE__, - _("make_srec: Bad address (0x%s), or bad flags (0x%x)."), - paddr (targ_addr), flags); + _("make_srec: Bad address (%s), or bad flags (0x%x)."), + paddress (target_gdbarch, targ_addr), flags); /* Now that we know the address size, we can figure out how much data this record can hold. */ diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 315d349..fb5b08b 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -334,11 +334,11 @@ dwarf2_restore_rule (struct gdbarch *gdbarch, ULONGEST reg_num, if (fs->regs.reg[reg].how == DWARF2_FRAME_REG_UNSPECIFIED) complaint (&symfile_complaints, _("\ incomplete CFI data; DW_CFA_restore unspecified\n\ -register %s (#%d) at 0x%s"), +register %s (#%d) at %s"), gdbarch_register_name (gdbarch, gdbarch_dwarf2_reg_to_regnum (gdbarch, reg)), gdbarch_dwarf2_reg_to_regnum (gdbarch, reg), - paddr (fs->pc)); + paddress (gdbarch, fs->pc)); } static CORE_ADDR @@ -490,7 +490,8 @@ execute_cfa_program (struct dwarf2_fde *fde, gdb_byte *insn_ptr, if (old_rs == NULL) { complaint (&symfile_complaints, _("\ -bad CFI data; mismatched DW_CFA_restore_state at 0x%s"), paddr (fs->pc)); +bad CFI data; mismatched DW_CFA_restore_state at %s"), + paddress (gdbarch, fs->pc)); } else { @@ -997,9 +998,9 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache) { if (cache->reg[regnum].how == DWARF2_FRAME_REG_UNSPECIFIED) complaint (&symfile_complaints, _("\ -incomplete CFI data; unspecified registers (e.g., %s) at 0x%s"), +incomplete CFI data; unspecified registers (e.g., %s) at %s"), gdbarch_register_name (gdbarch, regnum), - paddr_nz (fs->pc)); + paddress (gdbarch, fs->pc)); } else cache->reg[regnum] = fs->regs.reg[column]; diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index f0f59e8..027e135 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -508,7 +508,7 @@ locexpr_describe_location (struct symbol *symbol, struct ui_file *stream) fprintf_filtered (stream, "a thread-local variable at offset %s in the " "thread-local storage for `%s'", - paddr_nz (offset), objfile->name); + paddress (gdbarch, offset), objfile->name); return 1; } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 4b5f195..03c7855 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9534,7 +9534,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) case DW_FORM_ref_addr: case DW_FORM_addr: fprintf_unfiltered (f, "address: "); - fputs_filtered (paddress (DW_ADDR (&die->attrs[i])), f); + fputs_filtered (hex_string (DW_ADDR (&die->attrs[i])), f); break; case DW_FORM_block2: case DW_FORM_block4: @@ -647,16 +647,17 @@ exec_xfer_partial (struct target_ops *ops, enum target_object object, void print_section_info (struct target_section_table *t, bfd *abfd) { + struct gdbarch *gdbarch = gdbarch_from_bfd (abfd); struct target_section *p; /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */ - int wid = gdbarch_addr_bit (gdbarch_from_bfd (abfd)) <= 32 ? 8 : 16; + int wid = gdbarch_addr_bit (gdbarch) <= 32 ? 8 : 16; printf_filtered ("\t`%s', ", bfd_get_filename (abfd)); wrap_here (" "); printf_filtered (_("file type %s.\n"), bfd_get_target (abfd)); if (abfd == exec_bfd) printf_filtered (_("\tEntry point: %s\n"), - paddress (bfd_get_start_address (abfd))); + paddress (gdbarch, bfd_get_start_address (abfd))); for (p = t->sections; p < t->sections_end; p++) { printf_filtered ("\t%s", hex_string_custom (p->addr, wid)); @@ -685,23 +686,24 @@ exec_files_info (struct target_ops *t) if (vmap) { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; struct vmap *vp; printf_unfiltered (_("\tMapping info for file `%s'.\n"), vmap->name); printf_unfiltered ("\t %*s %*s %*s %*s %8.8s %s\n", - strlen_paddr (), "tstart", - strlen_paddr (), "tend", - strlen_paddr (), "dstart", - strlen_paddr (), "dend", + addr_size * 2, "tstart", + addr_size * 2, "tend", + addr_size * 2, "dstart", + addr_size * 2, "dend", "section", "file(member)"); for (vp = vmap; vp; vp = vp->nxt) printf_unfiltered ("\t0x%s 0x%s 0x%s 0x%s %s%s%s%s\n", - paddr (vp->tstart), - paddr (vp->tend), - paddr (vp->dstart), - paddr (vp->dend), + phex (vp->tstart, addr_size), + phex (vp->tend, addr_size), + phex (vp->dstart, addr_size), + phex (vp->dend, addr_size), vp->name, *vp->member ? "(" : "", vp->member, *vp->member ? ")" : ""); diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 7de15cb..c6b4044 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -281,13 +281,13 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, if (TYPE_CODE (elttype) == TYPE_CODE_FUNC) { /* Try to print what function it points to. */ - print_address_demangle (addr, stream, demangle); + print_address_demangle (gdbarch, addr, stream, demangle); /* Return value is irrelevant except for string pointers. */ return 0; } if (options->addressprint && options->format != 's') - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); /* For a pointer to char or unsigned char, also print the string pointed to, unless pointer is null. */ @@ -312,7 +312,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 (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); if (options->deref_ref) fputs_filtered (": ", stream); } @@ -345,7 +345,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ - print_address_demangle (address, stream, demangle); + print_address_demangle (gdbarch, address, stream, demangle); break; case TYPE_CODE_INT: diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 2053fd3..2380e2e 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -127,8 +127,8 @@ fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long, if (info_verbose) { fprintf_filtered (gdb_stdout, - "Save segment, %ld bytes at 0x%s (%c%c%c)\n", - size, paddr_nz (start), + "Save segment, %ld bytes at %s (%c%c%c)\n", + size, paddress (target_gdbarch, start), read ? 'r' : '-', write ? 'w' : '-', exec ? 'x' : '-'); diff --git a/gdb/findcmd.c b/gdb/findcmd.c index b701d93..1d28914 100644 --- a/gdb/findcmd.c +++ b/gdb/findcmd.c @@ -276,7 +276,7 @@ find_command (char *args, int from_tty) if (found <= 0) break; - print_address (found_addr, gdb_stdout); + print_address (gdbarch, found_addr, gdb_stdout); printf_filtered ("\n"); ++found_count; last_found_addr = found_addr; diff --git a/gdb/frame.c b/gdb/frame.c index 9a06959..ebc7ffb 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -169,7 +169,7 @@ static void fprint_field (struct ui_file *file, const char *name, int p, CORE_ADDR addr) { if (p) - fprintf_unfiltered (file, "%s=0x%s", name, paddr_nz (addr)); + fprintf_unfiltered (file, "%s=%s", name, hex_string (addr)); else fprintf_unfiltered (file, "!%s", name); } @@ -242,7 +242,7 @@ fprint_frame (struct ui_file *file, struct frame_info *fi) fprintf_unfiltered (file, ","); fprintf_unfiltered (file, "pc="); if (fi->next != NULL && fi->next->prev_pc.p) - fprintf_unfiltered (file, "0x%s", paddr_nz (fi->next->prev_pc.value)); + fprintf_unfiltered (file, "%s", hex_string (fi->next->prev_pc.value)); else fprintf_unfiltered (file, "<unknown>"); fprintf_unfiltered (file, ","); @@ -254,7 +254,7 @@ fprint_frame (struct ui_file *file, struct frame_info *fi) fprintf_unfiltered (file, ","); fprintf_unfiltered (file, "func="); if (fi->next != NULL && fi->next->prev_func.p) - fprintf_unfiltered (file, "0x%s", paddr_nz (fi->next->prev_func.addr)); + fprintf_unfiltered (file, "%s", hex_string (fi->next->prev_func.addr)); else fprintf_unfiltered (file, "<unknown>"); fprintf_unfiltered (file, "}"); @@ -573,7 +573,7 @@ frame_unwind_pc (struct frame_info *this_frame) fprintf_unfiltered (gdb_stdlog, "{ frame_unwind_caller_pc (this_frame=%d) -> 0x%s }\n", this_frame->level, - paddr_nz (this_frame->prev_pc.value)); + hex_string (this_frame->prev_pc.value)); } return this_frame->prev_pc.value; } @@ -598,9 +598,9 @@ get_frame_func (struct frame_info *this_frame) next_frame->prev_func.addr = get_pc_function_start (addr_in_block); if (frame_debug) fprintf_unfiltered (gdb_stdlog, - "{ get_frame_func (this_frame=%d) -> 0x%s }\n", + "{ get_frame_func (this_frame=%d) -> %s }\n", this_frame->level, - paddr_nz (next_frame->prev_func.addr)); + hex_string (next_frame->prev_func.addr)); } return next_frame->prev_func.addr; } @@ -774,8 +774,9 @@ frame_unwind_register_value (struct frame_info *frame, int regnum) fprintf_unfiltered (gdb_stdlog, " register=%d", VALUE_REGNUM (value)); else if (VALUE_LVAL (value) == lval_memory) - fprintf_unfiltered (gdb_stdlog, " address=0x%s", - paddr_nz (value_address (value))); + fprintf_unfiltered (gdb_stdlog, " address=%s", + paddress (gdbarch, + value_address (value))); else fprintf_unfiltered (gdb_stdlog, " computed"); @@ -1202,8 +1203,8 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) if (frame_debug) { fprintf_unfiltered (gdb_stdlog, - "{ create_new_frame (addr=0x%s, pc=0x%s) ", - paddr_nz (addr), paddr_nz (pc)); + "{ create_new_frame (addr=%s, pc=%s) ", + hex_string (addr), hex_string (pc)); } fi = FRAME_OBSTACK_ZALLOC (struct frame_info); diff --git a/gdb/gcore.c b/gdb/gcore.c index b227721..5bc38e2 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -331,8 +331,8 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, { if (info_verbose) { - fprintf_filtered (gdb_stdout, "Ignore segment, %s bytes at 0x%s\n", - plongest (size), paddr_nz (vaddr)); + fprintf_filtered (gdb_stdout, "Ignore segment, %s bytes at %s\n", + plongest (size), paddress (target_gdbarch, vaddr)); } return 0; @@ -389,8 +389,8 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, if (info_verbose) { - fprintf_filtered (gdb_stdout, "Save segment, %s bytes at 0x%s\n", - plongest (size), paddr_nz (vaddr)); + fprintf_filtered (gdb_stdout, "Save segment, %s bytes at %s\n", + plongest (size), paddress (target_gdbarch, vaddr)); } bfd_set_section_size (obfd, osec, size); @@ -482,8 +482,9 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored) if (target_read_memory (bfd_section_vma (obfd, osec) + offset, memhunk, size) != 0) { - warning (_("Memory read failed for corefile section, %s bytes at 0x%s."), - plongest (size), paddr (bfd_section_vma (obfd, osec))); + warning (_("Memory read failed for corefile section, %s bytes at %s."), + plongest (size), + paddress (target_gdbarch, bfd_section_vma (obfd, osec))); break; } if (!bfd_set_section_contents (obfd, osec, memhunk, offset, size)) diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index c7db801..a165808 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2492,7 +2492,8 @@ gnu_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write, else { inf_debug (gnu_current_inf, "%s %s[%d] %s %s", - write ? "writing" : "reading", paddr (memaddr), len, + write ? "writing" : "reading", + paddress (target_gdbarch, memaddr), len, write ? "<--" : "-->", host_address_to_string (myaddr)); if (write) return gnu_write_inferior (task, memaddr, myaddr, len); diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 0afb2f9..b056767 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -604,7 +604,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents, print_longest (stream, 'd', 1, ptr_value); } else - print_address_demangle (ptr_value, stream, demangle); + print_address_demangle (gdbarch, ptr_value, stream, demangle); if (adjustment) { diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 08b1b66..6d70c6d 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -461,8 +461,8 @@ find_unwind_entry (CORE_ADDR pc) struct hppa_objfile_private *priv; if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, "{ find_unwind_entry 0x%s -> ", - paddr_nz (pc)); + fprintf_unfiltered (gdb_stdlog, "{ find_unwind_entry %s -> ", + hex_string (pc)); /* A function at address 0? Not in HP-UX! */ if (pc == (CORE_ADDR) 0) @@ -496,8 +496,8 @@ find_unwind_entry (CORE_ADDR pc) && pc <= ui->cache->region_end) { if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, "0x%s (cached) }\n", - paddr_nz ((uintptr_t) ui->cache)); + fprintf_unfiltered (gdb_stdlog, "%s (cached) }\n", + hex_string ((uintptr_t) ui->cache)); return ui->cache; } @@ -514,8 +514,8 @@ find_unwind_entry (CORE_ADDR pc) { ui->cache = &ui->table[middle]; if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, "0x%s }\n", - paddr_nz ((uintptr_t) ui->cache)); + fprintf_unfiltered (gdb_stdlog, "%s }\n", + hex_string ((uintptr_t) ui->cache)); return &ui->table[middle]; } @@ -1833,8 +1833,8 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache) if ((*this_cache) != NULL) { if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, "base=0x%s (cached) }", - paddr_nz (((struct hppa_frame_cache *)*this_cache)->base)); + fprintf_unfiltered (gdb_stdlog, "base=%s (cached) }", + paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base)); return (*this_cache); } cache = FRAME_OBSTACK_ZALLOC (struct hppa_frame_cache); @@ -1935,7 +1935,8 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache) if (!safe_frame_unwind_memory (this_frame, pc, buf4, sizeof buf4)) { - error (_("Cannot read instruction at 0x%s."), paddr_nz (pc)); + error (_("Cannot read instruction at %s."), + paddress (gdbarch, pc)); return (*this_cache); } @@ -2064,11 +2065,11 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache) CORE_ADDR fp; if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, " (this_sp=0x%s, pc=0x%s, " - "prologue_end=0x%s) ", - paddr_nz (this_sp), - paddr_nz (get_frame_pc (this_frame)), - paddr_nz (prologue_end)); + fprintf_unfiltered (gdb_stdlog, " (this_sp=%s, pc=%s, " + "prologue_end=%s) ", + paddress (gdbarch, this_sp), + paddress (gdbarch, get_frame_pc (this_frame)), + paddress (gdbarch, prologue_end)); /* Check to see if a frame pointer is available, and use it for frame unwinding if it is. @@ -2099,8 +2100,8 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache) cache->base = fp; if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, " (base=0x%s) [frame pointer]", - paddr_nz (cache->base)); + fprintf_unfiltered (gdb_stdlog, " (base=%s) [frame pointer]", + paddress (gdbarch, cache->base)); } else if (u->Save_SP && trad_frame_addr_p (cache->saved_regs, HPPA_SP_REGNUM)) @@ -2112,8 +2113,8 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache) (this_sp, gdbarch_ptr_bit (gdbarch) / 8); if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, " (base=0x%s) [saved]", - paddr_nz (cache->base)); + fprintf_unfiltered (gdb_stdlog, " (base=%s) [saved]", + paddress (gdbarch, cache->base)); } else { @@ -2121,8 +2122,8 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache) the SP back. */ cache->base = this_sp - frame_size; if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, " (base=0x%s) [unwind adjust]", - paddr_nz (cache->base)); + fprintf_unfiltered (gdb_stdlog, " (base=%s) [unwind adjust]", + paddress (gdbarch, cache->base)); } trad_frame_set_value (cache->saved_regs, HPPA_SP_REGNUM, cache->base); @@ -2206,8 +2207,8 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache) } if (hppa_debug) - fprintf_unfiltered (gdb_stdlog, "base=0x%s }", - paddr_nz (((struct hppa_frame_cache *)*this_cache)->base)); + fprintf_unfiltered (gdb_stdlog, "base=%s }", + paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base)); return (*this_cache); } @@ -2533,12 +2534,10 @@ unwind_command (char *exp, int from_tty) printf_unfiltered ("unwind_table_entry (0x%lx):\n", (unsigned long)u); - printf_unfiltered ("\tregion_start = "); - print_address (u->region_start, gdb_stdout); + printf_unfiltered ("\tregion_start = %s\n", hex_string (u->region_start)); gdb_flush (gdb_stdout); - printf_unfiltered ("\n\tregion_end = "); - print_address (u->region_end, gdb_stdout); + printf_unfiltered ("\tregion_end = %s\n", hex_string (u->region_end)); gdb_flush (gdb_stdout); #define pif(FLD) if (u->FLD) printf_unfiltered (" "#FLD); @@ -2943,7 +2942,8 @@ hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) /* Sanity check: are we pointing to the PLT stub? */ if (!hppa_match_insns (pc, hppa_plt_stub, insn)) { - warning (_("Cannot resolve PLT stub at 0x%s."), paddr_nz (pc)); + warning (_("Cannot resolve PLT stub at %s."), + paddress (gdbarch, pc)); return 0; } diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index af1db70..a0b0ba6 100644 --- a/gdb/i386-cygwin-tdep.c +++ b/gdb/i386-cygwin-tdep.c @@ -113,6 +113,7 @@ i386_windows_regset_from_core_section (struct gdbarch *gdbarch, struct cpms_data { + struct gdbarch *gdbarch; struct obstack *obstack; int module_count; }; @@ -157,7 +158,8 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) /* The first module is the .exe itself. */ if (data->module_count != 0) - windows_xfer_shared_library (module_name, base_addr, data->obstack); + windows_xfer_shared_library (module_name, base_addr, + data->gdbarch, data->obstack); data->module_count++; out: @@ -174,7 +176,7 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch, struct obstack obstack; const char *buf; LONGEST len_avail; - struct cpms_data data = { &obstack, 0 }; + struct cpms_data data = { gdbarch, &obstack, 0 }; obstack_init (&obstack); obstack_grow_str (&obstack, "<library-list>\n"); diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index d556875..ab1bd8a 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -217,6 +217,7 @@ static void i386_show_dr (const char *func, CORE_ADDR addr, int len, enum target_hw_bp_type type) { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; int i; puts_unfiltered (func); @@ -240,8 +241,8 @@ i386_show_dr (const char *func, CORE_ADDR addr, { printf_unfiltered ("\ \tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n", - i, paddr(dr_mirror[i]), dr_ref_count[i], - i+1, paddr(dr_mirror[i+1]), dr_ref_count[i+1]); + i, phex (dr_mirror[i], addr_size), dr_ref_count[i], + i+1, phex (dr_mirror[i+1], addr_size), dr_ref_count[i+1]); i++; } } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 6b7560f..8d5a537 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -428,9 +428,10 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, - "displaced: fixup (0x%s, 0x%s), " + "displaced: fixup (%s, %s), " "insn = 0x%02x 0x%02x ...\n", - paddr_nz (from), paddr_nz (to), insn[0], insn[1]); + paddress (gdbarch, from), paddress (gdbarch, to), + insn[0], insn[1]); /* The list of issues to contend with here is taken from resume_execution in arch/i386/kernel/kprobes.c, Linux 2.6.20. @@ -499,8 +500,9 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, "displaced: " - "relocated %%eip from 0x%s to 0x%s\n", - paddr_nz (orig_eip), paddr_nz (eip)); + "relocated %%eip from %s to %s\n", + paddress (gdbarch, orig_eip), + paddress (gdbarch, eip)); } } @@ -525,10 +527,9 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, - "displaced: relocated return addr at 0x%s " - "to 0x%s\n", - paddr_nz (esp), - paddr_nz (retaddr)); + "displaced: relocated return addr at %s to %s\n", + paddress (gdbarch, esp), + paddress (gdbarch, retaddr)); } } @@ -2764,12 +2765,14 @@ struct i386_record_s static int i386_record_modrm (struct i386_record_s *irp) { + struct gdbarch *gdbarch = get_regcache_arch (irp->regcache); + if (target_read_memory (irp->addr, &irp->modrm, 1)) { if (record_debug) printf_unfiltered (_("Process record: error reading memory at " - "addr 0x%s len = 1.\n"), - paddr_nz (irp->addr)); + "addr %s len = 1.\n"), + paddress (gdbarch, irp->addr)); return -1; } irp->addr++; @@ -2787,6 +2790,7 @@ i386_record_modrm (struct i386_record_s *irp) static int i386_record_lea_modrm_addr (struct i386_record_s *irp, uint32_t * addr) { + struct gdbarch *gdbarch = get_regcache_arch (irp->regcache); uint8_t tmpu8; uint16_t tmpu16; uint32_t tmpu32; @@ -2807,8 +2811,8 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint32_t * addr) { if (record_debug) printf_unfiltered (_("Process record: error reading memory " - "at addr 0x%s len = 1.\n"), - paddr_nz (irp->addr)); + "at addr %s len = 1.\n"), + paddress (gdbarch, irp->addr)); return -1; } irp->addr++; @@ -2827,8 +2831,8 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint32_t * addr) { if (record_debug) printf_unfiltered (_("Process record: error reading " - "memory at addr 0x%s len = 4.\n"), - paddr_nz (irp->addr)); + "memory at addr %s len = 4.\n"), + paddress (gdbarch, irp->addr)); return -1; } irp->addr += 4; @@ -2843,8 +2847,8 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint32_t * addr) { if (record_debug) printf_unfiltered (_("Process record: error reading memory " - "at addr 0x%s len = 1.\n"), - paddr_nz (irp->addr)); + "at addr %s len = 1.\n"), + paddress (gdbarch, irp->addr)); return -1; } irp->addr++; @@ -2855,8 +2859,8 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint32_t * addr) { if (record_debug) printf_unfiltered (_("Process record: error reading memory " - "at addr 0x%s len = 4.\n"), - paddr_nz (irp->addr)); + "at addr %s len = 4.\n"), + paddress (gdbarch, irp->addr)); return -1; } irp->addr += 4; @@ -2889,8 +2893,8 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint32_t * addr) { if (record_debug) printf_unfiltered (_("Process record: error reading " - "memory at addr 0x%s len = 2.\n"), - paddr_nz (irp->addr)); + "memory at addr %s len = 2.\n"), + paddress (gdbarch, irp->addr)); return -1; } irp->addr += 2; @@ -2908,8 +2912,8 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint32_t * addr) { if (record_debug) printf_unfiltered (_("Process record: error reading memory " - "at addr 0x%s len = 1.\n"), - paddr_nz (irp->addr)); + "at addr %s len = 1.\n"), + paddress (gdbarch, irp->addr)); return -1; } irp->addr++; @@ -2920,8 +2924,8 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint32_t * addr) { if (record_debug) printf_unfiltered (_("Process record: error reading memory " - "at addr 0x%s len = 2.\n"), - paddr_nz (irp->addr)); + "at addr %s len = 2.\n"), + paddress (gdbarch, irp->addr)); return -1; } irp->addr += 2; @@ -2998,15 +3002,16 @@ no_rm: static int i386_record_lea_modrm (struct i386_record_s *irp) { + struct gdbarch *gdbarch = get_regcache_arch (irp->regcache); uint32_t addr; if (irp->override) { if (record_debug) printf_unfiltered (_("Process record ignores the memory change " - "of instruction at address 0x%s because it " + "of instruction at address %s because it " "can't get the value of the segment register.\n"), - paddr_nz (irp->addr)); + paddress (gdbarch, irp->addr)); return 0; } @@ -3042,8 +3047,8 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache, if (record_debug > 1) fprintf_unfiltered (gdb_stdlog, "Process record: i386_process_record " - "addr = 0x%s\n", - paddr_nz (ir.addr)); + "addr = %s\n", + paddress (gdbarch, ir.addr)); /* prefixes */ while (1) @@ -3052,8 +3057,8 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache, { if (record_debug) printf_unfiltered (_("Process record: error reading memory at " - "addr 0x%s len = 1.\n"), - paddr_nz (ir.addr)); + "addr %s len = 1.\n"), + paddress (gdbarch, ir.addr)); return -1; } ir.addr++; @@ -3113,8 +3118,8 @@ reswitch: { if (record_debug) printf_unfiltered (_("Process record: error reading memory at " - "addr 0x%s len = 1.\n"), - paddr_nz (ir.addr)); + "addr %s len = 1.\n"), + paddress (gdbarch, ir.addr)); return -1; } ir.addr++; @@ -3852,10 +3857,10 @@ reswitch: { if (record_debug) printf_unfiltered (_("Process record ignores the memory change " - "of instruction at address 0x%s because " + "of instruction at address %s because " "it can't get the value of the segment " "register.\n"), - paddr_nz (ir.addr)); + paddress (gdbarch, ir.addr)); } else { @@ -3870,8 +3875,8 @@ reswitch: { if (record_debug) printf_unfiltered (_("Process record: error reading " - "memory at addr 0x%s len = 4.\n"), - paddr_nz (ir.addr)); + "memory at addr %s len = 4.\n"), + paddress (gdbarch, ir.addr)); return -1; } ir.addr += 4; @@ -3883,8 +3888,8 @@ reswitch: { if (record_debug) printf_unfiltered (_("Process record: error reading " - "memory at addr 0x%s len = 4.\n"), - paddr_nz (ir.addr)); + "memory at addr %s len = 4.\n"), + paddress (gdbarch, ir.addr)); return -1; } ir.addr += 2; @@ -4272,10 +4277,10 @@ reswitch: /* addr += ((uint32_t)read_register (I386_ES_REGNUM)) << 4; */ if (record_debug) printf_unfiltered (_("Process record ignores the memory change " - "of instruction at address 0x%s because " + "of instruction at address %s because " "it can't get the value of the segment " "register.\n"), - paddr_nz (ir.addr)); + paddress (gdbarch, ir.addr)); } if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ)) @@ -4681,8 +4686,8 @@ reswitch: { if (record_debug) printf_unfiltered (_("Process record: error reading memory " - "at addr 0x%s len = 1.\n"), - paddr_nz (ir.addr)); + "at addr %s len = 1.\n"), + paddress (gdbarch, ir.addr)); return -1; } ir.addr++; @@ -4889,10 +4894,10 @@ reswitch: if (record_debug) printf_unfiltered (_("Process record ignores the memory " "change of instruction at " - "address 0x%s because it can't get " + "address %s because it can't get " "the value of the segment " "register.\n"), - paddr_nz (ir.addr)); + paddress (gdbarch, ir.addr)); } else { @@ -4934,10 +4939,10 @@ reswitch: if (record_debug) printf_unfiltered (_("Process record ignores the memory " "change of instruction at " - "address 0x%s because it can't get " + "address %s because it can't get " "the value of the segment " "register.\n"), - paddr_nz (ir.addr)); + paddress (gdbarch, ir.addr)); } else { @@ -5122,8 +5127,8 @@ reswitch: no_support: printf_unfiltered (_("Process record doesn't support instruction 0x%02x " - "at address 0x%s.\n"), - (unsigned int) (opcode), paddr_nz (ir.addr)); + "at address %s.\n"), + (unsigned int) (opcode), paddress (gdbarch, ir.addr)); return -1; } diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index d5daf50..abb3610 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -650,7 +650,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch, if (instr_breakpoint == IA64_BREAKPOINT) internal_error (__FILE__, __LINE__, _("Address %s already contains a breakpoint."), - paddr_nz (bp_tgt->placed_address)); + paddress (gdbarch, bp_tgt->placed_address)); replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum); if (val == 0) @@ -697,7 +697,7 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch, { warning (_("Cannot remove breakpoint at address %s, " "no break instruction at such address."), - paddr_nz (bp_tgt->placed_address)); + paddress (gdbarch, bp_tgt->placed_address)); return -1; } @@ -1720,6 +1720,7 @@ static void ia64_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct ia64_frame_cache *cache = ia64_frame_cache (this_frame, this_cache); @@ -1730,10 +1731,10 @@ ia64_frame_this_id (struct frame_info *this_frame, void **this_cache, (*this_id) = frame_id_build_special (cache->base, cache->pc, cache->bsp); if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "regular frame id: code 0x%s, stack 0x%s, special 0x%s, this_frame %s\n", - paddr_nz (this_id->code_addr), - paddr_nz (this_id->stack_addr), - paddr_nz (cache->bsp), + "regular frame id: code %s, stack %s, special %s, this_frame %s\n", + paddress (gdbarch, this_id->code_addr), + paddress (gdbarch, this_id->stack_addr), + paddress (gdbarch, cache->bsp), host_address_to_string (this_frame)); } @@ -2078,6 +2079,7 @@ static void ia64_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct ia64_frame_cache *cache = ia64_sigtramp_frame_cache (this_frame, this_cache); @@ -2086,10 +2088,10 @@ ia64_sigtramp_frame_this_id (struct frame_info *this_frame, cache->bsp); if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "sigtramp frame id: code 0x%s, stack 0x%s, special 0x%s, this_frame %s\n", - paddr_nz (this_id->code_addr), - paddr_nz (this_id->stack_addr), - paddr_nz (cache->bsp), + "sigtramp frame id: code %s, stack %s, special %s, this_frame %s\n", + paddress (gdbarch, this_id->code_addr), + paddress (gdbarch, this_id->stack_addr), + paddress (gdbarch, cache->bsp), host_address_to_string (this_frame)); } @@ -2298,6 +2300,7 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val, int regnum = ia64_uw2gdb_regnum (uw_regnum); unw_word_t bsp, sof, sol, cfm, psr, ip; struct frame_info *this_frame = arg; + struct gdbarch *gdbarch = get_frame_arch (this_frame); long new_sof, old_sof; char buf[MAX_REGISTER_SIZE]; @@ -2344,10 +2347,10 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - " access_reg: from cache: %4s=0x%s\n", + " access_reg: from cache: %4s=%s\n", (((unsigned) regnum <= IA64_NAT127_REGNUM) ? ia64_register_names[regnum] : "r??"), - paddr_nz (*val)); + paddress (*val)); return 0; } @@ -2375,6 +2378,7 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *va int regnum = ia64_uw2gdb_regnum (uw_regnum); unw_word_t bsp, sof, sol, cfm, psr, ip; struct regcache *regcache = arg; + struct gdbarch *gdbarch = get_regcache_arch (regcache); long new_sof, old_sof; char buf[MAX_REGISTER_SIZE]; @@ -2421,10 +2425,10 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *va if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - " access_rse_reg: from cache: %4s=0x%s\n", + " access_rse_reg: from cache: %4s=%s\n", (((unsigned) regnum <= IA64_NAT127_REGNUM) ? ia64_register_names[regnum] : "r??"), - paddr_nz (*val)); + paddress (gdbarch, *val)); return 0; } @@ -2526,11 +2530,11 @@ get_kernel_table (unw_word_t ip, unw_dyn_info_t *di) if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, "get_kernel_table: found table `%s': " - "segbase=0x%s, length=%s, gp=0x%s\n", + "segbase=%s, length=%s, gp=%s\n", (char *) di->u.ti.name_ptr, - paddr_nz (di->u.ti.segbase), + hex_string (di->u.ti.segbase), pulongest (di->u.ti.table_len), - paddr_nz (di->gp)); + hex_string (di->gp)); return 0; } @@ -2631,15 +2635,15 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, return -UNW_ENOINFO; if (gdbarch_debug >= 1) - fprintf_unfiltered (gdb_stdlog, "ia64_find_proc_info_x: 0x%s -> " - "(name=`%s',segbase=0x%s,start=0x%s,end=0x%s,gp=0x%s," - "length=%s,data=0x%s)\n", - paddr_nz (ip), (char *)di.u.ti.name_ptr, - paddr_nz (di.u.ti.segbase), - paddr_nz (di.start_ip), paddr_nz (di.end_ip), - paddr_nz (di.gp), + fprintf_unfiltered (gdb_stdlog, "ia64_find_proc_info_x: %s -> " + "(name=`%s',segbase=%s,start=%s,end=%s,gp=%s," + "length=%s,data=%s)\n", + hex_string (ip), (char *)di.u.ti.name_ptr, + hex_string (di.u.ti.segbase), + hex_string (di.start_ip), hex_string (di.end_ip), + hex_string (di.gp), pulongest (di.u.ti.table_len), - paddr_nz ((CORE_ADDR)di.u.ti.table_data)); + hex_string ((CORE_ADDR)di.u.ti.table_data)); } else { @@ -2648,15 +2652,15 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, return ret; if (gdbarch_debug >= 1) - fprintf_unfiltered (gdb_stdlog, "ia64_find_proc_info_x: 0x%s -> " - "(name=`%s',segbase=0x%s,start=0x%s,end=0x%s,gp=0x%s," - "length=%s,data=0x%s)\n", - paddr_nz (ip), (char *)di.u.rti.name_ptr, - paddr_nz (di.u.rti.segbase), - paddr_nz (di.start_ip), paddr_nz (di.end_ip), - paddr_nz (di.gp), + fprintf_unfiltered (gdb_stdlog, "ia64_find_proc_info_x: %s -> " + "(name=`%s',segbase=%s,start=%s,end=%s,gp=%s," + "length=%s,data=%s)\n", + hex_string (ip), (char *)di.u.rti.name_ptr, + hex_string (di.u.rti.segbase), + hex_string (di.start_ip), hex_string (di.end_ip), + hex_string (di.gp), pulongest (di.u.rti.table_len), - paddr_nz (di.u.rti.table_data)); + hex_string (di.u.rti.table_data)); } ret = libunwind_search_unwind_table (&as, ip, &di, pi, need_unwind_info, @@ -2709,9 +2713,9 @@ ia64_get_dyn_info_list (unw_addr_space_t as, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, "dynamic unwind table in objfile %s " - "at 0x%s (gp=0x%s)\n", + "at %s (gp=%s)\n", bfd_get_filename (objfile->obfd), - paddr_nz (addr), paddr_nz (di.gp)); + hex_string (addr), hex_string (di.gp)); *dilap = addr; return 0; } @@ -2727,6 +2731,7 @@ static void ia64_libunwind_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct frame_id id; char buf[8]; CORE_ADDR bsp; @@ -2748,9 +2753,10 @@ ia64_libunwind_frame_this_id (struct frame_info *this_frame, void **this_cache, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "libunwind frame id: code 0x%s, stack 0x%s, special 0x%s, this_frame %s\n", - paddr_nz (id.code_addr), paddr_nz (id.stack_addr), - paddr_nz (bsp), + "libunwind frame id: code %s, stack %s, special %s, this_frame %s\n", + paddress (gdbarch, id.code_addr), + paddress (gdbarch, id.stack_addr), + paddress (gdbarch, bsp), host_address_to_string (this_frame)); } @@ -2852,6 +2858,7 @@ ia64_libunwind_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { + struct gdbarch *gdbarch = get_frame_arch (this_frame); char buf[8]; CORE_ADDR bsp; struct frame_id id; @@ -2874,9 +2881,10 @@ ia64_libunwind_sigtramp_frame_this_id (struct frame_info *this_frame, if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "libunwind sigtramp frame id: code 0x%s, stack 0x%s, special 0x%s, this_frame %s\n", - paddr_nz (id.code_addr), paddr_nz (id.stack_addr), - paddr_nz (bsp), + "libunwind sigtramp frame id: code %s, stack %s, special %s, this_frame %s\n", + paddress (gdbarch, id.code_addr), + paddress (gdbarch, id.stack_addr), + paddress (gdbarch, bsp), host_address_to_string (this_frame)); } @@ -3574,9 +3582,9 @@ ia64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) if (gdbarch_debug >= 1) fprintf_unfiltered (gdb_stdlog, - "dummy frame id: code 0x%s, stack 0x%s, special 0x%s\n", - paddr_nz (get_frame_pc (this_frame)), - paddr_nz (sp), paddr_nz (bsp)); + "dummy frame id: code %s, stack %s, special %s\n", + paddress (gdbarch, get_frame_pc (this_frame)), + paddress (gdbarch, sp), paddress (gdbarch, bsp)); return frame_id_build_special (sp, get_frame_pc (this_frame), bsp); } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index fb357e8..28b618f 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "defs.h" +#include "arch-utils.h" #include <signal.h> #include "gdb_string.h" #include "symtab.h" @@ -1029,6 +1030,7 @@ which has no line number information.\n"), name); static void jump_command (char *arg, int from_tty) { + struct gdbarch *gdbarch = get_current_arch (); CORE_ADDR addr; struct symtabs_and_lines sals; struct symtab_and_line sal; @@ -1098,7 +1100,7 @@ jump_command (char *arg, int from_tty) if (from_tty) { printf_filtered (_("Continuing at ")); - fputs_filtered (paddress (addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, addr), gdb_stdout); printf_filtered (".\n"); } @@ -1655,7 +1657,8 @@ program_info (char *args, int from_tty) stat = bpstat_num (&bs, &num); target_files_info (); - printf_filtered (_("Program stopped at %s.\n"), paddress (stop_pc)); + printf_filtered (_("Program stopped at %s.\n"), + paddress (target_gdbarch, stop_pc)); if (tp->stop_step) printf_filtered (_("It stopped after being stepped.\n")); else if (stat != 0) diff --git a/gdb/infrun.c b/gdb/infrun.c index 0606821..9f6cfc9 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -866,8 +866,8 @@ displaced_step_prepare (ptid_t ptid) read_memory (copy, displaced_step_saved_copy, len); if (debug_displaced) { - fprintf_unfiltered (gdb_stdlog, "displaced: saved 0x%s: ", - paddr_nz (copy)); + fprintf_unfiltered (gdb_stdlog, "displaced: saved %s: ", + paddress (gdbarch, copy)); displaced_step_dump_bytes (gdb_stdlog, displaced_step_saved_copy, len); }; @@ -895,8 +895,8 @@ displaced_step_prepare (ptid_t ptid) do_cleanups (old_cleanups); if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: displaced pc to 0x%s\n", - paddr_nz (copy)); + fprintf_unfiltered (gdb_stdlog, "displaced: displaced pc to %s\n", + paddress (gdbarch, copy)); return 1; } @@ -928,8 +928,9 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal) write_memory_ptid (displaced_step_ptid, displaced_step_copy, displaced_step_saved_copy, len); if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: restored 0x%s\n", - paddr_nz (displaced_step_copy)); + fprintf_unfiltered (gdb_stdlog, "displaced: restored %s\n", + paddress (displaced_step_gdbarch, + displaced_step_copy)); } /* Did the instruction complete successfully? */ @@ -962,6 +963,7 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal) { struct displaced_step_request *head; ptid_t ptid; + struct regcache *regcache; CORE_ADDR actual_pc; head = displaced_step_request_queue; @@ -971,7 +973,8 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal) context_switch (ptid); - actual_pc = regcache_read_pc (get_thread_regcache (ptid)); + regcache = get_thread_regcache (ptid); + actual_pc = regcache_read_pc (regcache); if (breakpoint_here_p (actual_pc)) { @@ -984,10 +987,11 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal) if (debug_displaced) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); gdb_byte buf[4]; - fprintf_unfiltered (gdb_stdlog, "displaced: run 0x%s: ", - paddr_nz (actual_pc)); + fprintf_unfiltered (gdb_stdlog, "displaced: run %s: ", + paddress (gdbarch, actual_pc)); read_memory (actual_pc, buf, sizeof (buf)); displaced_step_dump_bytes (gdb_stdlog, buf, sizeof (buf)); } @@ -1278,11 +1282,12 @@ a command like `return' or `jump' to continue execution.")); && tp->trap_expected) { struct regcache *resume_regcache = get_thread_regcache (resume_ptid); + struct gdbarch *resume_gdbarch = get_regcache_arch (resume_regcache); CORE_ADDR actual_pc = regcache_read_pc (resume_regcache); gdb_byte buf[4]; - fprintf_unfiltered (gdb_stdlog, "displaced: run 0x%s: ", - paddr_nz (actual_pc)); + fprintf_unfiltered (gdb_stdlog, "displaced: run %s: ", + paddress (resume_gdbarch, actual_pc)); read_memory (actual_pc, buf, sizeof (buf)); displaced_step_dump_bytes (gdb_stdlog, buf, sizeof (buf)); } @@ -1507,8 +1512,8 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step) if (debug_infrun) fprintf_unfiltered (gdb_stdlog, - "infrun: proceed (addr=0x%s, signal=%d, step=%d)\n", - paddr_nz (addr), siggnal, step); + "infrun: proceed (addr=%s, signal=%d, step=%d)\n", + paddress (gdbarch, addr), siggnal, step); if (non_stop) /* In non-stop, each thread is handled individually. The context @@ -2774,8 +2779,11 @@ targets should add new threads to the thread list themselves in non-stop mode.") if (debug_infrun) { - fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = 0x%s\n", - paddr_nz (stop_pc)); + struct regcache *regcache = get_thread_regcache (ecs->ptid); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + + fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = %s\n", + paddress (gdbarch, stop_pc)); if (target_stopped_by_watchpoint ()) { CORE_ADDR addr; @@ -2783,8 +2791,8 @@ targets should add new threads to the thread list themselves in non-stop mode.") if (target_stopped_data_address (¤t_target, &addr)) fprintf_unfiltered (gdb_stdlog, - "infrun: stopped data address = 0x%s\n", - paddr_nz (addr)); + "infrun: stopped data address = %s\n", + paddress (gdbarch, addr)); else fprintf_unfiltered (gdb_stdlog, "infrun: (no data address available)\n"); @@ -3680,9 +3688,10 @@ infrun: not switching back to stepped thread, it has vanished\n"); ecs->event_thread->step_frame_id))) { if (debug_infrun) - fprintf_unfiltered (gdb_stdlog, "infrun: stepping inside range [0x%s-0x%s]\n", - paddr_nz (ecs->event_thread->step_range_start), - paddr_nz (ecs->event_thread->step_range_end)); + fprintf_unfiltered + (gdb_stdlog, "infrun: stepping inside range [%s-%s]\n", + paddress (gdbarch, ecs->event_thread->step_range_start), + paddress (gdbarch, ecs->event_thread->step_range_end)); /* When stepping backward, stop at beginning of line range (unless it's the function entry point, in which case @@ -4279,8 +4288,8 @@ insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch, if (debug_infrun) fprintf_unfiltered (gdb_stdlog, - "infrun: inserting step-resume breakpoint at 0x%s\n", - paddr_nz (sr_sal.pc)); + "infrun: inserting step-resume breakpoint at %s\n", + paddress (gdbarch, sr_sal.pc)); inferior_thread ()->step_resume_breakpoint = set_momentary_breakpoint (gdbarch, sr_sal, sr_id, bp_step_resume); @@ -4361,8 +4370,8 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) if (debug_infrun) fprintf_unfiltered (gdb_stdlog, - "infrun: inserting longjmp-resume breakpoint at 0x%s\n", - paddr_nz (pc)); + "infrun: inserting longjmp-resume breakpoint at %s\n", + paddress (gdbarch, pc)); inferior_thread ()->step_resume_breakpoint = set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume); diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index b932911..72a617d 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -134,7 +134,7 @@ java_value_print (struct value *val, struct ui_file *stream, if (element == 0) fprintf_filtered (stream, "null"); else - fprintf_filtered (stream, "@%s", paddr_nz (element)); + fprintf_filtered (stream, "@%s", paddress (gdbarch, element)); things_printed++; i += reps; @@ -461,6 +461,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr, struct ui_file *stream, int recurse, const struct value_print_options *options) { + struct gdbarch *gdbarch = get_type_arch (type); unsigned int i = 0; /* Number of characters printed */ struct type *target_type; CORE_ADDR addr; @@ -481,7 +482,8 @@ java_val_print (struct type *type, const gdb_byte *valaddr, /* Print vtable entry - we only get here if we ARE using -fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */ /* Extract an address, assume that it is unsigned. */ - print_address_demangle (extract_unsigned_integer (valaddr, TYPE_LENGTH (type)), + print_address_demangle (gdbarch, + extract_unsigned_integer (valaddr, TYPE_LENGTH (type)), stream, demangle); break; } @@ -497,7 +499,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr, if (TYPE_CODE (target_type) == TYPE_CODE_FUNC) { /* Try to print what function it points to. */ - print_address_demangle (addr, stream, demangle); + print_address_demangle (gdbarch, addr, stream, demangle); /* Return value is irrelevant except for string pointers. */ return (0); } diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index a020743..b89e8b5 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "defs.h" +#include "arch-utils.h" #include "inferior.h" #include "regcache.h" #include "gdbcmd.h" @@ -480,6 +481,7 @@ detach_fork_command (char *args, int from_tty) static void info_forks_command (char *arg, int from_tty) { + struct gdbarch *gdbarch = get_current_arch (); struct frame_info *cur_frame; struct symtab_and_line sal; struct symtab *cur_symtab; @@ -512,7 +514,7 @@ info_forks_command (char *arg, int from_tty) if (fp->num == 0) printf_filtered (_(" (main process)")); printf_filtered (_(" at ")); - fputs_filtered (paddress (pc), gdb_stdout); + fputs_filtered (paddress (gdbarch, pc), gdb_stdout); sal = find_pc_line (pc, 0); if (sal.symtab) diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 29d9594..0253fe9 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -3445,8 +3445,8 @@ linux_nat_find_memory_regions (int (*func) (CORE_ADDR, if (info_verbose) { fprintf_filtered (gdb_stdout, - "Save segment, %lld bytes at 0x%s (%c%c%c)", - size, paddr_nz (addr), + "Save segment, %lld bytes at %s (%c%c%c)", + size, paddress (target_gdbarch, addr), read ? 'r' : ' ', write ? 'w' : ' ', exec ? 'x' : ' '); if (filename[0]) diff --git a/gdb/linux-record.c b/gdb/linux-record.c index 04ae26a..496f76d 100644 --- a/gdb/linux-record.c +++ b/gdb/linux-record.c @@ -96,6 +96,7 @@ int record_linux_system_call (int num, struct regcache *regcache, struct linux_record_tdep *tdep) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); uint32_t tmpu32; switch (num) @@ -547,8 +548,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading memory " - "at addr = 0x%s len = %lu.\n", - paddr_nz (tmpu32), + "at addr = %s len = %lu.\n", + paddress (gdbarch, tmpu32), (unsigned long)sizeof (sel)); return -1; } @@ -624,10 +625,10 @@ record_linux_system_call (int num, struct regcache *regcache, target_terminal_ours (); q = yquery (_("The next instruction is syscall munmap. " - "It will free the memory addr = 0x%s len = %u. " + "It will free the memory addr = %s len = %u. " "It will make record target get error. " "Do you want to stop the program?"), - paddr_nz (tmpu32), (int)len); + paddress (gdbarch, tmpu32), (int)len); target_terminal_inferior (); if (q) return 1; @@ -687,8 +688,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s len = %lu.\n", - paddr_nz (tmpu32), + "memory at addr = %s len = %lu.\n", + paddress (gdbarch, tmpu32), (unsigned long)sizeof (a)); return -1; } @@ -712,8 +713,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s len = %lu.\n", - paddr_nz (tmpu32), + "memory at addr = %s len = %lu.\n", + paddress (gdbarch, tmpu32), (unsigned long)sizeof (a)); return -1; } @@ -737,8 +738,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s len = %lu.\n", - paddr_nz (tmpu32), + "memory at addr = %s len = %lu.\n", + paddress (gdbarch, tmpu32), (unsigned long)sizeof (a)); return -1; } @@ -750,9 +751,9 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s " + "memory at addr = %s " "len = %lu.\n", - paddr_nz (a[2]), + paddress (gdbarch, a[2]), (unsigned long)sizeof (a[2])); return -1; } @@ -774,8 +775,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s len = %lu.\n", - paddr_nz (tmpu32), + "memory at addr = %s len = %lu.\n", + paddress (gdbarch, tmpu32), (unsigned long)sizeof (a)); return -1; } @@ -787,9 +788,9 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s " + "memory at addr = %s " "len = %lu.\n", - paddr_nz (a[2]), + paddress (gdbarch, a[2]), (unsigned long)sizeof (a[2])); return -1; } @@ -820,8 +821,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s len = %lu.\n", - paddr_nz (tmpu32), + "memory at addr = %s len = %lu.\n", + paddress (gdbarch, tmpu32), (unsigned long)sizeof (a)); return -1; } @@ -833,9 +834,9 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s " + "memory at addr = %s " "len = %lu.\n", - paddr_nz (a[4]), + paddress (gdbarch, a[4]), (unsigned long)sizeof (av)); return -1; } @@ -877,8 +878,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s len = %lu.\n", - paddr_nz (tmpu32), + "memory at addr = %s len = %lu.\n", + paddress (gdbarch, tmpu32), (unsigned long)sizeof (a)); return -1; } @@ -892,9 +893,9 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s " + "memory at addr = %s " "len = %lu.\n", - paddr_nz (a[1]), + paddress (gdbarch, a[1]), (unsigned long)sizeof (rec)); return -1; } @@ -916,10 +917,10 @@ record_linux_system_call (int num, struct regcache *regcache, fprintf_unfiltered (gdb_stdlog, "Process record: error " "reading memory at " - "addr = 0x%s " + "addr = %s " "len = %lu.\n", - paddr_nz (rec. - msg_iov), + paddress (gdbarch, + rec.msg_iov), (unsigned long)sizeof (iov)); return -1; } @@ -1234,8 +1235,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading " - "memory at addr = 0x%s len = %lu.\n", - paddr_nz (vec), + "memory at addr = %s len = %lu.\n", + paddress (gdbarch, vec), (unsigned long)sizeof (struct record_iovec)); return -1; } @@ -1783,8 +1784,8 @@ record_linux_system_call (int num, struct regcache *regcache, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading memory " - "at addr = 0x%s len = %u.\n", - paddr_nz (tmpu32), + "at addr = %s len = %u.\n", + paddress (gdbarch, tmpu32), (int)(nr * tdep->size_int)); return -1; } diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index 08ee7b3..657eff7 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -57,10 +57,10 @@ print_function_pointer_address (struct gdbarch *gdbarch, CORE_ADDR address, if (addressprint && func_addr != address) { fputs_filtered ("@", stream); - fputs_filtered (paddress (address), stream); + fputs_filtered (paddress (gdbarch, address), stream); fputs_filtered (": ", stream); } - print_address_demangle (func_addr, stream, demangle); + print_address_demangle (gdbarch, func_addr, stream, demangle); } /* get_long_set_bounds - assigns the bounds of the long set to low and @@ -225,7 +225,7 @@ print_unpacked_pointer (struct type *type, } if (options->addressprint && options->format != 's') - fputs_filtered (paddress (address), stream); + fputs_filtered (paddress (gdbarch, address), stream); /* For a pointer to char or unsigned char, also print the string pointed to, unless pointer is null. */ @@ -247,11 +247,12 @@ print_variable_at_address (struct type *type, int recurse, const struct value_print_options *options) { + struct gdbarch *gdbarch = get_type_arch (type); CORE_ADDR addr = unpack_pointer (type, valaddr); struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type)); fprintf_filtered (stream, "["); - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); fprintf_filtered (stream, "] : "); if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF) @@ -316,6 +317,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, const struct value_print_options *options) { + struct gdbarch *gdbarch = get_type_arch (type); unsigned int i = 0; /* Number of characters printed */ unsigned len; struct type *elttype; @@ -396,7 +398,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 (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); if (options->deref_ref) fputs_filtered (": ", stream); } @@ -476,7 +478,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ - print_address_demangle (address, stream, demangle); + print_address_demangle (gdbarch, address, stream, demangle); break; case TYPE_CODE_BOOL: diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index b67169f..9eb7257 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -2421,7 +2421,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, if (! func_msym) error ("Cannot convert code address %s to function pointer:\n" "couldn't find a symbol at that address, to find trampoline.", - paddr_nz (addr)); + paddress (gdbarch, addr)); func_name = SYMBOL_LINKAGE_NAME (func_msym); tramp_name = xmalloc (strlen (func_name) + 5); @@ -2438,7 +2438,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, if (! tramp_msym) error ("Cannot convert code address %s to function pointer:\n" "couldn't find trampoline named '%s.plt'.", - paddr_nz (addr), func_name); + paddress (gdbarch, addr), func_name); /* The trampoline's address is our pointer. */ addr = SYMBOL_VALUE_ADDRESS (tramp_msym); diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c index 1491f22..78ce499 100644 --- a/gdb/m32r-rom.c +++ b/gdb/m32r-rom.c @@ -78,6 +78,7 @@ m32r_load_section (bfd *abfd, asection *s, void *obj) unsigned int *data_count = obj; if (s->flags & SEC_LOAD) { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; bfd_size_type section_size = bfd_section_size (abfd, s); bfd_vma section_base = bfd_section_lma (abfd, s); unsigned int buffer, i; @@ -87,10 +88,10 @@ m32r_load_section (bfd *abfd, asection *s, void *obj) printf_filtered ("Loading section %s, size 0x%lx lma ", bfd_section_name (abfd, s), (unsigned long) section_size); - fputs_filtered (paddress (section_base), gdb_stdout); + fputs_filtered (paddress (target_gdbarch, section_base), gdb_stdout); printf_filtered ("\n"); gdb_flush (gdb_stdout); - monitor_printf ("%s mw\r", paddr_nz (section_base)); + monitor_printf ("%s mw\r", phex_nz (section_base, addr_size)); for (i = 0; i < section_size; i += 4) { QUIT; @@ -146,7 +147,7 @@ m32r_load (char *filename, int from_tty) printf_filtered ("Loading section %s, size 0x%lx vma ", bfd_section_name (abfd, s), section_size); - fputs_filtered (paddress (section_base), gdb_stdout); + fputs_filtered (paddress (target_gdbarch, section_base), gdb_stdout); printf_filtered ("\n"); gdb_flush (gdb_stdout); monitor_printf ("%x mw\r", section_base); @@ -528,7 +529,8 @@ m32r_upload_command (char *args, int from_tty) printf_filtered ("Loading section %s, size 0x%lx lma ", bfd_section_name (abfd, s), (unsigned long) section_size); - fputs_filtered (paddress (section_base), gdb_stdout); + fputs_filtered (paddress (target_gdbarch, section_base), + gdb_stdout); printf_filtered ("\n"); gdb_flush (gdb_stdout); } diff --git a/gdb/maint.c b/gdb/maint.c index ae465ce..ecbae12 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -306,11 +306,10 @@ print_bfd_flags (flagword flags) static void maint_print_section_info (const char *name, flagword flags, CORE_ADDR addr, CORE_ADDR endaddr, - unsigned long filepos) + unsigned long filepos, int addr_size) { - /* FIXME-32x64: Need paddress with field width. */ - printf_filtered (" 0x%s", paddr (addr)); - printf_filtered ("->0x%s", paddr (endaddr)); + printf_filtered (" %s", hex_string_custom (addr, addr_size)); + printf_filtered ("->%s", hex_string_custom (endaddr, addr_size)); printf_filtered (" at %s", hex_string_custom ((unsigned long) filepos, 8)); printf_filtered (": %s", name); @@ -330,11 +329,14 @@ print_bfd_section_info (bfd *abfd, || match_substring ((char *) arg, name) || match_bfd_flags ((char *) arg, flags)) { + struct gdbarch *gdbarch = gdbarch_from_bfd (abfd); + int addr_size = gdbarch_addr_bit (gdbarch) / 8; CORE_ADDR addr, endaddr; addr = bfd_section_vma (abfd, asect); endaddr = addr + bfd_section_size (abfd, asect); - maint_print_section_info (name, flags, addr, endaddr, asect->filepos); + maint_print_section_info (name, flags, addr, endaddr, + asect->filepos, addr_size); } } @@ -350,10 +352,13 @@ print_objfile_section_info (bfd *abfd, || match_substring (string, name) || match_bfd_flags (string, flags)) { + 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), - asect->the_bfd_section->filepos); + asect->the_bfd_section->filepos, + addr_size); } } @@ -515,10 +520,10 @@ maintenance_translate_address (char *arg, int from_tty) printf_filtered (_("%s + %s\n"), symbol_name, symbol_offset); } else if (sect) - printf_filtered (_("no symbol at %s:0x%s\n"), - sect->the_bfd_section->name, paddr (address)); + printf_filtered (_("no symbol at %s:%s\n"), + sect->the_bfd_section->name, hex_string (address)); else - printf_filtered (_("no symbol at 0x%s\n"), paddr (address)); + printf_filtered (_("no symbol at %s\n"), hex_string (address)); return; } diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index cad4117..64a36bf 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -128,8 +128,8 @@ mi_cmd_var_create (char *command, char **argv, int argc) if (varobjdebug) fprintf_unfiltered (gdb_stdlog, - "Name=\"%s\", Frame=\"%s\" (0x%s), Expression=\"%s\"\n", - name, frame, paddr (frameaddr), expr); + "Name=\"%s\", Frame=\"%s\" (%s), Expression=\"%s\"\n", + name, frame, hex_string (frameaddr), expr); var = varobj_create (name, expr, frameaddr, var_type); diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index aa176f7..3d4281f 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -935,13 +935,15 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) error ("Unable to read memory."); /* Output the header information. */ - ui_out_field_core_addr (uiout, "addr", addr); + ui_out_field_core_addr (uiout, "addr", gdbarch, addr); ui_out_field_int (uiout, "nr-bytes", nr_bytes); ui_out_field_int (uiout, "total-bytes", total_bytes); - ui_out_field_core_addr (uiout, "next-row", addr + word_size * nr_cols); - ui_out_field_core_addr (uiout, "prev-row", addr - word_size * nr_cols); - ui_out_field_core_addr (uiout, "next-page", addr + total_bytes); - ui_out_field_core_addr (uiout, "prev-page", addr - total_bytes); + ui_out_field_core_addr (uiout, "next-row", + gdbarch, addr + word_size * nr_cols); + ui_out_field_core_addr (uiout, "prev-row", + gdbarch, addr - word_size * nr_cols); + ui_out_field_core_addr (uiout, "next-page", gdbarch, addr + total_bytes); + ui_out_field_core_addr (uiout, "prev-page", gdbarch, addr - total_bytes); /* Build the result as a two dimentional table. */ { @@ -961,7 +963,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) struct value_print_options opts; cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_core_addr (uiout, "addr", addr + row_byte); + ui_out_field_core_addr (uiout, "addr", gdbarch, addr + row_byte); /* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */ cleanup_list_data = make_cleanup_ui_out_list_begin_end (uiout, "data"); get_formatted_print_options (&opts, word_format); diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index 6b28fe0..fc03894 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -19,6 +19,7 @@ #include "defs.h" #include "mi-cmds.h" #include "symtab.h" +#include "objfiles.h" #include "ui-out.h" /* SYMBOL-LIST-LINES: @@ -30,6 +31,7 @@ void mi_cmd_symbol_list_lines (char *command, char **argv, int argc) { + struct gdbarch *gdbarch; char *filename; struct symtab *s; int i; @@ -48,13 +50,14 @@ mi_cmd_symbol_list_lines (char *command, char **argv, int argc) sorted by increasing values in the symbol table, so no need to perform any other sorting. */ + gdbarch = get_objfile_arch (s->objfile); cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "lines"); if (LINETABLE (s) != NULL && LINETABLE (s)->nitems > 0) for (i = 0; i < LINETABLE (s)->nitems; i++) { cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - ui_out_field_core_addr (uiout, "pc", LINETABLE (s)->item[i].pc); + ui_out_field_core_addr (uiout, "pc", gdbarch, LINETABLE (s)->item[i].pc); ui_out_field_int (uiout, "line", LINETABLE (s)->item[i].line); do_cleanups (cleanup_tuple); } diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index ca7c03d..3db7124 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -595,7 +595,8 @@ mips_show_dr (const char *func, CORE_ADDR addr, puts_unfiltered (func); if (addr || len) - printf_unfiltered (" (addr=0x%s, len=%d, type=%s)", paddr (addr), len, + printf_unfiltered (" (addr=%s, len=%d, type=%s)", + paddress (target_gdbarch, addr), len, type == hw_write ? "data-write" : (type == hw_read ? "data-read" : (type == hw_access ? "data-read/write" @@ -604,9 +605,11 @@ mips_show_dr (const char *func, CORE_ADDR addr, puts_unfiltered (":\n"); for (i = 0; i < MAX_DEBUG_REGISTER; i++) - printf_unfiltered ("\tDR%d: lo=0x%s, hi=0x%s\n", - i, paddr (get_watchlo (&watch_mirror, i)), - paddr (get_watchhi (&watch_mirror, i))); + printf_unfiltered ("\tDR%d: lo=%s, hi=%s\n", i, + paddress (target_gdbarch, + get_watchlo (&watch_mirror, i)), + paddress (target_gdbarch, + get_watchhi (&watch_mirror, i))); } /* Return 1 if watch registers are usable. Cached information is used diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index c4d9ee9..ad0076d 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -2548,8 +2548,8 @@ heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc) { static int blurb_printed = 0; - warning (_("GDB can't find the start of the function at 0x%s."), - paddr_nz (pc)); + warning (_("GDB can't find the start of the function at %s."), + paddress (gdbarch, pc)); if (!blurb_printed) { @@ -2560,16 +2560,17 @@ heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc) in that situation enough information to determine that it's no big deal. */ printf_filtered ("\n\ - GDB is unable to find the start of the function at 0x%s\n\ + GDB is unable to find the start of the function at %s\n\ and thus can't determine the size of that function's stack frame.\n\ This means that GDB may be unable to access that stack frame, or\n\ the frames below it.\n\ This problem is most likely caused by an invalid program counter or\n\ stack pointer.\n\ However, if you think GDB should simply search farther back\n\ -from 0x%s for code which looks like the beginning of a\n\ +from %s for code which looks like the beginning of a\n\ function, you can increase the range of the search using the `set\n\ -heuristic-fence-post' command.\n", paddr_nz (pc), paddr_nz (pc)); +heuristic-fence-post' command.\n", + paddress (gdbarch, pc), paddress (gdbarch, pc)); blurb_printed = 1; } } @@ -2725,8 +2726,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_eabi_push_dummy_call: sp=0x%s allocated %ld\n", - paddr_nz (sp), (long) align_up (len, 16)); + "mips_eabi_push_dummy_call: sp=%s allocated %ld\n", + paddress (gdbarch, sp), (long) align_up (len, 16)); /* Initialize the integer and float register pointers. */ argreg = MIPS_A0_REGNUM; @@ -2737,8 +2738,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_eabi_push_dummy_call: struct_return reg=%d 0x%s\n", - argreg, paddr_nz (struct_addr)); + "mips_eabi_push_dummy_call: struct_return reg=%d %s\n", + argreg, paddress (gdbarch, struct_addr)); regcache_cooked_write_unsigned (regcache, argreg++, struct_addr); } @@ -2887,10 +2888,10 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) { - fprintf_unfiltered (gdb_stdlog, " - stack_offset=0x%s", - paddr_nz (stack_offset)); - fprintf_unfiltered (gdb_stdlog, " longword_offset=0x%s", - paddr_nz (longword_offset)); + fprintf_unfiltered (gdb_stdlog, " - stack_offset=%s", + paddress (gdbarch, stack_offset)); + fprintf_unfiltered (gdb_stdlog, " longword_offset=%s", + paddress (gdbarch, longword_offset)); } addr = sp + stack_offset + longword_offset; @@ -2898,8 +2899,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) { int i; - fprintf_unfiltered (gdb_stdlog, " @0x%s ", - paddr_nz (addr)); + fprintf_unfiltered (gdb_stdlog, " @%s ", + paddress (gdbarch, addr)); for (i = 0; i < partial_len; i++) { fprintf_unfiltered (gdb_stdlog, "%02x", @@ -3109,8 +3110,8 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_n32n64_push_dummy_call: sp=0x%s allocated %ld\n", - paddr_nz (sp), (long) align_up (len, 16)); + "mips_n32n64_push_dummy_call: sp=%s allocated %ld\n", + paddress (gdbarch, sp), (long) align_up (len, 16)); /* Initialize the integer and float register pointers. */ argreg = MIPS_A0_REGNUM; @@ -3121,8 +3122,8 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_n32n64_push_dummy_call: struct_return reg=%d 0x%s\n", - argreg, paddr_nz (struct_addr)); + "mips_n32n64_push_dummy_call: struct_return reg=%d %s\n", + argreg, paddress (gdbarch, struct_addr)); regcache_cooked_write_unsigned (regcache, argreg++, struct_addr); } @@ -3234,10 +3235,10 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) { - fprintf_unfiltered (gdb_stdlog, " - stack_offset=0x%s", - paddr_nz (stack_offset)); - fprintf_unfiltered (gdb_stdlog, " longword_offset=0x%s", - paddr_nz (longword_offset)); + fprintf_unfiltered (gdb_stdlog, " - stack_offset=%s", + paddress (gdbarch, stack_offset)); + fprintf_unfiltered (gdb_stdlog, " longword_offset=%s", + paddress (gdbarch, longword_offset)); } addr = sp + stack_offset + longword_offset; @@ -3245,8 +3246,8 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) { int i; - fprintf_unfiltered (gdb_stdlog, " @0x%s ", - paddr_nz (addr)); + fprintf_unfiltered (gdb_stdlog, " @%s ", + paddress (gdbarch, addr)); for (i = 0; i < partial_len; i++) { fprintf_unfiltered (gdb_stdlog, "%02x", @@ -3556,8 +3557,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_o32_push_dummy_call: sp=0x%s allocated %ld\n", - paddr_nz (sp), (long) align_up (len, 16)); + "mips_o32_push_dummy_call: sp=%s allocated %ld\n", + paddress (gdbarch, sp), (long) align_up (len, 16)); /* Initialize the integer and float register pointers. */ argreg = MIPS_A0_REGNUM; @@ -3568,8 +3569,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_o32_push_dummy_call: struct_return reg=%d 0x%s\n", - argreg, paddr_nz (struct_addr)); + "mips_o32_push_dummy_call: struct_return reg=%d %s\n", + argreg, paddress (gdbarch, struct_addr)); regcache_cooked_write_unsigned (regcache, argreg++, struct_addr); stack_offset += MIPS32_REGSIZE; } @@ -3711,10 +3712,10 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) { - fprintf_unfiltered (gdb_stdlog, " - stack_offset=0x%s", - paddr_nz (stack_offset)); - fprintf_unfiltered (gdb_stdlog, " longword_offset=0x%s", - paddr_nz (longword_offset)); + fprintf_unfiltered (gdb_stdlog, " - stack_offset=%s", + paddress (gdbarch, stack_offset)); + fprintf_unfiltered (gdb_stdlog, " longword_offset=%s", + paddress (gdbarch, longword_offset)); } addr = sp + stack_offset + longword_offset; @@ -3722,8 +3723,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) { int i; - fprintf_unfiltered (gdb_stdlog, " @0x%s ", - paddr_nz (addr)); + fprintf_unfiltered (gdb_stdlog, " @%s ", + paddress (gdbarch, addr)); for (i = 0; i < partial_len; i++) { fprintf_unfiltered (gdb_stdlog, "%02x", @@ -4013,8 +4014,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_o64_push_dummy_call: sp=0x%s allocated %ld\n", - paddr_nz (sp), (long) align_up (len, 16)); + "mips_o64_push_dummy_call: sp=%s allocated %ld\n", + paddress (gdbarch, sp), (long) align_up (len, 16)); /* Initialize the integer and float register pointers. */ argreg = MIPS_A0_REGNUM; @@ -4025,8 +4026,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { if (mips_debug) fprintf_unfiltered (gdb_stdlog, - "mips_o64_push_dummy_call: struct_return reg=%d 0x%s\n", - argreg, paddr_nz (struct_addr)); + "mips_o64_push_dummy_call: struct_return reg=%d %s\n", + argreg, paddress (gdbarch, struct_addr)); regcache_cooked_write_unsigned (regcache, argreg++, struct_addr); stack_offset += MIPS64_REGSIZE; } @@ -4116,10 +4117,10 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) { - fprintf_unfiltered (gdb_stdlog, " - stack_offset=0x%s", - paddr_nz (stack_offset)); - fprintf_unfiltered (gdb_stdlog, " longword_offset=0x%s", - paddr_nz (longword_offset)); + fprintf_unfiltered (gdb_stdlog, " - stack_offset=%s", + paddress (gdbarch, stack_offset)); + fprintf_unfiltered (gdb_stdlog, " longword_offset=%s", + paddress (gdbarch, longword_offset)); } addr = sp + stack_offset + longword_offset; @@ -4127,8 +4128,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (mips_debug) { int i; - fprintf_unfiltered (gdb_stdlog, " @0x%s ", - paddr_nz (addr)); + fprintf_unfiltered (gdb_stdlog, " @%s ", + paddress (gdbarch, addr)); for (i = 0; i < partial_len; i++) { fprintf_unfiltered (gdb_stdlog, "%02x", diff --git a/gdb/monitor.c b/gdb/monitor.c index b51848e..a148eaf 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -214,9 +214,13 @@ monitor_error (char *function, char *message, monitor_printable_string (safe_string, string, real_len); if (final_char) - error (_("%s (0x%s): %s: %s%c"), function, paddr_nz (memaddr), message, safe_string, final_char); + error (_("%s (%s): %s: %s%c"), + function, paddress (target_gdbarch, memaddr), + message, safe_string, final_char); else - error (_("%s (0x%s): %s: %s"), function, paddr_nz (memaddr), message, safe_string); + error (_("%s (%s): %s: %s"), + function, paddress (target_gdbarch, memaddr), + message, safe_string); } /* Convert hex digit A to a number. */ @@ -251,6 +255,7 @@ fromhex (int a) static void monitor_vsprintf (char *sndbuf, char *pattern, va_list args) { + int addr_bit = gdbarch_addr_bit (target_gdbarch); char format[10]; char fmt; char *p; @@ -279,7 +284,7 @@ monitor_vsprintf (char *sndbuf, char *pattern, va_list args) break; case 'A': arg_addr = va_arg (args, CORE_ADDR); - strcpy (sndbuf, paddr_nz (arg_addr)); + strcpy (sndbuf, phex_nz (arg_addr, addr_bit / 8)); break; case 's': arg_string = va_arg (args, char *); @@ -1314,6 +1319,7 @@ monitor_fetch_registers (struct target_ops *ops, static void monitor_store_register (struct regcache *regcache, int regno) { + int reg_size = register_size (get_regcache_arch (regcache), regno); const char *name; ULONGEST val; @@ -1329,9 +1335,7 @@ monitor_store_register (struct regcache *regcache, int regno) } regcache_cooked_read_unsigned (regcache, regno, &val); - monitor_debug ("MON storeg %d %s\n", regno, - phex (val, - register_size (get_regcache_arch (regcache), regno))); + monitor_debug ("MON storeg %d %s\n", regno, phex (val, reg_size)); /* send the register deposit command */ @@ -1347,14 +1351,14 @@ monitor_store_register (struct regcache *regcache, int regno) monitor_debug ("EXP setreg.resp_delim\n"); monitor_expect_regexp (&setreg_resp_delim_pattern, NULL, 0); if (current_monitor->flags & MO_SETREG_INTERACTIVE) - monitor_printf ("%s\r", paddr_nz (val)); + monitor_printf ("%s\r", phex_nz (val, reg_size)); } if (current_monitor->setreg.term) { monitor_debug ("EXP setreg.term\n"); monitor_expect (current_monitor->setreg.term, NULL, 0); if (current_monitor->flags & MO_SETREG_INTERACTIVE) - monitor_printf ("%s\r", paddr_nz (val)); + monitor_printf ("%s\r", phex_nz (val, reg_size)); monitor_expect_prompt (NULL, 0); } else @@ -1409,7 +1413,7 @@ monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len) char *cmd; int i; - monitor_debug ("MON write %d %s\n", len, paddr (memaddr)); + monitor_debug ("MON write %d %s\n", len, paddress (target_gdbarch, memaddr)); if (current_monitor->flags & MO_ADDR_BITS_REMOVE) memaddr = gdbarch_addr_bits_remove (target_gdbarch, memaddr); @@ -1808,7 +1812,7 @@ monitor_read_memory (CORE_ADDR memaddr, char *myaddr, int len) } monitor_debug ("MON read block ta(%s) ha(%lx) %d\n", - paddr_nz (memaddr), (long) myaddr, len); + paddress (target_gdbarch, memaddr), (long) myaddr, len); if (current_monitor->flags & MO_ADDR_BITS_REMOVE) memaddr = gdbarch_addr_bits_remove (target_gdbarch, memaddr); @@ -2034,7 +2038,7 @@ monitor_insert_breakpoint (struct gdbarch *gdbarch, int i; int bplen; - monitor_debug ("MON inst bkpt %s\n", paddr (addr)); + monitor_debug ("MON inst bkpt %s\n", paddress (gdbarch, addr)); if (current_monitor->set_break == NULL) error (_("No set_break defined for this monitor")); @@ -2069,7 +2073,7 @@ monitor_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr = bp_tgt->placed_address; int i; - monitor_debug ("MON rmbkpt %s\n", paddr (addr)); + monitor_debug ("MON rmbkpt %s\n", paddress (gdbarch, addr)); if (current_monitor->clr_break == NULL) error (_("No clr_break defined for this monitor")); @@ -2090,8 +2094,8 @@ monitor_remove_breakpoint (struct gdbarch *gdbarch, } } fprintf_unfiltered (gdb_stderr, - "Can't find breakpoint associated with 0x%s\n", - paddr_nz (addr)); + "Can't find breakpoint associated with %s\n", + paddress (gdbarch, addr)); return 1; } diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 30d0650..ec90016 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -56,6 +56,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, struct ui_file *stream, int recurse, const struct value_print_options *options) { + struct gdbarch *gdbarch = get_type_arch (type); unsigned int i = 0; /* Number of characters printed */ unsigned len; struct type *elttype; @@ -142,7 +143,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, /* Print vtable entry - we only get here if we ARE using -fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */ /* Extract the address, assume that it is unsigned. */ - print_address_demangle (extract_unsigned_integer (valaddr + embedded_offset, TYPE_LENGTH (type)), + print_address_demangle (gdbarch, + extract_unsigned_integer (valaddr + embedded_offset, TYPE_LENGTH (type)), stream, demangle); break; } @@ -155,14 +157,14 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, if (TYPE_CODE (elttype) == TYPE_CODE_FUNC) { /* Try to print what function it points to. */ - print_address_demangle (addr, stream, demangle); + print_address_demangle (gdbarch, addr, stream, demangle); /* Return value is irrelevant except for string pointers. */ return (0); } if (options->addressprint && options->format != 's') { - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); } /* For a pointer to char or unsigned char, also print the string @@ -254,7 +256,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, CORE_ADDR addr = extract_typed_address (valaddr + embedded_offset, type); fprintf_filtered (stream, "@"); - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); if (options->deref_ref) fputs_filtered (": ", stream); } @@ -290,7 +292,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, -fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */ /* Extract the address, assume that it is unsigned. */ print_address_demangle - (extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8, + (gdbarch, + extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8, TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))), stream, demangle); } @@ -356,7 +359,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, type_print (type, "", stream, -1); fprintf_filtered (stream, "} "); /* Try to print what function it points to, and its address. */ - print_address_demangle (address, stream, demangle); + print_address_demangle (gdbarch, address, stream, demangle); break; case TYPE_CODE_BOOL: diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 7601d7c..8a8a51b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -449,7 +449,7 @@ print_scalar_formatted (const void *valaddr, struct type *type, case 'a': { CORE_ADDR addr = unpack_pointer (type, valaddr); - print_address (addr, stream); + print_address (gdbarch, addr, stream); } break; @@ -709,9 +709,10 @@ build_address_symbolic (CORE_ADDR addr, /* IN */ <SYMBOL + OFFSET> after the number. */ void -print_address (CORE_ADDR addr, struct ui_file *stream) +print_address (struct gdbarch *gdbarch, + CORE_ADDR addr, struct ui_file *stream) { - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); print_address_symbolic (addr, stream, asm_demangle, " "); } @@ -721,8 +722,8 @@ print_address (CORE_ADDR addr, struct ui_file *stream) or not. */ void -print_address_demangle (CORE_ADDR addr, struct ui_file *stream, - int do_demangle) +print_address_demangle (struct gdbarch *gdbarch, CORE_ADDR addr, + struct ui_file *stream, int do_demangle) { struct value_print_options opts; get_user_print_options (&opts); @@ -732,7 +733,7 @@ print_address_demangle (CORE_ADDR addr, struct ui_file *stream, } else if (opts.addressprint) { - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); print_address_symbolic (addr, stream, do_demangle, " "); } else @@ -807,7 +808,7 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr) while (count > 0) { QUIT; - print_address (next_address, gdb_stdout); + print_address (next_gdbarch, next_address, gdb_stdout); printf_filtered (":"); for (i = maxelts; i > 0 && count > 0; @@ -1140,20 +1141,21 @@ address_info (char *exp, int from_tty) if (msymbol != NULL) { + gdbarch = get_objfile_arch (msymbol_objfile (msymbol)); load_addr = SYMBOL_VALUE_ADDRESS (msymbol); printf_filtered ("Symbol \""); fprintf_symbol_filtered (gdb_stdout, exp, current_language->la_language, DMGL_ANSI); printf_filtered ("\" is at "); - fputs_filtered (paddress (load_addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); printf_filtered (" in a file compiled without debugging"); section = SYMBOL_OBJ_SECTION (msymbol); if (section_is_overlay (section)) { load_addr = overlay_unmapped_address (load_addr, section); printf_filtered (",\n -- loaded at "); - fputs_filtered (paddress (load_addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); printf_filtered (" in overlay section %s", section->the_bfd_section->name); } @@ -1181,13 +1183,13 @@ address_info (char *exp, int from_tty) case LOC_LABEL: printf_filtered ("a label at address "); - fputs_filtered (paddress (load_addr = SYMBOL_VALUE_ADDRESS (sym)), - gdb_stdout); + load_addr = SYMBOL_VALUE_ADDRESS (sym); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); if (section_is_overlay (section)) { load_addr = overlay_unmapped_address (load_addr, section); printf_filtered (",\n -- loaded at "); - fputs_filtered (paddress (load_addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); printf_filtered (" in overlay section %s", section->the_bfd_section->name); } @@ -1221,13 +1223,13 @@ address_info (char *exp, int from_tty) case LOC_STATIC: printf_filtered (_("static storage at address ")); - fputs_filtered (paddress (load_addr = SYMBOL_VALUE_ADDRESS (sym)), - gdb_stdout); + load_addr = SYMBOL_VALUE_ADDRESS (sym); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); if (section_is_overlay (section)) { load_addr = overlay_unmapped_address (load_addr, section); printf_filtered (_(",\n -- loaded at ")); - fputs_filtered (paddress (load_addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); printf_filtered (_(" in overlay section %s"), section->the_bfd_section->name); } @@ -1259,12 +1261,12 @@ address_info (char *exp, int from_tty) case LOC_BLOCK: printf_filtered (_("a function at address ")); load_addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); - fputs_filtered (paddress (load_addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); if (section_is_overlay (section)) { load_addr = overlay_unmapped_address (load_addr, section); printf_filtered (_(",\n -- loaded at ")); - fputs_filtered (paddress (load_addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); printf_filtered (_(" in overlay section %s"), section->the_bfd_section->name); } @@ -1286,16 +1288,17 @@ address_info (char *exp, int from_tty) && (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) printf_filtered (_("a thread-local variable at offset %s " "in the thread-local storage for `%s'"), - paddr_nz (load_addr), section->objfile->name); + paddress (gdbarch, load_addr), + section->objfile->name); else { printf_filtered (_("static storage at address ")); - fputs_filtered (paddress (load_addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); if (section_is_overlay (section)) { load_addr = overlay_unmapped_address (load_addr, section); printf_filtered (_(",\n -- loaded at ")); - fputs_filtered (paddress (load_addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); printf_filtered (_(" in overlay section %s"), section->the_bfd_section->name); } diff --git a/gdb/record.c b/gdb/record.c index 6595570..1aa412f 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -261,9 +261,9 @@ record_arch_list_add_mem (CORE_ADDR addr, int len) if (record_debug > 1) fprintf_unfiltered (gdb_stdlog, - "Process record: add mem addr = 0x%s len = %d to " + "Process record: add mem addr = %s len = %d to " "record list.\n", - paddr_nz (addr), len); + paddress (target_gdbarch, addr), len); if (!addr) return 0; @@ -281,8 +281,8 @@ record_arch_list_add_mem (CORE_ADDR addr, int len) if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: error reading memory at " - "addr = 0x%s len = %d.\n", - paddr_nz (addr), len); + "addr = %s len = %d.\n", + paddress (target_gdbarch, addr), len); xfree (rec->u.mem.val); xfree (rec); return -1; @@ -649,6 +649,7 @@ record_wait (struct target_ops *ops, else { struct regcache *regcache = get_current_regcache (); + struct gdbarch *gdbarch = get_regcache_arch (regcache); int continue_flag = 1; int first_record_end = 1; struct cleanup *old_cleanups = make_cleanup (record_wait_cleanups, 0); @@ -664,14 +665,13 @@ record_wait (struct target_ops *ops, { if (record_debug) fprintf_unfiltered (gdb_stdlog, - "Process record: break at 0x%s.\n", - paddr_nz (tmp_pc)); - if (gdbarch_decr_pc_after_break (get_regcache_arch (regcache)) + "Process record: break at %s.\n", + paddress (gdbarch, tmp_pc)); + if (gdbarch_decr_pc_after_break (gdbarch) && !record_resume_step) regcache_write_pc (regcache, tmp_pc + - gdbarch_decr_pc_after_break - (get_regcache_arch (regcache))); + gdbarch_decr_pc_after_break (gdbarch)); goto replay_out; } } @@ -731,16 +731,16 @@ record_wait (struct target_ops *ops, if (record_debug > 1) fprintf_unfiltered (gdb_stdlog, "Process record: record_mem %s to " - "inferior addr = 0x%s len = %d.\n", + "inferior addr = %s len = %d.\n", host_address_to_string (record_list), - paddr_nz (record_list->u.mem.addr), + paddress (gdbarch, record_list->u.mem.addr), record_list->u.mem.len); if (target_read_memory (record_list->u.mem.addr, mem, record_list->u.mem.len)) error (_("Process record: error reading memory at " - "addr = 0x%s len = %d."), - paddr_nz (record_list->u.mem.addr), + "addr = %s len = %d."), + paddress (gdbarch, record_list->u.mem.addr), record_list->u.mem.len); if (target_write_memory @@ -748,8 +748,8 @@ record_wait (struct target_ops *ops, record_list->u.mem.len)) error (_ ("Process record: error writing memory at " - "addr = 0x%s len = %d."), - paddr_nz (record_list->u.mem.addr), + "addr = %s len = %d."), + paddress (gdbarch, record_list->u.mem.addr), record_list->u.mem.len); memcpy (record_list->u.mem.val, mem, record_list->u.mem.len); @@ -790,15 +790,14 @@ record_wait (struct target_ops *ops, if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: break " - "at 0x%s.\n", - paddr_nz (tmp_pc)); - if (gdbarch_decr_pc_after_break (get_regcache_arch (regcache)) + "at %s.\n", + paddress (gdbarch, tmp_pc)); + if (gdbarch_decr_pc_after_break (gdbarch) && execution_direction == EXEC_FORWARD && !record_resume_step) regcache_write_pc (regcache, tmp_pc + - gdbarch_decr_pc_after_break - (get_regcache_arch (regcache))); + gdbarch_decr_pc_after_break (gdbarch)); continue_flag = 0; } } @@ -996,8 +995,8 @@ record_xfer_partial (struct target_ops *ops, enum target_object object, /* Let user choose if he wants to write memory or not. */ if (!nquery (_("Because GDB is in replay mode, writing to memory " "will make the execution log unusable from this " - "point onward. Write memory at address 0x%s?"), - paddr_nz (offset))) + "point onward. Write memory at address %s?"), + paddress (target_gdbarch, offset))) return -1; /* Destroy the record from here forward. */ diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 7d9982b..34e2da0 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1050,10 +1050,10 @@ m32r_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, { if (write) fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%d,write)\n", - paddr (memaddr), len); + paddress (target_gdbarch, memaddr), len); else fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory(%s,%d,read)\n", - paddr (memaddr), len); + paddress (target_gdbarch, memaddr), len); } if (write) @@ -1150,7 +1150,7 @@ m32r_insert_breakpoint (struct gdbarch *gdbarch, if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_insert_breakpoint(%s,...)\n", - paddr (addr)); + paddress (gdbarch, addr)); if (use_ib_breakpoints) ib_breakpoints = max_ib_breakpoints; @@ -1192,7 +1192,7 @@ m32r_remove_breakpoint (struct gdbarch *gdbarch, if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_remove_breakpoint(%s)\n", - paddr (addr)); + paddress (gdbarch, addr)); for (i = 0; i < MAX_BREAKPOINTS; i++) { @@ -1419,7 +1419,7 @@ m32r_insert_watchpoint (CORE_ADDR addr, int len, int type) if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%d,%d)\n", - paddr (addr), len, type); + paddress (target_gdbarch, addr), len, type); for (i = 0; i < MAX_ACCESS_BREAKS; i++) { @@ -1443,7 +1443,7 @@ m32r_remove_watchpoint (CORE_ADDR addr, int len, int type) if (remote_debug) fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%d,%d)\n", - paddr (addr), len, type); + paddress (target_gdbarch, addr), len, type); for (i = 0; i < MAX_ACCESS_BREAKS; i++) { diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index b9fa028..ea6e819 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1187,6 +1187,7 @@ mips_request (int cmd, int timeout, char *buff) { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; char myBuff[DATA_MAXLEN + 1]; int len; int rpid; @@ -1202,7 +1203,8 @@ mips_request (int cmd, if (mips_need_reply) internal_error (__FILE__, __LINE__, _("mips_request: Trying to send command before reply")); - sprintf (buff, "0x0 %c 0x%s 0x%s", cmd, paddr_nz (addr), paddr_nz (data)); + sprintf (buff, "0x0 %c 0x%s 0x%s", cmd, + phex_nz (addr, addr_size), phex_nz (data, addr_size)); mips_send_packet (buff, 1); mips_need_reply = 1; } @@ -1993,8 +1995,8 @@ mips_fetch_word (CORE_ADDR addr) val = mips_request ('i', addr, 0, &err, mips_receive_wait, NULL); if (err) - mips_error ("Can't read address 0x%s: %s", - paddr_nz (addr), safe_strerror (errno)); + mips_error ("Can't read address %s: %s", + paddress (target_gdbarch, addr), safe_strerror (errno)); } return val; } @@ -2341,7 +2343,7 @@ static int mips_check_lsi_error (CORE_ADDR addr, int rerrflg) { struct lsi_error *err; - char *saddr = paddr_nz (addr); /* printable address string */ + char *saddr = paddress (target_gdbarch, addr); if (rerrflg == 0) /* no error */ return 0; @@ -2358,14 +2360,14 @@ mips_check_lsi_error (CORE_ADDR addr, int rerrflg) { found = 1; fprintf_unfiltered (gdb_stderr, "\ -mips_common_breakpoint (0x%s): Warning: %s\n", +mips_common_breakpoint (%s): Warning: %s\n", saddr, err->string); } } if (!found) fprintf_unfiltered (gdb_stderr, "\ -mips_common_breakpoint (0x%s): Unknown warning: 0x%x\n", +mips_common_breakpoint (%s): Unknown warning: 0x%x\n", saddr, rerrflg); } @@ -2378,14 +2380,14 @@ mips_common_breakpoint (0x%s): Unknown warning: 0x%x\n", if ((err->code & rerrflg) == err->code) { fprintf_unfiltered (gdb_stderr, "\ -mips_common_breakpoint (0x%s): Error: %s\n", +mips_common_breakpoint (%s): Error: %s\n", saddr, err->string); return 1; } } fprintf_unfiltered (gdb_stderr, "\ -mips_common_breakpoint (0x%s): Unknown error: 0x%x\n", +mips_common_breakpoint (%s): Unknown error: 0x%x\n", saddr, rerrflg); return 1; @@ -2408,6 +2410,7 @@ mips_common_breakpoint (0x%s): Unknown error: 0x%x\n", static int mips_common_breakpoint (int set, CORE_ADDR addr, int len, enum break_type type) { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; char buf[DATA_MAXLEN + 1]; char cmd, rcmd; int rpid, rerrflg, rresponse, rlen; @@ -2441,7 +2444,7 @@ mips_common_breakpoint (int set, CORE_ADDR addr, int len, enum break_type type) { warning ("\ mips_common_breakpoint: Attempt to clear bogus breakpoint at %s\n", - paddr_nz (addr)); + paddress (target_gdbarch, addr)); return 1; } @@ -2490,15 +2493,16 @@ mips_common_breakpoint: Bad response from remote board: %s", if (type == BREAK_FETCH) /* instruction breakpoint */ { cmd = 'B'; - sprintf (buf, "0x0 B 0x%s 0x0", paddr_nz (addr)); + sprintf (buf, "0x0 B 0x%s 0x0", phex_nz (addr, addr_size)); } else /* watchpoint */ { cmd = 'A'; - sprintf (buf, "0x0 A 0x%s 0x%x 0x%s", paddr_nz (addr), - type == BREAK_READ ? 1 : (type == BREAK_WRITE ? 2 : 3), - paddr_nz (addr + len - 1)); + sprintf (buf, "0x0 A 0x%s 0x%x 0x%s", + phex_nz (addr, addr_size), + type == BREAK_READ ? 1 : (type == BREAK_WRITE ? 2 : 3), + phex_nz (addr + len - 1, addr_size)); } mips_send_packet (buf, 1); @@ -2559,13 +2563,13 @@ mips_common_breakpoint: Bad response from remote board: %s", } cmd = 'B'; - sprintf (buf, "0x0 B 0x%s 0x%s %s", paddr_nz (addr), - paddr_nz (mask), flags); + sprintf (buf, "0x0 B 0x%s 0x%s %s", phex_nz (addr, addr_size), + phex_nz (mask, addr_size), flags); } else { cmd = 'b'; - sprintf (buf, "0x0 b 0x%s", paddr_nz (addr)); + sprintf (buf, "0x0 b 0x%s", phex_nz (addr, addr_size)); } mips_send_packet (buf, 1); @@ -2589,8 +2593,8 @@ mips_common_breakpoint: Bad response from remote board: %s", rresponse = rerrflg; if (rresponse != 22) /* invalid argument */ fprintf_unfiltered (gdb_stderr, "\ -mips_common_breakpoint (0x%s): Got error: 0x%x\n", - paddr_nz (addr), rresponse); +mips_common_breakpoint (%s): Got error: 0x%x\n", + paddress (target_gdbarch, addr), rresponse); return 1; } } @@ -2616,7 +2620,8 @@ send_srec (char *srec, int len, CORE_ADDR addr) case 0x6: /* ACK */ return; case 0x15: /* NACK */ - fprintf_unfiltered (gdb_stderr, "Download got a NACK at byte 0x%s! Retrying.\n", paddr_nz (addr)); + fprintf_unfiltered (gdb_stderr, "Download got a NACK at byte %s! Retrying.\n", + paddress (target_gdbarch, addr)); continue; default: error ("Download got unexpected ack char: 0x%x, retrying.\n", ch); diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 3f3075a..7ca16c7 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -771,8 +771,8 @@ gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, /* FIXME: Send to something other than STDOUT? */ printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x"); gdb_print_host_address (myaddr, gdb_stdout); - printf_filtered (", memaddr 0x%s, len %d, write %d\n", - paddr_nz (memaddr), len, write); + printf_filtered (", memaddr %s, len %d, write %d\n", + paddress (target_gdbarch, memaddr), len, write); if (remote_debug && write) dump_mem (myaddr, len); } diff --git a/gdb/remote.c b/gdb/remote.c index 297e784..756186f 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2877,6 +2877,7 @@ remote_check_symbols (struct objfile *objfile) xsnprintf (msg, get_remote_packet_size (), "qSymbol::%s", &reply[8]); else { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; CORE_ADDR sym_addr = SYMBOL_VALUE_ADDRESS (sym); /* If this is a function address, return the start of code @@ -2886,7 +2887,7 @@ remote_check_symbols (struct objfile *objfile) ¤t_target); xsnprintf (msg, get_remote_packet_size (), "qSymbol:%s:%s", - paddr_nz (sym_addr), &reply[8]); + phex_nz (sym_addr, addr_size), &reply[8]); } putpkt (msg); @@ -5818,6 +5819,7 @@ static void remote_flash_erase (struct target_ops *ops, ULONGEST address, LONGEST length) { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; int saved_remote_timeout = remote_timeout; enum packet_result ret; @@ -5826,7 +5828,7 @@ remote_flash_erase (struct target_ops *ops, remote_timeout = remote_flash_timeout; ret = remote_send_printf ("vFlashErase:%s,%s", - paddr (address), + phex (address, addr_size), phex (length, 4)); switch (ret) { @@ -7169,16 +7171,18 @@ compare_sections_command (char *args, int from_tty) getpkt (&rs->buf, &rs->buf_size, 0); if (rs->buf[0] == 'E') - error (_("target memory fault, section %s, range 0x%s -- 0x%s"), - sectname, paddr (lma), paddr (lma + size)); + error (_("target memory fault, section %s, range %s -- %s"), sectname, + paddress (target_gdbarch, lma), + paddress (target_gdbarch, lma + size)); if (rs->buf[0] != 'C') error (_("remote target does not support this operation")); for (target_crc = 0, tmp = &rs->buf[1]; *tmp; tmp++) target_crc = target_crc * 16 + fromhex (*tmp); - printf_filtered ("Section %s, range 0x%s -- 0x%s: ", - sectname, paddr (lma), paddr (lma + size)); + printf_filtered ("Section %s, range %s -- %s: ", sectname, + paddress (target_gdbarch, lma), + paddress (target_gdbarch, lma + size)); if (host_crc == target_crc) printf_filtered ("matched.\n"); else @@ -7498,6 +7502,7 @@ remote_search_memory (struct target_ops* ops, const gdb_byte *pattern, ULONGEST pattern_len, CORE_ADDR *found_addrp) { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; struct remote_state *rs = get_remote_state (); int max_size = get_memory_write_packet_size (); struct packet_config *packet = @@ -7536,7 +7541,7 @@ remote_search_memory (struct target_ops* ops, /* Insert header. */ i = snprintf (rs->buf, max_size, "qSearch:memory:%s;%s;", - paddr_nz (start_addr), + phex_nz (start_addr, addr_size), phex_nz (search_space_len, sizeof (search_space_len))); max_size -= (i + 1); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 6779581..e23d455 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -983,8 +983,8 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, - "displaced: (ppc) fixup (0x%s, 0x%s)\n", - paddr_nz (from), paddr_nz (to)); + "displaced: (ppc) fixup (%s, %s)\n", + paddress (gdbarch, from), paddress (gdbarch, to)); /* Handle PC-relative branch instructions. */ @@ -1009,10 +1009,10 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, if (debug_displaced) fprintf_unfiltered (gdb_stdlog, - "displaced: (ppc) branch instruction: 0x%s\n" - "displaced: (ppc) adjusted PC from 0x%s to 0x%s\n", - paddr_nz (insn), paddr_nz (current_pc), - paddr_nz (from + offset)); + "displaced: (ppc) branch instruction: %s\n" + "displaced: (ppc) adjusted PC from %s to %s\n", + paddress (gdbarch, insn), paddress (gdbarch, current_pc), + paddress (gdbarch, from + offset)); regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch), from + offset); @@ -1040,8 +1040,8 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, from + PPC_INSN_SIZE); if (debug_displaced) fprintf_unfiltered (gdb_stdlog, - "displaced: (ppc) adjusted LR to 0x%s\n", - paddr_nz (from + PPC_INSN_SIZE)); + "displaced: (ppc) adjusted LR to %s\n", + paddress (gdbarch, from + PPC_INSN_SIZE)); } } diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c index 5200b79..d074a51 100644 --- a/gdb/scm-valprint.c +++ b/gdb/scm-valprint.c @@ -170,7 +170,7 @@ scm_ipruk (char *hdr, struct type *type, LONGEST ptr, if (SCM_CELLP (ptr)) fprintf_filtered (stream, " (0x%lx . 0x%lx) @", (long) SCM_CAR (ptr), (long) SCM_CDR (ptr)); - fprintf_filtered (stream, " 0x%s>", paddr_nz (ptr)); + fprintf_filtered (stream, " 0x%s>", phex_nz (ptr, SCM_SIZE)); #undef SCM_SIZE } @@ -245,7 +245,7 @@ taloop: (sizet) LENGTH (name), port); #endif - fprintf_filtered (stream, " #X%s>", paddr_nz (svalue)); + fprintf_filtered (stream, " #X%s>", phex_nz (svalue, SCM_SIZE)); break; } case scm_tcs_cons_imcar: diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 47e0bec..df2408c 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1418,9 +1418,9 @@ sh_generic_show_regs (struct frame_info *frame) { printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum - (get_frame_arch (frame)))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum + (get_frame_arch (frame))), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -1458,9 +1458,9 @@ sh3_show_regs (struct frame_info *frame) { printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum - (get_frame_arch (frame)))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum + (get_frame_arch (frame))), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -1503,8 +1503,8 @@ sh2e_show_regs (struct frame_info *frame) struct gdbarch *gdbarch = get_frame_arch (frame); printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum (gdbarch))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum (gdbarch)), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -1588,8 +1588,8 @@ sh2a_show_regs (struct frame_info *frame) printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum (gdbarch))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum (gdbarch)), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -1703,9 +1703,9 @@ sh2a_nofpu_show_regs (struct frame_info *frame) printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum - (get_frame_arch (frame)))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum + (get_frame_arch (frame))), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -1780,8 +1780,8 @@ sh3e_show_regs (struct frame_info *frame) struct gdbarch *gdbarch = get_frame_arch (frame); printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum (gdbarch))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum (gdbarch)), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -1862,9 +1862,9 @@ sh3_dsp_show_regs (struct frame_info *frame) { printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum - (get_frame_arch (frame)))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum + (get_frame_arch (frame))), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -1929,8 +1929,8 @@ sh4_show_regs (struct frame_info *frame) printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum (gdbarch))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum (gdbarch)), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -2013,9 +2013,9 @@ sh4_nofpu_show_regs (struct frame_info *frame) { printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum - (get_frame_arch (frame)))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum + (get_frame_arch (frame))), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); @@ -2059,9 +2059,9 @@ sh_dsp_show_regs (struct frame_info *frame) { printf_filtered (" PC %s SR %08lx PR %08lx MACH %08lx\n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum - (get_frame_arch (frame)))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum + (get_frame_arch (frame))), 4), (long) get_frame_register_unsigned (frame, SR_REGNUM), (long) get_frame_register_unsigned (frame, PR_REGNUM), (long) get_frame_register_unsigned (frame, MACH_REGNUM)); diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 0214007..c6e5042 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -1316,8 +1316,8 @@ sh64_show_media_regs (struct frame_info *frame) printf_filtered ("PC=%s SR=%016llx \n", - paddr (get_frame_register_unsigned (frame, - gdbarch_pc_regnum (gdbarch))), + phex (get_frame_register_unsigned (frame, + gdbarch_pc_regnum (gdbarch)), 8), (long long) get_frame_register_unsigned (frame, SR_REGNUM)); printf_filtered @@ -1369,7 +1369,7 @@ sh64_show_compact_regs (struct frame_info *frame) printf_filtered ("PC=%s \n", - paddr (get_frame_register_unsigned (frame, PC_C_REGNUM))); + phex (get_frame_register_unsigned (frame, PC_C_REGNUM), 8)); printf_filtered ("GBR=%08lx MACH=%08lx MACL=%08lx PR=%08lx T=%08lx\n", diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 1b0489c..3aa9440 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1250,7 +1250,8 @@ info_cb (const td_thrhandle_t *th, void *s) printf_filtered (" startfunc: %s\n", SYMBOL_PRINT_NAME (msym)); else - printf_filtered (" startfunc: 0x%s\n", paddr (ti.ti_startfunc)); + printf_filtered (" startfunc: %s\n", + paddress (target_gdbarch, ti.ti_startfunc)); } /* If thread is asleep, print function that went to sleep. */ @@ -1262,7 +1263,8 @@ info_cb (const td_thrhandle_t *th, void *s) printf_filtered (" - Sleep func: %s\n", SYMBOL_PRINT_NAME (msym)); else - printf_filtered (" - Sleep func: 0x%s\n", paddr (ti.ti_startfunc)); + printf_filtered (" - Sleep func: %s\n", + paddress (target_gdbarch, ti.ti_startfunc)); } /* Wrap up line, if necessary. */ diff --git a/gdb/solib-som.c b/gdb/solib-som.c index f16bba3..4508017 100644 --- a/gdb/solib-som.c +++ b/gdb/solib-som.c @@ -639,28 +639,28 @@ som_current_sos (void) lmi->tsd_start_addr = extract_unsigned_integer (tsdbuf, 4); #ifdef SOLIB_SOM_DBG - printf ("\n+ library \"%s\" is described at 0x%s\n", new->so_name, - paddr_nz (lm)); + printf ("\n+ library \"%s\" is described at %s\n", new->so_name, + paddress (target_gdbarch, lm)); printf (" 'version' is %d\n", new->lm_info->struct_version); printf (" 'bind_mode' is %d\n", new->lm_info->bind_mode); printf (" 'library_version' is %d\n", new->lm_info->library_version); - printf (" 'text_addr' is 0x%s\n", - paddr_nz (new->lm_info->text_addr)); - printf (" 'text_link_addr' is 0x%s\n", - paddr_nz (new->lm_info->text_link_addr)); - printf (" 'text_end' is 0x%s\n", - paddr_nz (new->lm_info->text_end)); - printf (" 'data_start' is 0x%s\n", - paddr_nz (new->lm_info->data_start)); - printf (" 'bss_start' is 0x%s\n", - paddr_nz (new->lm_info->bss_start)); - printf (" 'data_end' is 0x%s\n", - paddr_nz (new->lm_info->data_end)); - printf (" 'got_value' is %s\n", - paddr_nz (new->lm_info->got_value)); - printf (" 'tsd_start_addr' is 0x%s\n", - paddr_nz (new->lm_info->tsd_start_addr)); + printf (" 'text_addr' is %s\n", + paddress (target_gdbarch, new->lm_info->text_addr)); + printf (" 'text_link_addr' is %s\n", + paddress (target_gdbarch, new->lm_info->text_link_addr)); + printf (" 'text_end' is %s\n", + paddress (target_gdbarch, new->lm_info->text_end)); + printf (" 'data_start' is %s\n", + paddress (target_gdbarch, new->lm_info->data_start)); + printf (" 'bss_start' is %s\n", + paddress (target_gdbarch, new->lm_info->bss_start)); + printf (" 'data_end' is %s\n", + paddress (target_gdbarch, new->lm_info->data_end)); + printf (" 'got_value' is %s\n", + paddress (target_gdbarch, new->lm_info->got_value)); + printf (" 'tsd_start_addr' is %s\n", + paddress (target_gdbarch, new->lm_info->tsd_start_addr)); #endif new->addr_low = lmi->text_addr; diff --git a/gdb/source.c b/gdb/source.c index 29194aa..d534ab3 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "defs.h" +#include "arch-utils.h" #include "symtab.h" #include "expression.h" #include "language.h" @@ -1295,7 +1296,7 @@ identify_source_line (struct symtab *s, int line, int mid_statement, /* Don't index off the end of the line_charpos array. */ return 0; annotate_source (s->fullname, line, s->line_charpos[line - 1], - mid_statement, pc); + mid_statement, get_objfile_arch (s->objfile), pc); current_source_line = line; first_line_listed = line; @@ -1474,6 +1475,8 @@ line_info (char *arg, int from_tty) if (sal.symtab == 0) { + struct gdbarch *gdbarch = get_current_arch (); + printf_filtered (_("No line number information available")); if (sal.pc != 0) { @@ -1482,7 +1485,7 @@ line_info (char *arg, int from_tty) address. */ printf_filtered (" for address "); wrap_here (" "); - print_address (sal.pc, gdb_stdout); + print_address (gdbarch, sal.pc, gdb_stdout); } else printf_filtered ("."); @@ -1491,13 +1494,15 @@ line_info (char *arg, int from_tty) else if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc)) { + struct gdbarch *gdbarch = get_objfile_arch (sal.symtab->objfile); + if (start_pc == end_pc) { printf_filtered ("Line %d of \"%s\"", sal.line, sal.symtab->filename); wrap_here (" "); printf_filtered (" is at address "); - print_address (start_pc, gdb_stdout); + print_address (gdbarch, start_pc, gdb_stdout); wrap_here (" "); printf_filtered (" but contains no code.\n"); } @@ -1507,15 +1512,15 @@ line_info (char *arg, int from_tty) sal.line, sal.symtab->filename); wrap_here (" "); printf_filtered (" starts at address "); - print_address (start_pc, gdb_stdout); + print_address (gdbarch, start_pc, gdb_stdout); wrap_here (" "); printf_filtered (" and ends at "); - print_address (end_pc, gdb_stdout); + print_address (gdbarch, end_pc, gdb_stdout); printf_filtered (".\n"); } /* x/i should display this line's code. */ - set_next_address (get_objfile_arch (sal.symtab->objfile), start_pc); + set_next_address (gdbarch, start_pc); /* Repeating "info line" should do the following line. */ last_line_listed = sal.line + 1; diff --git a/gdb/stack.c b/gdb/stack.c index a77fe5e..757e109 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -520,6 +520,7 @@ void print_frame_info (struct frame_info *frame, int print_level, enum print_what print_what, int print_args) { + struct gdbarch *gdbarch = get_frame_arch (frame); struct symtab_and_line sal; int source_print; int location_print; @@ -532,7 +533,7 @@ print_frame_info (struct frame_info *frame, int print_level, = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); annotate_frame_begin (print_level ? frame_relative_level (frame) : 0, - get_frame_pc (frame)); + gdbarch, get_frame_pc (frame)); /* Do this regardless of SOURCE because we don't have any source to list for this frame. */ @@ -545,7 +546,8 @@ print_frame_info (struct frame_info *frame, int print_level, if (ui_out_is_mi_like_p (uiout)) { annotate_frame_address (); - ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame)); + ui_out_field_core_addr (uiout, "addr", + gdbarch, get_frame_pc (frame)); annotate_frame_address_end (); } @@ -624,7 +626,8 @@ print_frame_info (struct frame_info *frame, int print_level, ability to decide for themselves if it is desired. */ if (opts.addressprint && mid_statement) { - ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame)); + ui_out_field_core_addr (uiout, "addr", + gdbarch, get_frame_pc (frame)); ui_out_text (uiout, "\t"); } @@ -735,6 +738,7 @@ print_frame (struct frame_info *frame, int print_level, enum print_what print_what, int print_args, struct symtab_and_line sal) { + struct gdbarch *gdbarch = get_frame_arch (frame); char *funname = NULL; enum language funlang = language_unknown; struct ui_stream *stb; @@ -747,7 +751,7 @@ print_frame (struct frame_info *frame, int print_level, find_frame_funname (frame, &funname, &funlang); annotate_frame_begin (print_level ? frame_relative_level (frame) : 0, - get_frame_pc (frame)); + gdbarch, get_frame_pc (frame)); list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "frame"); @@ -763,7 +767,7 @@ print_frame (struct frame_info *frame, int print_level, || print_what == LOC_AND_ADDRESS) { annotate_frame_address (); - ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame)); + ui_out_field_core_addr (uiout, "addr", gdbarch, get_frame_pc (frame)); annotate_frame_address_end (); ui_out_text (uiout, " in "); } @@ -1052,10 +1056,10 @@ frame_info (char *addr_exp, int from_tty) { printf_filtered (_("Stack frame at ")); } - fputs_filtered (paddress (get_frame_base (fi)), gdb_stdout); + fputs_filtered (paddress (gdbarch, get_frame_base (fi)), gdb_stdout); printf_filtered (":\n"); printf_filtered (" %s = ", pc_regname); - fputs_filtered (paddress (get_frame_pc (fi)), gdb_stdout); + fputs_filtered (paddress (gdbarch, get_frame_pc (fi)), gdb_stdout); wrap_here (" "); if (funname) @@ -1070,7 +1074,7 @@ frame_info (char *addr_exp, int from_tty) puts_filtered ("; "); wrap_here (" "); printf_filtered ("saved %s ", pc_regname); - fputs_filtered (paddress (frame_unwind_caller_pc (fi)), gdb_stdout); + fputs_filtered (paddress (gdbarch, frame_unwind_caller_pc (fi)), gdb_stdout); printf_filtered ("\n"); if (calling_frame_info == NULL) @@ -1088,7 +1092,7 @@ frame_info (char *addr_exp, int from_tty) else { printf_filtered (" called by frame at "); - fputs_filtered (paddress (get_frame_base (calling_frame_info)), + fputs_filtered (paddress (gdbarch, get_frame_base (calling_frame_info)), gdb_stdout); } if (get_next_frame (fi) && calling_frame_info) @@ -1097,7 +1101,7 @@ frame_info (char *addr_exp, int from_tty) if (get_next_frame (fi)) { printf_filtered (" caller of frame at "); - fputs_filtered (paddress (get_frame_base (get_next_frame (fi))), + fputs_filtered (paddress (gdbarch, get_frame_base (get_next_frame (fi))), gdb_stdout); } if (get_next_frame (fi) || calling_frame_info) @@ -1118,7 +1122,7 @@ frame_info (char *addr_exp, int from_tty) else { printf_filtered (" Arglist at "); - fputs_filtered (paddress (arg_list), gdb_stdout); + fputs_filtered (paddress (gdbarch, arg_list), gdb_stdout); printf_filtered (","); if (!gdbarch_frame_num_args_p (gdbarch)) @@ -1150,7 +1154,7 @@ frame_info (char *addr_exp, int from_tty) else { printf_filtered (" Locals at "); - fputs_filtered (paddress (arg_list), gdb_stdout); + fputs_filtered (paddress (gdbarch, arg_list), gdb_stdout); printf_filtered (","); } } @@ -1192,14 +1196,14 @@ frame_info (char *addr_exp, int from_tty) register_size (gdbarch, gdbarch_sp_regnum (gdbarch))); printf_filtered (" Previous frame's sp is "); - fputs_filtered (paddress (sp), gdb_stdout); + fputs_filtered (paddress (gdbarch, sp), gdb_stdout); printf_filtered ("\n"); need_nl = 0; } else if (!optimized && lval == lval_memory) { printf_filtered (" Previous frame's sp at "); - fputs_filtered (paddress (addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, addr), gdb_stdout); printf_filtered ("\n"); need_nl = 0; } @@ -1234,7 +1238,7 @@ frame_info (char *addr_exp, int from_tty) wrap_here (" "); printf_filtered (" %s at ", gdbarch_register_name (gdbarch, i)); - fputs_filtered (paddress (addr), gdb_stdout); + fputs_filtered (paddress (gdbarch, addr), gdb_stdout); count++; } } @@ -1485,8 +1489,8 @@ print_block_frame_locals (struct block *b, struct frame_info *frame, /* Same, but print labels. */ static int -print_block_frame_labels (struct block *b, int *have_default, - struct ui_file *stream) +print_block_frame_labels (struct gdbarch *gdbarch, struct block *b, + int *have_default, struct ui_file *stream) { struct dict_iterator iter; struct symbol *sym; @@ -1511,7 +1515,8 @@ print_block_frame_labels (struct block *b, int *have_default, if (opts.addressprint) { fprintf_filtered (stream, " "); - fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (sym)), stream); + fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (sym)), + stream); } fprintf_filtered (stream, " in file %s, line %d\n", sal.symtab->filename, sal.line); @@ -1568,6 +1573,7 @@ print_frame_label_vars (struct frame_info *frame, int this_level_only, #else struct blockvector *bl; struct block *block = get_frame_block (frame, 0); + struct gdbarch *gdbarch = get_frame_arch (frame); int values_printed = 0; int index, have_default = 0; char *blocks_printed; @@ -1605,7 +1611,8 @@ print_frame_label_vars (struct frame_info *frame, int this_level_only, { if (blocks_printed[index] == 0) { - if (print_block_frame_labels (BLOCKVECTOR_BLOCK (bl, index), + if (print_block_frame_labels (gdbarch, + BLOCKVECTOR_BLOCK (bl, index), &have_default, stream)) values_printed = 1; blocks_printed[index] = 1; diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index 0c0640f..c7d6d37 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -196,8 +196,8 @@ try using the \"file\" command first.")); } args.bfd = bfd; args.sysinfo_ehdr = sysinfo_ehdr; - args.name = xstrprintf ("system-supplied DSO at 0x%s", - paddr_nz (sysinfo_ehdr)); + args.name = xstrprintf ("system-supplied DSO at %s", + paddress (target_gdbarch, sysinfo_ehdr)); /* Pass zero for FROM_TTY, because the action of loading the vsyscall DSO was not triggered by the user, even if the user typed "run" at the TTY. */ diff --git a/gdb/symfile.c b/gdb/symfile.c index cecbda4..20ae85f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1800,9 +1800,9 @@ load_progress (ULONGEST bytes, void *untyped_arg) { /* The write is just starting. Let the user know we've started this section. */ - ui_out_message (uiout, 0, "Loading section %s, size 0x%s lma 0x%s\n", - args->section_name, paddr_nz (args->section_size), - paddr_nz (args->lma)); + ui_out_message (uiout, 0, "Loading section %s, size %s lma %s\n", + args->section_name, hex_string (args->section_size), + paddress (target_gdbarch, args->lma)); return; } @@ -1819,11 +1819,11 @@ load_progress (ULONGEST bytes, void *untyped_arg) struct cleanup *verify_cleanups = make_cleanup (xfree, check); if (target_read_memory (args->lma, check, bytes) != 0) - error (_("Download verify read failed at 0x%s"), - paddr (args->lma)); + error (_("Download verify read failed at %s"), + paddress (target_gdbarch, args->lma)); if (memcmp (args->buffer, check, bytes) != 0) - error (_("Download verify compare failed at 0x%s"), - paddr (args->lma)); + error (_("Download verify compare failed at %s"), + paddress (target_gdbarch, args->lma)); do_cleanups (verify_cleanups); } totals->data_count += bytes; @@ -1979,7 +1979,7 @@ generic_load (char *args, int from_tty) entry = bfd_get_start_address (loadfile_bfd); ui_out_text (uiout, "Start address "); - ui_out_field_fmt (uiout, "address", "0x%s", paddr_nz (entry)); + ui_out_field_fmt (uiout, "address", "%s", paddress (target_gdbarch, entry)); ui_out_text (uiout, ", load size "); ui_out_field_fmt (uiout, "load-size", "%lu", total_progress.data_count); ui_out_text (uiout, "\n"); @@ -2081,6 +2081,7 @@ print_transfer_performance (struct ui_file *stream, static void add_symbol_file_command (char *args, int from_tty) { + struct gdbarch *gdbarch = get_current_arch (); char *filename = NULL; int flags = OBJF_USERLOADED; char *arg; @@ -2211,7 +2212,8 @@ add_symbol_file_command (char *args, int from_tty) entered on the command line. */ section_addrs->other[sec_num].name = sec; section_addrs->other[sec_num].addr = addr; - printf_unfiltered ("\t%s_addr = %s\n", sec, paddress (addr)); + printf_unfiltered ("\t%s_addr = %s\n", sec, + paddress (gdbarch, addr)); sec_num++; /* The object's sections are initialized when a @@ -3503,6 +3505,7 @@ list_overlays_command (char *args, int from_tty) ALL_OBJSECTIONS (objfile, osect) if (section_is_mapped (osect)) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); const char *name; bfd_vma lma, vma; int size; @@ -3513,13 +3516,13 @@ list_overlays_command (char *args, int from_tty) name = bfd_section_name (objfile->obfd, osect->the_bfd_section); printf_filtered ("Section %s, loaded at ", name); - fputs_filtered (paddress (lma), gdb_stdout); + fputs_filtered (paddress (gdbarch, lma), gdb_stdout); puts_filtered (" - "); - fputs_filtered (paddress (lma + size), gdb_stdout); + fputs_filtered (paddress (gdbarch, lma + size), gdb_stdout); printf_filtered (", mapped at "); - fputs_filtered (paddress (vma), gdb_stdout); + fputs_filtered (paddress (gdbarch, vma), gdb_stdout); puts_filtered (" - "); - fputs_filtered (paddress (vma + size), gdb_stdout); + fputs_filtered (paddress (gdbarch, vma + size), gdb_stdout); puts_filtered ("\n"); nmapped++; diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 96fabc3..eb35369 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -67,13 +67,15 @@ static void dump_objfile (struct objfile *); static int block_depth (struct block *); -static void print_partial_symbols (struct partial_symbol **, int, +static void print_partial_symbols (struct gdbarch *, + struct partial_symbol **, int, char *, struct ui_file *); void _initialize_symmisc (void); struct print_symbol_args { + struct gdbarch *gdbarch; struct symbol *symbol; int depth; struct ui_file *outfile; @@ -261,6 +263,7 @@ dump_objfile (struct objfile *objfile) static void dump_msymbols (struct objfile *objfile, struct ui_file *outfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct minimal_symbol *msymbol; int index; char ms_type; @@ -310,7 +313,8 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) break; } fprintf_filtered (outfile, "[%2d] %c ", index, ms_type); - fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (msymbol)), outfile); + fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (msymbol)), + outfile); fprintf_filtered (outfile, " %s", SYMBOL_LINKAGE_NAME (msymbol)); if (section) fprintf_filtered (outfile, " section %s", @@ -337,6 +341,7 @@ static void dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, struct ui_file *outfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); int i; fprintf_filtered (outfile, "\nPartial symtab for source file %s ", @@ -365,15 +370,16 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, if (i != 0) fprintf_filtered (outfile, ", "); wrap_here (" "); - fputs_filtered (paddress (ANOFFSET (psymtab->section_offsets, i)), + fputs_filtered (paddress (gdbarch, + ANOFFSET (psymtab->section_offsets, i)), outfile); } fprintf_filtered (outfile, "\n"); fprintf_filtered (outfile, " Symbols cover text addresses "); - fputs_filtered (paddress (psymtab->textlow), outfile); + fputs_filtered (paddress (gdbarch, psymtab->textlow), outfile); fprintf_filtered (outfile, "-"); - fputs_filtered (paddress (psymtab->texthigh), outfile); + fputs_filtered (paddress (gdbarch, psymtab->texthigh), outfile); fprintf_filtered (outfile, "\n"); fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n", psymtab->number_of_dependencies); @@ -386,13 +392,15 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, } if (psymtab->n_global_syms > 0) { - print_partial_symbols (objfile->global_psymbols.list + print_partial_symbols (gdbarch, + objfile->global_psymbols.list + psymtab->globals_offset, psymtab->n_global_syms, "Global", outfile); } if (psymtab->n_static_syms > 0) { - print_partial_symbols (objfile->static_psymbols.list + print_partial_symbols (gdbarch, + objfile->static_psymbols.list + psymtab->statics_offset, psymtab->n_static_syms, "Static", outfile); } @@ -403,6 +411,7 @@ static void dump_symtab_1 (struct objfile *objfile, struct symtab *symtab, struct ui_file *outfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); int i; struct dict_iterator iter; int len, blen; @@ -430,7 +439,7 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab, for (i = 0; i < len; i++) { fprintf_filtered (outfile, " line %d at ", l->item[i].line); - fputs_filtered (paddress (l->item[i].pc), outfile); + fputs_filtered (paddress (gdbarch, l->item[i].pc), outfile); fprintf_filtered (outfile, "\n"); } } @@ -458,9 +467,9 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab, wants it. */ fprintf_filtered (outfile, ", %d syms/buckets in ", dict_size (BLOCK_DICT (b))); - fputs_filtered (paddress (BLOCK_START (b)), outfile); + fputs_filtered (paddress (gdbarch, BLOCK_START (b)), outfile); fprintf_filtered (outfile, ".."); - fputs_filtered (paddress (BLOCK_END (b)), outfile); + fputs_filtered (paddress (gdbarch, BLOCK_END (b)), outfile); if (BLOCK_FUNCTION (b)) { fprintf_filtered (outfile, ", function %s", @@ -477,6 +486,7 @@ dump_symtab_1 (struct objfile *objfile, struct symtab *symtab, ALL_BLOCK_SYMBOLS (b, iter, sym) { struct print_symbol_args s; + s.gdbarch = gdbarch; s.symbol = sym; s.depth = depth + 1; s.outfile = outfile; @@ -570,6 +580,7 @@ Arguments missing: an output file name and an optional symbol file name")); static int print_symbol (void *args) { + struct gdbarch *gdbarch = ((struct print_symbol_args *) args)->gdbarch; struct symbol *symbol = ((struct print_symbol_args *) args)->symbol; int depth = ((struct print_symbol_args *) args)->depth; struct ui_file *outfile = ((struct print_symbol_args *) args)->outfile; @@ -579,7 +590,8 @@ print_symbol (void *args) if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN) { fprintf_filtered (outfile, "label %s at ", SYMBOL_PRINT_NAME (symbol)); - fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (symbol)), outfile); + fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), + outfile); if (section) fprintf_filtered (outfile, " section %s\n", bfd_section_name (section->the_bfd_section->owner, @@ -644,7 +656,8 @@ print_symbol (void *args) case LOC_STATIC: fprintf_filtered (outfile, "static at "); - fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (symbol)), outfile); + fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), + outfile); if (section) fprintf_filtered (outfile, " section %s", bfd_section_name (section->the_bfd_section->owner, @@ -682,7 +695,8 @@ print_symbol (void *args) case LOC_LABEL: fprintf_filtered (outfile, "label at "); - fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (symbol)), outfile); + fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), + outfile); if (section) fprintf_filtered (outfile, " section %s", bfd_section_name (section->the_bfd_section->owner, @@ -693,10 +707,12 @@ print_symbol (void *args) fprintf_filtered (outfile, "block object "); gdb_print_host_address (SYMBOL_BLOCK_VALUE (symbol), outfile); fprintf_filtered (outfile, ", "); - fputs_filtered (paddress (BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))), + fputs_filtered (paddress (gdbarch, + BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))), outfile); fprintf_filtered (outfile, ".."); - fputs_filtered (paddress (BLOCK_END (SYMBOL_BLOCK_VALUE (symbol))), + fputs_filtered (paddress (gdbarch, + BLOCK_END (SYMBOL_BLOCK_VALUE (symbol))), outfile); if (section) fprintf_filtered (outfile, " section %s", @@ -773,7 +789,8 @@ maintenance_print_psymbols (char *args, int from_tty) } static void -print_partial_symbols (struct partial_symbol **p, int count, char *what, +print_partial_symbols (struct gdbarch *gdbarch, + struct partial_symbol **p, int count, char *what, struct ui_file *outfile) { fprintf_filtered (outfile, " %s partial symbols:\n", what); @@ -855,7 +872,7 @@ print_partial_symbols (struct partial_symbol **p, int count, char *what, break; } fputs_filtered (", ", outfile); - fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (*p)), outfile); + fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (*p)), outfile); fprintf_filtered (outfile, "\n"); p++; } @@ -995,6 +1012,7 @@ maintenance_info_psymtabs (char *regexp, int from_tty) ALL_OBJFILES (objfile) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); struct partial_symtab *psymtab; /* We don't want to print anything for this objfile until we @@ -1027,9 +1045,11 @@ maintenance_info_psymtabs (char *regexp, int from_tty) printf_filtered (" fullname %s\n", psymtab->fullname ? psymtab->fullname : "(null)"); printf_filtered (" text addresses "); - fputs_filtered (paddress (psymtab->textlow), gdb_stdout); + fputs_filtered (paddress (gdbarch, psymtab->textlow), + gdb_stdout); printf_filtered (" -- "); - fputs_filtered (paddress (psymtab->texthigh), gdb_stdout); + fputs_filtered (paddress (gdbarch, psymtab->texthigh), + gdb_stdout); printf_filtered ("\n"); printf_filtered (" globals "); if (psymtab->n_global_syms) @@ -1097,6 +1117,7 @@ maintenance_check_symtabs (char *ignore, int from_tty) ALL_PSYMTABS (objfile, ps) { + struct gdbarch *gdbarch = get_objfile_arch (objfile); s = PSYMTAB_TO_SYMTAB (ps); if (s == NULL) continue; @@ -1140,9 +1161,9 @@ maintenance_check_symtabs (char *ignore, int from_tty) printf_filtered ("Psymtab "); puts_filtered (ps->filename); printf_filtered (" covers bad range "); - fputs_filtered (paddress (ps->textlow), gdb_stdout); + fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout); printf_filtered (" - "); - fputs_filtered (paddress (ps->texthigh), gdb_stdout); + fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout); printf_filtered ("\n"); continue; } @@ -1153,13 +1174,13 @@ maintenance_check_symtabs (char *ignore, int from_tty) printf_filtered ("Psymtab "); puts_filtered (ps->filename); printf_filtered (" covers "); - fputs_filtered (paddress (ps->textlow), gdb_stdout); + fputs_filtered (paddress (gdbarch, ps->textlow), gdb_stdout); printf_filtered (" - "); - fputs_filtered (paddress (ps->texthigh), gdb_stdout); + fputs_filtered (paddress (gdbarch, ps->texthigh), gdb_stdout); printf_filtered (" but symtab covers only "); - fputs_filtered (paddress (BLOCK_START (b)), gdb_stdout); + fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout); printf_filtered (" - "); - fputs_filtered (paddress (BLOCK_END (b)), gdb_stdout); + fputs_filtered (paddress (gdbarch, BLOCK_END (b)), gdb_stdout); printf_filtered ("\n"); } } diff --git a/gdb/symtab.c b/gdb/symtab.c index e6211a0..009c52d 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2079,8 +2079,8 @@ find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section) will cause a core dump), but maybe we can successfully continue, so let's not. */ warning (_("\ -(Internal error: pc 0x%s in read in psymtab, but not in symtab.)\n"), - paddr_nz (pc)); +(Internal error: pc %s in read in psymtab, but not in symtab.)\n"), + paddress (get_objfile_arch (ps->objfile), pc)); s = PSYMTAB_TO_SYMTAB (ps); } return (s); diff --git a/gdb/target.c b/gdb/target.c index e1ebc04..e821d4b 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1464,7 +1464,7 @@ target_flash_erase (ULONGEST address, LONGEST length) { if (targetdebug) fprintf_unfiltered (gdb_stdlog, "target_flash_erase (%s, %s)\n", - paddr (address), phex (length, 0)); + hex_string (address), phex (length, 0)); t->to_flash_erase (t, address, length); return; } @@ -2871,8 +2871,8 @@ deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, fprintf_unfiltered (gdb_stdlog, "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d", - paddress (memaddr), len, write ? "write" : "read", - retval); + paddress (target_gdbarch, memaddr), len, + write ? "write" : "read", retval); if (retval > 0) { diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f3f8c29..ca40ca3 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2009-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + * gdb.threads/tls-shared.exp: Update to locexpr_describe_location + change to prefix TLS offset in hex with 0x. + +2009-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + * gdb.base/default.exp: Update test case for "x" changes. 2009-07-01 Tristan Gingold <gingold@adacore.com> diff --git a/gdb/testsuite/gdb.threads/tls-shared.exp b/gdb/testsuite/gdb.threads/tls-shared.exp index c1a7968..243d8ae 100644 --- a/gdb/testsuite/gdb.threads/tls-shared.exp +++ b/gdb/testsuite/gdb.threads/tls-shared.exp @@ -93,7 +93,7 @@ gdb_test "print i_tls" "2" "print thread local storage variable" gdb_test "ptype i_tls" "int" "ptype of thread local storage variable" gdb_test "info address i_tls" \ - "Symbol \\\"i_tls\\\" is a thread-local variable at offset 0 in the thread-local storage for .*tls-main.." \ + "Symbol \\\"i_tls\\\" is a thread-local variable at offset 0x0 in the thread-local storage for .*tls-main.." \ "print storage info for thread local storage variable" set line_number [gdb_get_line_number "break here to check result"] diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 5d194ff..232c9e9 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "defs.h" +#include "arch-utils.h" #include "symtab.h" #include "frame.h" #include "gdbtypes.h" @@ -1668,6 +1669,8 @@ trace_find_line_command (char *args, int from_tty) old_chain = make_cleanup (xfree, sals.sals); if (sal.symtab == 0) { + struct gdbarch *gdbarch = get_current_arch (); + printf_filtered ("TFIND: No line number information available"); if (sal.pc != 0) { @@ -1676,7 +1679,7 @@ trace_find_line_command (char *args, int from_tty) have the symbolic address. */ printf_filtered (" for address "); wrap_here (" "); - print_address (sal.pc, gdb_stdout); + print_address (gdbarch, sal.pc, gdb_stdout); printf_filtered (";\n -- will attempt to find by PC. \n"); } else @@ -1688,13 +1691,15 @@ trace_find_line_command (char *args, int from_tty) else if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc)) { + struct gdbarch *gdbarch = get_objfile_arch (sal.symtab->objfile); + if (start_pc == end_pc) { printf_filtered ("Line %d of \"%s\"", sal.line, sal.symtab->filename); wrap_here (" "); printf_filtered (" is at address "); - print_address (start_pc, gdb_stdout); + print_address (gdbarch, start_pc, gdb_stdout); wrap_here (" "); printf_filtered (" but contains no code.\n"); sal = find_pc_line (start_pc, 0); @@ -1873,7 +1878,8 @@ scope_info (char *args, int from_tty) break; case LOC_STATIC: printf_filtered ("in static storage at address "); - printf_filtered ("%s", paddress (SYMBOL_VALUE_ADDRESS (sym))); + printf_filtered ("%s", paddress (gdbarch, + SYMBOL_VALUE_ADDRESS (sym))); break; case LOC_REGISTER: /* GDBARCH is the architecture associated with the objfile @@ -1915,11 +1921,13 @@ scope_info (char *args, int from_tty) continue; case LOC_LABEL: printf_filtered ("a label at address "); - printf_filtered ("%s", paddress (SYMBOL_VALUE_ADDRESS (sym))); + printf_filtered ("%s", paddress (gdbarch, + SYMBOL_VALUE_ADDRESS (sym))); break; case LOC_BLOCK: printf_filtered ("a function at address "); - printf_filtered ("%s", paddress (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)))); + printf_filtered ("%s", + paddress (gdbarch, BLOCK_START (SYMBOL_BLOCK_VALUE (sym)))); break; case LOC_UNRESOLVED: msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), @@ -1929,7 +1937,8 @@ scope_info (char *args, int from_tty) else { printf_filtered ("static storage at address "); - printf_filtered ("%s", paddress (SYMBOL_VALUE_ADDRESS (msym))); + printf_filtered ("%s", + paddress (gdbarch, SYMBOL_VALUE_ADDRESS (msym))); } break; case LOC_OPTIMIZED_OUT: diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 7571a9b..85c0e8b 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -66,7 +66,7 @@ tui_disassemble (struct gdbarch *gdbarch, struct tui_asm_line *asm_lines, if (asm_lines->insn) xfree (asm_lines->insn); - print_address (pc, gdb_dis_out); + print_address (gdbarch, pc, gdb_dis_out); asm_lines->addr = pc; asm_lines->addr_string = xstrdup (tui_file_get_strbuf (gdb_dis_out)); diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 00e091d..62743cd 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -103,7 +103,7 @@ tui_make_status_line (struct tui_locator_element *loc) /* Translate PC address. */ pc_out = tui_sfileopen (128); - fputs_filtered (paddress (loc->addr), pc_out); + fputs_filtered (paddress (loc->gdbarch, loc->addr), pc_out); pc_buf = tui_file_get_strbuf (pc_out); pc_width = strlen (pc_buf); diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 78b554c..19a4644 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -488,10 +488,11 @@ ui_out_field_fmt_int (struct ui_out *uiout, void ui_out_field_core_addr (struct ui_out *uiout, const char *fldname, + struct gdbarch *gdbarch, CORE_ADDR address) { char addstr[20]; - int addr_bit = gdbarch_addr_bit (current_gdbarch); + int addr_bit = gdbarch_addr_bit (gdbarch); if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) address &= ((CORE_ADDR) 1 << addr_bit) - 1; diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 58a4e80..4f3b7a4 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -115,7 +115,7 @@ extern void ui_out_field_fmt_int (struct ui_out *uiout, int width, int value); extern void ui_out_field_core_addr (struct ui_out *uiout, const char *fldname, - CORE_ADDR address); + struct gdbarch *gdbarch, CORE_ADDR address); extern void ui_out_field_string (struct ui_out * uiout, const char *fldname, const char *string); diff --git a/gdb/utils.c b/gdb/utils.c index 0508159..3f9d1e7 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2847,26 +2847,8 @@ get_cell (void) return buf[cell]; } -int -strlen_paddr (void) -{ - return (gdbarch_addr_bit (current_gdbarch) / 8 * 2); -} - -char * -paddr (CORE_ADDR addr) -{ - return phex (addr, gdbarch_addr_bit (current_gdbarch) / 8); -} - -char * -paddr_nz (CORE_ADDR addr) -{ - return phex_nz (addr, gdbarch_addr_bit (current_gdbarch) / 8); -} - const char * -paddress (CORE_ADDR addr) +paddress (struct gdbarch *gdbarch, CORE_ADDR addr) { /* Truncate address to the size of a target address, avoiding shifts larger or equal than the width of a CORE_ADDR. The local @@ -2877,7 +2859,7 @@ paddress (CORE_ADDR addr) either zero or sign extended. Should gdbarch_address_to_pointer or some ADDRESS_TO_PRINTABLE() be used to do the conversion? */ - int addr_bit = gdbarch_addr_bit (current_gdbarch); + int addr_bit = gdbarch_addr_bit (gdbarch); if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) addr &= ((CORE_ADDR) 1 << addr_bit) - 1; diff --git a/gdb/valops.c b/gdb/valops.c index 38722a4..a9260ce 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -702,8 +702,9 @@ value_fetch_lazy (struct value *val) fprintf_unfiltered (gdb_stdlog, " register=%d", VALUE_REGNUM (new_val)); else if (VALUE_LVAL (new_val) == lval_memory) - fprintf_unfiltered (gdb_stdlog, " address=0x%s", - paddr_nz (value_address (new_val))); + fprintf_unfiltered (gdb_stdlog, " address=%s", + paddress (gdbarch, + value_address (new_val))); else fprintf_unfiltered (gdb_stdlog, " computed"); diff --git a/gdb/valprint.c b/gdb/valprint.c index 4011e5e..c7efef0 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1393,6 +1393,7 @@ val_print_string (struct type *elttype, CORE_ADDR addr, int len, int bytes_read; gdb_byte *buffer = NULL; /* Dynamically growable fetch buffer. */ struct cleanup *old_chain = NULL; /* Top of the old cleanup chain. */ + struct gdbarch *gdbarch = get_type_arch (elttype); int width = TYPE_LENGTH (elttype); /* First we need to figure out the limit on the number of characters we are @@ -1455,13 +1456,13 @@ val_print_string (struct type *elttype, CORE_ADDR addr, int len, if (errcode == EIO) { fprintf_filtered (stream, " <Address "); - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); fprintf_filtered (stream, " out of bounds>"); } else { fprintf_filtered (stream, " <Error reading address "); - fputs_filtered (paddress (addr), stream); + fputs_filtered (paddress (gdbarch, addr), stream); fprintf_filtered (stream, ": %s>", safe_strerror (errcode)); } } diff --git a/gdb/value.h b/gdb/value.h index 8fe2f40..d816156 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -318,7 +318,8 @@ extern struct value *coerce_array (struct value *value); struct frame_info; struct fn_field; -extern void print_address_demangle (CORE_ADDR, struct ui_file *, int); +extern void print_address_demangle (struct gdbarch *, CORE_ADDR, + struct ui_file *, int); extern LONGEST value_as_long (struct value *val); extern DOUBLEST value_as_double (struct value *val); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 2fa79af..c041c42 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -2082,7 +2082,7 @@ windows_xfer_shared_libraries (struct target_ops *ops, obstack_grow_str (&obstack, "<library-list>\n"); for (so = solib_start.next; so; so = so->next) windows_xfer_shared_library (so->so_name, (CORE_ADDR) (uintptr_t) so->lm_info->load_addr, - &obstack); + target_gdbarch, &obstack); obstack_grow_str0 (&obstack, "</library-list>\n"); buf = obstack_finish (&obstack); diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 7c7fe1a..9f9d636 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -22,18 +22,17 @@ void windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr, - struct obstack *obstack) + struct gdbarch *gdbarch, struct obstack *obstack) { char *p; obstack_grow_str (obstack, "<library name=\""); p = xml_escape_text (so_name); obstack_grow_str (obstack, p); xfree (p); - obstack_grow_str (obstack, "\"><segment address=\"0x"); + obstack_grow_str (obstack, "\"><segment address=\""); /* The symbols in a dll are offset by 0x1000, which is the the offset from 0 of the first byte in an image - because of the file header and the section alignment. */ - p = paddr_nz (load_addr + 0x1000); - obstack_grow_str (obstack, p); + obstack_grow_str (obstack, paddress (gdbarch, load_addr + 0x1000)); obstack_grow_str (obstack, "\"/></library>"); } diff --git a/gdb/windows-tdep.h b/gdb/windows-tdep.h index e9e0fbb..d198b09 100644 --- a/gdb/windows-tdep.h +++ b/gdb/windows-tdep.h @@ -19,8 +19,10 @@ #define WINDOWS_TDEP_H struct obstack; +struct gdbarch; extern void windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr, + struct gdbarch *gdbarch, struct obstack *obstack); #endif diff --git a/gdb/xcoffsolib.c b/gdb/xcoffsolib.c index a26b6be..5884f8b 100644 --- a/gdb/xcoffsolib.c +++ b/gdb/xcoffsolib.c @@ -62,6 +62,7 @@ static void sharedlibrary_command (char *pattern, int from_tty); static void solib_info (char *args, int from_tty) { + int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; struct vmap *vp = vmap; /* Check for new shared libraries loaded with load (). */ @@ -83,8 +84,10 @@ Text Range Data Range Syms Shared Object Library\n"); for (; vp != NULL; vp = vp->nxt) { printf_unfiltered ("0x%s-0x%s 0x%s-0x%s %s %s%s%s%s\n", - paddr (vp->tstart),paddr (vp->tend), - paddr (vp->dstart), paddr (vp->dend), + phex (vp->tstart, addr_size), + phex (vp->tend, addr_size), + phex (vp->dstart, addr_size), + phex (vp->dend, addr_size), vp->loaded ? "Yes" : "No ", vp->name, *vp->member ? "(" : "", |