This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[13/15] Address printing


Hello,

this removes references to current_gdbarch from address printing routines.
As a side effect, I've somewhat reduced the number of routines currently
being used for this purpose:

- ui_out_field_core_addr and paddress:  These routines stay, but get a
  gdbarch parameter

- strlen_paddr, paddr, paddr_nz:  These routines are removed.  Current
  callers are converted to an appropriate paddress call.

There were a few call sites where no architecture is available.  In those
cases, I've changed the code to use
  - hex_string for various debug output prints
  - phex/phex_nz in places where the correct output size is known

Bye,
Ulrich


ChangeLog:

	* 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.
	* 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 (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,
	darwin_debug_regions_recurse): 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.

testsuite/ChangeLog:

	* gdb.threads/tls-shared.exp: Update to locexpr_describe_location
	change to prefix TLS offset in hex with 0x.

doc/ChangeLog:

	* gdbint.texinfo (Item Output Functions): Update signature
	for ui_out_field_core_addr.


Index: gdb-head/gdb/ada-tasks.c
===================================================================
--- gdb-head.orig/gdb/ada-tasks.c
+++ gdb-head/gdb/ada-tasks.c
@@ -754,7 +754,8 @@ info_task (char *taskno_str, int from_tt
   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')
Index: gdb-head/gdb/ada-valprint.c
===================================================================
--- gdb-head.orig/gdb/ada-valprint.c
+++ gdb-head/gdb/ada-valprint.c
@@ -798,13 +798,13 @@ ada_val_print_1 (struct type *type, stru
                  System.Address values as a special case.  */
 
 	      struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
+	      CORE_ADDR addr
+		= extract_typed_address (valaddr, ptr_type, gdbarch);
 
               fprintf_filtered (stream, "(");
               type_print (type, "", stream, -1);
               fprintf_filtered (stream, ") ");
-	      fputs_filtered (paddress (extract_typed_address
-					(valaddr, ptr_type, gdbarch)),
-			      stream);
+	      fputs_filtered (paddress (gdbarch, addr), stream);
             }
 	  else
 	    {
Index: gdb-head/gdb/alpha-tdep.c
===================================================================
--- gdb-head.orig/gdb/alpha-tdep.c
+++ gdb-head/gdb/alpha-tdep.c
@@ -961,10 +961,10 @@ alpha_heuristic_proc_start (struct gdbar
 
       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)
 	{
Index: gdb-head/gdb/annotate.c
===================================================================
--- gdb-head.orig/gdb/annotate.c
+++ gdb-head/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 lin
     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
Index: gdb-head/gdb/annotate.h
===================================================================
--- gdb-head.orig/gdb/annotate.h
+++ gdb-head/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);
Index: gdb-head/gdb/arch-utils.c
===================================================================
--- gdb-head.orig/gdb/arch-utils.c
+++ gdb-head/gdb/arch-utils.c
@@ -51,8 +51,8 @@ simple_displaced_step_copy_insn (struct 
 
   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);
     }
 
Index: gdb-head/gdb/arm-tdep.c
===================================================================
--- gdb-head.orig/gdb/arm-tdep.c
+++ gdb-head/gdb/arm-tdep.c
@@ -1423,9 +1423,9 @@ arm_push_dummy_call (struct gdbarch *gdb
   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++;
     }
Index: gdb-head/gdb/auxv.c
===================================================================
--- gdb-head.orig/gdb/auxv.c
+++ gdb-head/gdb/auxv.c
@@ -240,14 +240,14 @@ fprint_target_auxv (struct ui_file *file
 	  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,
 			      target_gdbarch, val, -1, file, &opts);
 	    fprintf_filtered (file, "\n");
Index: gdb-head/gdb/breakpoint.c
===================================================================
--- gdb-head.orig/gdb/breakpoint.c
+++ gdb-head/gdb/breakpoint.c
@@ -117,7 +117,8 @@ static CORE_ADDR adjust_breakpoint_addre
 					    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);
 
@@ -1136,7 +1137,7 @@ Note: automatically using hardware break
 	      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->owner->gdbarch, bpt->address));
 	    }
 	}
         
@@ -1236,7 +1237,8 @@ Note: automatically using hardware break
 				      bpt->owner->number);
 		  fprintf_filtered (tmp_error_stream, 
 				    "Error accessing memory address ");
-		  fputs_filtered (paddress (bpt->address), tmp_error_stream);
+		  fputs_filtered (paddress (bpt->owner->gdbarch, bpt->address),
+				  tmp_error_stream);
 		  fprintf_filtered (tmp_error_stream, ": %s.\n",
 				    safe_strerror (val));
 		}
@@ -3679,7 +3681,7 @@ print_one_breakpoint_location (struct br
 	    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", b->gdbarch, loc->address);
 	  }
 	annotate_field (5);
 	if (!header_of_multiple)
@@ -3713,7 +3715,8 @@ print_one_breakpoint_location (struct br
       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");
     }
   
@@ -4058,8 +4061,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;
@@ -4092,7 +4095,7 @@ describe_other_breakpoints (CORE_ADDR pc
 			     : ((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");
     }
 }
@@ -4546,7 +4549,7 @@ create_thread_event_breakpoint (struct g
   
   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->gdbarch, b->loc->address));
 
   update_global_location_list_nothrow (1);
 
@@ -5222,7 +5225,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->gdbarch, b->loc->address),
+			      gdb_stdout);
 	    }
 	  if (b->source_file)
 	    printf_filtered (": file %s, line %d.",
@@ -5338,7 +5342,7 @@ create_breakpoint (struct gdbarch *gdbar
       struct bp_location *loc;
 
       if (from_tty)
-	describe_other_breakpoints (sal.pc, sal.section, thread);
+	describe_other_breakpoints (gdbarch, sal.pc, sal.section, thread);
 
       if (i == 0)
 	{
@@ -5377,7 +5381,7 @@ create_breakpoint (struct gdbarch *gdbar
   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->gdbarch, b->loc->address));
 
   b->ops = ops;
   mention (b);
@@ -6771,7 +6775,7 @@ print_one_exception_catchpoint (struct b
       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->gdbarch, b->loc->address);
     }
   annotate_field (5);
   if (b->loc)
@@ -6891,7 +6895,7 @@ create_ada_exception_breakpoint (struct 
 
   if (from_tty)
     {
-      describe_other_breakpoints (sal.pc, sal.section, -1);
+      describe_other_breakpoints (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.
@@ -8306,8 +8310,8 @@ insert_single_step_breakpoint (struct gd
 
   *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.  */
Index: gdb-head/gdb/buildsym.c
===================================================================
--- gdb-head.orig/gdb/buildsym.c
+++ gdb-head/gdb/buildsym.c
@@ -235,6 +235,7 @@ finish_block (struct symbol *symbol, str
 	      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, str
       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, str
 	      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);
Index: gdb-head/gdb/cli/cli-cmds.c
===================================================================
--- gdb-head.orig/gdb/cli/cli-cmds.c
+++ gdb-head/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 *gdbar
       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);
Index: gdb-head/gdb/cli/cli-dump.c
===================================================================
--- gdb-head.orig/gdb/cli/cli-dump.c
+++ gdb-head/gdb/cli/cli-dump.c
@@ -488,11 +488,13 @@ restore_section_callback (bfd *ibfd, ase
 		   (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");
 
Index: gdb-head/gdb/corefile.c
===================================================================
--- gdb-head.orig/gdb/corefile.c
+++ gdb-head/gdb/corefile.c
@@ -219,11 +219,11 @@ memory_error (int status, CORE_ADDR mema
        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));
 }
 
Index: gdb-head/gdb/c-valprint.c
===================================================================
--- gdb-head.orig/gdb/c-valprint.c
+++ gdb-head/gdb/c-valprint.c
@@ -48,10 +48,10 @@ print_function_pointer_address (struct g
   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);
 }
 
 
@@ -257,7 +257,7 @@ c_val_print (struct type *type, struct g
 	    }
 
 	  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.  */
@@ -328,7 +328,7 @@ c_val_print (struct type *type, struct g
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
 	  fprintf_filtered (stream, "@");
-	  fputs_filtered (paddress (addr), stream);
+	  fputs_filtered (paddress (gdbarch, addr), stream);
 	  if (options->deref_ref)
 	    fputs_filtered (": ", stream);
 	}
@@ -427,7 +427,7 @@ c_val_print (struct type *type, struct g
       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:
Index: gdb-head/gdb/dcache.c
===================================================================
--- gdb-head.orig/gdb/dcache.c
+++ gdb-head/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);
Index: gdb-head/gdb/defs.h
===================================================================
--- gdb-head.orig/gdb/defs.h
+++ gdb-head/gdb/defs.h
@@ -515,14 +515,9 @@ extern void gdb_print_host_address (cons
 
 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 sizeo
 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_
 				   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 */
 
Index: gdb-head/gdb/disasm.c
===================================================================
--- gdb-head.orig/gdb/disasm.c
+++ gdb-head/gdb/disasm.c
@@ -63,7 +63,8 @@ dis_asm_memory_error (int status, bfd_vm
 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, str
 	    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 *gd
   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;
 }
Index: gdb-head/gdb/dsrec.c
===================================================================
--- gdb-head.orig/gdb/dsrec.c
+++ gdb-head/gdb/dsrec.c
@@ -97,10 +97,10 @@ load_srec (struct serial *desc, const ch
            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_ad
     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.  */
Index: gdb-head/gdb/dwarf2-frame.c
===================================================================
--- gdb-head.orig/gdb/dwarf2-frame.c
+++ gdb-head/gdb/dwarf2-frame.c
@@ -334,11 +334,11 @@ dwarf2_restore_rule (struct gdbarch *gdb
   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 *
 		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
 		  {
@@ -994,9 +995,9 @@ dwarf2_frame_cache (struct frame_info *t
 	  {
 	    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];
Index: gdb-head/gdb/dwarf2loc.c
===================================================================
--- gdb-head.orig/gdb/dwarf2loc.c
+++ gdb-head/gdb/dwarf2loc.c
@@ -503,7 +503,7 @@ locexpr_describe_location (struct symbol
 	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;
       }
   
Index: gdb-head/gdb/dwarf2read.c
===================================================================
--- gdb-head.orig/gdb/dwarf2read.c
+++ gdb-head/gdb/dwarf2read.c
@@ -9406,7 +9406,7 @@ dump_die_shallow (struct ui_file *f, int
 	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:
Index: gdb-head/gdb/exec.c
===================================================================
--- gdb-head.orig/gdb/exec.c
+++ gdb-head/gdb/exec.c
@@ -668,16 +668,17 @@ exec_xfer_partial (struct target_ops *op
 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));
@@ -706,23 +707,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 ? ")" : "");
Index: gdb-head/gdb/fbsd-nat.c
===================================================================
--- gdb-head.orig/gdb/fbsd-nat.c
+++ gdb-head/gdb/fbsd-nat.c
@@ -127,8 +127,8 @@ fbsd_find_memory_regions (int (*func) (C
       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' : '-');
Index: gdb-head/gdb/findcmd.c
===================================================================
--- gdb-head.orig/gdb/findcmd.c
+++ gdb-head/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;
Index: gdb-head/gdb/frame.c
===================================================================
--- gdb-head.orig/gdb/frame.c
+++ gdb-head/gdb/frame.c
@@ -166,7 +166,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);
 }
@@ -231,7 +231,7 @@ fprint_frame (struct ui_file *file, stru
   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, ",");
@@ -243,7 +243,7 @@ fprint_frame (struct ui_file *file, stru
   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, "}");
@@ -501,9 +501,9 @@ frame_pc_unwind (struct frame_info *this
       this_frame->prev_pc.p = 1;
       if (frame_debug)
 	fprintf_unfiltered (gdb_stdlog,
-			    "{ frame_pc_unwind (this_frame=%d) -> 0x%s }\n",
+			    "{ frame_pc_unwind (this_frame=%d) -> %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;
 }
@@ -522,9 +522,9 @@ get_frame_func (struct frame_info *this_
       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;
 }
@@ -698,8 +698,9 @@ frame_unwind_register_value (struct fram
 	    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 (value_arch (value),
+					  value_address (value)));
 	  else
 	    fprintf_unfiltered (gdb_stdlog, " computed");
 
@@ -1126,8 +1127,8 @@ create_new_frame (CORE_ADDR addr, CORE_A
   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);
Index: gdb-head/gdb/f-valprint.c
===================================================================
--- gdb-head.orig/gdb/f-valprint.c
+++ gdb-head/gdb/f-valprint.c
@@ -284,13 +284,13 @@ f_val_print (struct type *type, struct g
 	  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.  */
@@ -315,7 +315,7 @@ f_val_print (struct type *type, struct g
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
 	  fprintf_filtered (stream, "@");
-	  fputs_filtered (paddress (addr), stream);
+	  fputs_filtered (paddress (gdbarch, addr), stream);
 	  if (options->deref_ref)
 	    fputs_filtered (": ", stream);
 	}
@@ -348,7 +348,7 @@ f_val_print (struct type *type, struct g
       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:
Index: gdb-head/gdb/gcore.c
===================================================================
--- gdb-head.orig/gdb/gcore.c
+++ gdb-head/gdb/gcore.c
@@ -330,8 +330,8 @@ gcore_create_callback (CORE_ADDR vaddr, 
     {
       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;
@@ -388,8 +388,8 @@ gcore_create_callback (CORE_ADDR vaddr, 
 
   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);
@@ -481,8 +481,9 @@ gcore_copy_callback (bfd *obfd, asection
       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))
Index: gdb-head/gdb/gnu-v3-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v3-abi.c
+++ gdb-head/gdb/gnu-v3-abi.c
@@ -605,7 +605,7 @@ gnuv3_print_method_ptr (const gdb_byte *
       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)
     {
Index: gdb-head/gdb/hppa-tdep.c
===================================================================
--- gdb-head.orig/gdb/hppa-tdep.c
+++ gdb-head/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 *thi
   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 *thi
 
 	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 *thi
     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 *thi
  	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 *thi
 			    (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 *thi
 	   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 *thi
   }
 
   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_
 	  /* 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 0x%s."),
+		       paddress (gdbarch, pc));
 	      return 0;
 	    }
 
Index: gdb-head/gdb/i386-cygwin-tdep.c
===================================================================
--- gdb-head.orig/gdb/i386-cygwin-tdep.c
+++ gdb-head/gdb/i386-cygwin-tdep.c
@@ -113,6 +113,7 @@ i386_windows_regset_from_core_section (s
 
 struct cpms_data
 {
+  struct gdbarch *gdbarch;
   struct obstack *obstack;
   int module_count;
 };
@@ -157,7 +158,8 @@ core_process_module_section (bfd *abfd, 
 
   /* 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 (stru
   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");
Index: gdb-head/gdb/i386-nat.c
===================================================================
--- gdb-head.orig/gdb/i386-nat.c
+++ gdb-head/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_ADD
     {
       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++;
     }
 }
Index: gdb-head/gdb/i386-tdep.c
===================================================================
--- gdb-head.orig/gdb/i386-tdep.c
+++ gdb-head/gdb/i386-tdep.c
@@ -428,9 +428,10 @@ i386_displaced_step_fixup (struct gdbarc
 
   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 gdbarc
           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 gdbarc
 
       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));
     }
 }
 
@@ -2733,12 +2734,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++;
@@ -2756,6 +2759,7 @@ i386_record_modrm (struct i386_record_s 
 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;
@@ -2776,8 +2780,8 @@ i386_record_lea_modrm_addr (struct i386_
 	    {
 	      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++;
@@ -2796,8 +2800,8 @@ i386_record_lea_modrm_addr (struct i386_
 		{
 		  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;
@@ -2812,8 +2816,8 @@ i386_record_lea_modrm_addr (struct i386_
 	    {
 	      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++;
@@ -2824,8 +2828,8 @@ i386_record_lea_modrm_addr (struct i386_
 	    {
 	      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;
@@ -2858,8 +2862,8 @@ i386_record_lea_modrm_addr (struct i386_
 		{
 		  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;
@@ -2877,8 +2881,8 @@ i386_record_lea_modrm_addr (struct i386_
 	    {
 	      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++;
@@ -2889,8 +2893,8 @@ i386_record_lea_modrm_addr (struct i386_
 	    {
 	      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;
@@ -2967,15 +2971,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;
     }
 
@@ -3011,8 +3016,8 @@ i386_process_record (struct gdbarch *gdb
 
   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)
@@ -3021,8 +3026,8 @@ i386_process_record (struct gdbarch *gdb
 	{
 	  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++;
@@ -3082,8 +3087,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++;
@@ -3821,10 +3826,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
 	  {
@@ -3839,8 +3844,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;
@@ -3852,8 +3857,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;
@@ -4241,10 +4246,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))
@@ -4650,8 +4655,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++;
@@ -4858,10 +4863,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
 	      {
@@ -4903,10 +4908,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
 		{
@@ -5091,8 +5096,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;
 }
 
Index: gdb-head/gdb/ia64-tdep.c
===================================================================
--- gdb-head.orig/gdb/ia64-tdep.c
+++ gdb-head/gdb/ia64-tdep.c
@@ -639,7 +639,7 @@ ia64_memory_insert_breakpoint (struct gd
   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)
@@ -686,7 +686,7 @@ ia64_memory_remove_breakpoint (struct gd
     {
       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;
     }
 
@@ -1709,6 +1709,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);
 
@@ -1719,10 +1720,10 @@ ia64_frame_this_id (struct frame_info *t
     (*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));
 }
 
@@ -2067,6 +2068,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);
 
@@ -2075,10 +2077,10 @@ ia64_sigtramp_frame_this_id (struct fram
                                        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));
 }
 
@@ -2287,6 +2289,7 @@ ia64_access_reg (unw_addr_space_t as, un
   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];
   
@@ -2333,10 +2336,10 @@ ia64_access_reg (unw_addr_space_t as, un
       
   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;
 }
 
@@ -2364,6 +2367,7 @@ ia64_access_rse_reg (unw_addr_space_t as
   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];
   
@@ -2410,10 +2414,10 @@ ia64_access_rse_reg (unw_addr_space_t as
       
   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;
 }
@@ -2515,11 +2519,11 @@ get_kernel_table (unw_word_t ip, unw_dyn
   
   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;
 }
 
@@ -2620,15 +2624,15 @@ ia64_find_proc_info_x (unw_addr_space_t 
 	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
     {
@@ -2637,15 +2641,15 @@ ia64_find_proc_info_x (unw_addr_space_t 
 	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,
@@ -2698,9 +2702,9 @@ ia64_get_dyn_info_list (unw_addr_space_t
 	      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;
 	    }
@@ -2716,6 +2720,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;
@@ -2737,9 +2742,10 @@ ia64_libunwind_frame_this_id (struct fra
 
   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));
 }
 
@@ -2841,6 +2847,7 @@ ia64_libunwind_sigtramp_frame_this_id (s
                                        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;
@@ -2863,9 +2870,10 @@ ia64_libunwind_sigtramp_frame_this_id (s
 
   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));
 }
 
@@ -3566,9 +3574,9 @@ ia64_dummy_id (struct gdbarch *gdbarch, 
 
   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);
 }
Index: gdb-head/gdb/infcmd.c
===================================================================
--- gdb-head.orig/gdb/infcmd.c
+++ gdb-head/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"
@@ -996,6 +997,7 @@ which has no line number information.\n"
 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;
@@ -1065,7 +1067,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");
     }
 
@@ -1589,7 +1591,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)
Index: gdb-head/gdb/infrun.c
===================================================================
--- gdb-head.orig/gdb/infrun.c
+++ gdb-head/gdb/infrun.c
@@ -865,8 +865,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);
     };
 
@@ -894,8 +894,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;
 }
@@ -927,8 +927,9 @@ displaced_step_fixup (ptid_t event_ptid,
     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?  */
@@ -961,6 +962,7 @@ displaced_step_fixup (ptid_t event_ptid,
     {
       struct displaced_step_request *head;
       ptid_t ptid;
+      struct regcache *regcache;
       CORE_ADDR actual_pc;
 
       head = displaced_step_request_queue;
@@ -970,7 +972,8 @@ displaced_step_fixup (ptid_t event_ptid,
 
       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))
 	{
@@ -983,10 +986,11 @@ displaced_step_fixup (ptid_t event_ptid,
 
 	  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));
 	    }
@@ -1262,11 +1266,12 @@ a command like `return' or `jump' to con
           && 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));
         }
@@ -1482,8 +1487,8 @@ proceed (CORE_ADDR addr, enum target_sig
 
   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
@@ -2721,8 +2726,11 @@ targets should add new threads to the th
 
   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;
@@ -2730,8 +2738,8 @@ targets should add new threads to the th
 
           if (target_stopped_data_address (&current_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");
@@ -3597,9 +3605,10 @@ infrun: not switching back to stepped th
       && stop_pc < ecs->event_thread->step_range_end)
     {
       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
@@ -4110,8 +4119,8 @@ insert_step_resume_breakpoint_at_sal (st
 
   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);
@@ -4189,8 +4198,8 @@ insert_longjmp_resume_breakpoint (struct
 
   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);
Index: gdb-head/gdb/jv-valprint.c
===================================================================
--- gdb-head.orig/gdb/jv-valprint.c
+++ gdb-head/gdb/jv-valprint.c
@@ -134,7 +134,7 @@ java_value_print (struct value *val, str
 	      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;
@@ -481,7 +481,8 @@ java_val_print (struct type *type, struc
 	  /* 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 +498,7 @@ java_val_print (struct type *type, struc
       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);
 	}
Index: gdb-head/gdb/linux-fork.c
===================================================================
--- gdb-head.orig/gdb/linux-fork.c
+++ gdb-head/gdb/linux-fork.c
@@ -481,6 +481,7 @@ detach_fork_command (char *args, int fro
 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;
@@ -513,7 +514,7 @@ info_forks_command (char *arg, int from_
       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)
Index: gdb-head/gdb/linux-nat.c
===================================================================
--- gdb-head.orig/gdb/linux-nat.c
+++ gdb-head/gdb/linux-nat.c
@@ -3439,8 +3439,8 @@ linux_nat_find_memory_regions (int (*fun
       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])
Index: gdb-head/gdb/m2-valprint.c
===================================================================
--- gdb-head.orig/gdb/m2-valprint.c
+++ gdb-head/gdb/m2-valprint.c
@@ -59,10 +59,10 @@ print_function_pointer_address (struct g
   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
@@ -231,7 +231,7 @@ print_unpacked_pointer (struct type *typ
     }
 
   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.  */
@@ -258,7 +258,7 @@ print_variable_at_address (struct type *
   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)
@@ -409,7 +409,7 @@ m2_val_print (struct type *type, struct 
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
 	  fprintf_filtered (stream, "@");
-	  fputs_filtered (paddress (addr), stream);
+	  fputs_filtered (paddress (gdbarch, addr), stream);
 	  if (options->deref_ref)
 	    fputs_filtered (": ", stream);
 	}
@@ -489,7 +489,7 @@ m2_val_print (struct type *type, struct 
       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:
Index: gdb-head/gdb/m32c-tdep.c
===================================================================
--- gdb-head.orig/gdb/m32c-tdep.c
+++ gdb-head/gdb/m32c-tdep.c
@@ -2422,7 +2422,7 @@ m32c_m16c_address_to_pointer (struct gdb
       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);
@@ -2439,7 +2439,7 @@ m32c_m16c_address_to_pointer (struct gdb
       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);
Index: gdb-head/gdb/m32r-rom.c
===================================================================
--- gdb-head.orig/gdb/m32r-rom.c
+++ gdb-head/gdb/m32r-rom.c
@@ -78,6 +78,7 @@ m32r_load_section (bfd *abfd, asection *
   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 *
       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 fro
 	    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);
 	  }
Index: gdb-head/gdb/maint.c
===================================================================
--- gdb-head.orig/gdb/maint.c
+++ gdb-head/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
 	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;
 }
Index: gdb-head/gdb/mi/mi-cmd-var.c
===================================================================
--- gdb-head.orig/gdb/mi/mi-cmd-var.c
+++ gdb-head/gdb/mi/mi-cmd-var.c
@@ -128,8 +128,8 @@ mi_cmd_var_create (char *command, char *
 
   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);
 
Index: gdb-head/gdb/mips-tdep.c
===================================================================
--- gdb-head.orig/gdb/mips-tdep.c
+++ gdb-head/gdb/mips-tdep.c
@@ -2551,8 +2551,8 @@ heuristic_proc_start (struct gdbarch *gd
 	  {
 	    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)
 	      {
@@ -2572,7 +2572,8 @@ 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\
 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;
 	      }
 	  }
@@ -2728,8 +2729,8 @@ mips_eabi_push_dummy_call (struct gdbarc
 
   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;
@@ -2740,8 +2741,8 @@ mips_eabi_push_dummy_call (struct gdbarc
     {
       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);
     }
 
@@ -2890,10 +2891,10 @@ mips_eabi_push_dummy_call (struct gdbarc
 
 		  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;
@@ -2901,8 +2902,8 @@ mips_eabi_push_dummy_call (struct gdbarc
 		  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",
@@ -3112,8 +3113,8 @@ mips_n32n64_push_dummy_call (struct gdba
 
   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;
@@ -3124,8 +3125,8 @@ mips_n32n64_push_dummy_call (struct gdba
     {
       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);
     }
 
@@ -3237,10 +3238,10 @@ mips_n32n64_push_dummy_call (struct gdba
 
 		  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;
@@ -3248,8 +3249,8 @@ mips_n32n64_push_dummy_call (struct gdba
 		  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",
@@ -3559,8 +3560,8 @@ mips_o32_push_dummy_call (struct gdbarch
 
   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;
@@ -3571,8 +3572,8 @@ mips_o32_push_dummy_call (struct gdbarch
     {
       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;
     }
@@ -3714,10 +3715,10 @@ mips_o32_push_dummy_call (struct gdbarch
 
 		  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;
@@ -3725,8 +3726,8 @@ mips_o32_push_dummy_call (struct gdbarch
 		  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",
@@ -4016,8 +4017,8 @@ mips_o64_push_dummy_call (struct gdbarch
 
   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;
@@ -4028,8 +4029,8 @@ mips_o64_push_dummy_call (struct gdbarch
     {
       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;
     }
@@ -4119,10 +4120,10 @@ mips_o64_push_dummy_call (struct gdbarch
 
 		  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;
@@ -4130,8 +4131,8 @@ mips_o64_push_dummy_call (struct gdbarch
 		  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",
Index: gdb-head/gdb/monitor.c
===================================================================
--- gdb-head.orig/gdb/monitor.c
+++ gdb-head/gdb/monitor.c
@@ -214,9 +214,13 @@ monitor_error (char *function, char *mes
   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);
-  else
-    error (_("%s (0x%s): %s: %s"), function, paddr_nz (memaddr), message, safe_string);
+    error (_("%s (%s): %s: %s%c"),
+	   function, paddress (target_gdbarch, memaddr),
+	   message, safe_string, final_char);
+  else
+    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 *pa
 	      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_o
 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_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 
       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 *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, 
     }
 
   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 gdbarc
   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 gdbarc
   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 gdbarc
 	}
     }
   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;
 }
 
Index: gdb-head/gdb/printcmd.c
===================================================================
--- gdb-head.orig/gdb/printcmd.c
+++ gdb-head/gdb/printcmd.c
@@ -457,7 +457,7 @@ print_scalar_formatted (const void *vala
     case 'a':
       {
 	CORE_ADDR addr = unpack_pointer (type, gdbarch, valaddr);
-	print_address (addr, stream);
+	print_address (gdbarch, addr, stream);
       }
       break;
 
@@ -717,9 +717,10 @@ build_address_symbolic (CORE_ADDR addr, 
    <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, " ");
 }
 
@@ -729,8 +730,8 @@ print_address (CORE_ADDR addr, struct ui
    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);
@@ -740,7 +741,7 @@ print_address_demangle (CORE_ADDR addr, 
     }
   else if (opts.addressprint)
     {
-      fputs_filtered (paddress (addr), stream);
+      fputs_filtered (paddress (gdbarch, addr), stream);
       print_address_symbolic (addr, stream, do_demangle, " ");
     }
   else
@@ -811,7 +812,7 @@ do_examine (struct gdbarch *gdbarch, str
   while (count > 0)
     {
       QUIT;
-      print_address (next_address, gdb_stdout);
+      print_address (gdbarch, next_address, gdb_stdout);
       printf_filtered (":");
       for (i = maxelts;
 	   i > 0 && count > 0;
@@ -1146,20 +1147,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);
 	    }
@@ -1187,13 +1189,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);
 	}
@@ -1227,13 +1229,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);
 	}
@@ -1265,12 +1267,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);
 	}
@@ -1292,16 +1294,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);
 		  }
Index: gdb-head/gdb/p-valprint.c
===================================================================
--- gdb-head.orig/gdb/p-valprint.c
+++ gdb-head/gdb/p-valprint.c
@@ -143,7 +143,8 @@ pascal_val_print (struct type *type, str
 	  /* 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;
 	}
@@ -156,14 +157,14 @@ pascal_val_print (struct type *type, str
 	  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
@@ -258,7 +259,7 @@ pascal_val_print (struct type *type, str
 	  CORE_ADDR addr
             = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
 	  fprintf_filtered (stream, "@");
-	  fputs_filtered (paddress (addr), stream);
+          fputs_filtered (paddress (gdbarch, addr), stream);
 	  if (options->deref_ref)
 	    fputs_filtered (": ", stream);
 	}
@@ -294,7 +295,8 @@ pascal_val_print (struct type *type, str
 	     -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);
 	}
@@ -365,7 +367,7 @@ pascal_val_print (struct type *type, str
       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:
Index: gdb-head/gdb/remote.c
===================================================================
--- gdb-head.orig/gdb/remote.c
+++ gdb-head/gdb/remote.c
@@ -2895,6 +2895,7 @@ remote_check_symbols (struct objfile *ob
 	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
@@ -2904,7 +2905,7 @@ remote_check_symbols (struct objfile *ob
 							 &current_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);
@@ -5840,6 +5841,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;
 
@@ -5848,7 +5850,7 @@ remote_flash_erase (struct target_ops *o
   remote_timeout = remote_flash_timeout;
 
   ret = remote_send_printf ("vFlashErase:%s,%s",
-			    paddr (address),
+			    phex (address, addr_size),
 			    phex (length, 4));
   switch (ret)
     {
@@ -7200,16 +7202,18 @@ compare_sections_command (char *args, in
 
       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
@@ -7529,6 +7533,7 @@ remote_search_memory (struct target_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 =
@@ -7567,7 +7572,7 @@ remote_search_memory (struct target_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);
 
Index: gdb-head/gdb/remote-m32r-sdi.c
===================================================================
--- gdb-head.orig/gdb/remote-m32r-sdi.c
+++ gdb-head/gdb/remote-m32r-sdi.c
@@ -1050,10 +1050,10 @@ m32r_xfer_memory (CORE_ADDR memaddr, gdb
     {
       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 *
 
   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 *
 
   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, 
 
   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, 
 
   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++)
     {
Index: gdb-head/gdb/remote-mips.c
===================================================================
--- gdb-head.orig/gdb/remote-mips.c
+++ gdb-head/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, in
 		{
 		  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 w
       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 e
 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_AD
 	    {
 	      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 fro
 	  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 fro
 	    }
 
 	  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 fro
 	    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_ADD
 	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);
Index: gdb-head/gdb/remote-sim.c
===================================================================
--- gdb-head.orig/gdb/remote-sim.c
+++ gdb-head/gdb/remote-sim.c
@@ -773,8 +773,8 @@ gdbsim_xfer_inferior_memory (CORE_ADDR m
       /* 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);
     }
Index: gdb-head/gdb/rs6000-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-tdep.c
+++ gdb-head/gdb/rs6000-tdep.c
@@ -983,8 +983,8 @@ ppc_displaced_step_fixup (struct 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
 	      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
 					  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));
 
 	}
     }
Index: gdb-head/gdb/scm-valprint.c
===================================================================
--- gdb-head.orig/gdb/scm-valprint.c
+++ gdb-head/gdb/scm-valprint.c
@@ -178,7 +178,7 @@ scm_ipruk (char *hdr, struct type *type,
   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
 }
 
@@ -251,7 +251,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:
Index: gdb-head/gdb/sh64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh64-tdep.c
+++ gdb-head/gdb/sh64-tdep.c
@@ -1316,8 +1316,8 @@ sh64_show_media_regs (struct frame_info 
 
   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_inf
 
   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",
Index: gdb-head/gdb/sh-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh-tdep.c
+++ gdb-head/gdb/sh-tdep.c
@@ -1418,9 +1418,9 @@ sh_generic_show_regs (struct frame_info 
 {
   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 
 
   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 *fr
 {
   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 *
 {
   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 *fra
 {
   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));
Index: gdb-head/gdb/solib-som.c
===================================================================
--- gdb-head.orig/gdb/solib-som.c
+++ gdb-head/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;
Index: gdb-head/gdb/sol-thread.c
===================================================================
--- gdb-head.orig/gdb/sol-thread.c
+++ gdb-head/gdb/sol-thread.c
@@ -1250,7 +1250,8 @@ info_cb (const td_thrhandle_t *th, void 
 	    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 
 	    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.  */
Index: gdb-head/gdb/source.c
===================================================================
--- gdb-head.orig/gdb/source.c
+++ gdb-head/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, 
     /* 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,16 @@ 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);
+
+	  printf_filtered (_("No line number information available"));
 	  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 +1513,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;
Index: gdb-head/gdb/stack.c
===================================================================
--- gdb-head.orig/gdb/stack.c
+++ gdb-head/gdb/stack.c
@@ -495,6 +495,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;
@@ -507,7 +508,7 @@ print_frame_info (struct frame_info *fra
 	= 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.  */
@@ -520,7 +521,8 @@ print_frame_info (struct frame_info *fra
       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 ();
         }
 
@@ -599,7 +601,8 @@ print_frame_info (struct frame_info *fra
 		 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");
 		}
 
@@ -705,6 +708,7 @@ print_frame (struct frame_info *frame, i
 	     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;
@@ -717,7 +721,7 @@ print_frame (struct frame_info *frame, i
   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");
 
@@ -733,7 +737,7 @@ print_frame (struct frame_info *frame, i
 	|| 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 ");
       }
@@ -1014,10 +1018,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)
@@ -1032,7 +1036,7 @@ frame_info (char *addr_exp, int from_tty
   puts_filtered ("; ");
   wrap_here ("    ");
   printf_filtered ("saved %s ", pc_regname);
-  fputs_filtered (paddress (frame_pc_unwind (fi)), gdb_stdout);
+  fputs_filtered (paddress (gdbarch, frame_pc_unwind (fi)), gdb_stdout);
   printf_filtered ("\n");
 
   if (calling_frame_info == NULL)
@@ -1048,7 +1052,7 @@ frame_info (char *addr_exp, int from_tty
   if (calling_frame_info)
     {
       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)
@@ -1057,7 +1061,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)
@@ -1078,7 +1082,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))
@@ -1110,7 +1114,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 (",");
       }
   }
@@ -1152,14 +1156,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;
 	  }
@@ -1194,7 +1198,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++;
 	    }
 	}
@@ -1445,8 +1449,8 @@ print_block_frame_locals (struct block *
 /* 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;
@@ -1471,7 +1475,8 @@ print_block_frame_labels (struct block *
 	  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);
@@ -1526,6 +1531,7 @@ print_frame_label_vars (struct frame_inf
 #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;
@@ -1563,7 +1569,8 @@ print_frame_label_vars (struct frame_inf
 	{
 	  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;
Index: gdb-head/gdb/symfile.c
===================================================================
--- gdb-head.orig/gdb/symfile.c
+++ gdb-head/gdb/symfile.c
@@ -1801,9 +1801,9 @@ load_progress (ULONGEST bytes, void *unt
     {
       /* 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;
     }
 
@@ -1820,11 +1820,11 @@ load_progress (ULONGEST bytes, void *unt
       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;
@@ -1980,7 +1980,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");
@@ -2082,6 +2082,7 @@ print_transfer_performance (struct ui_fi
 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;
@@ -2212,7 +2213,8 @@ add_symbol_file_command (char *args, int
          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
@@ -3500,6 +3502,7 @@ list_overlays_command (char *args, int f
     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;
@@ -3510,13 +3513,13 @@ list_overlays_command (char *args, int f
 	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++;
Index: gdb-head/gdb/symfile-mem.c
===================================================================
--- gdb-head.orig/gdb/symfile-mem.c
+++ gdb-head/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.  */
Index: gdb-head/gdb/symmisc.c
===================================================================
--- gdb-head.orig/gdb/symmisc.c
+++ gdb-head/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, 
 	  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, s
       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, s
     }
   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, 
       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, 
 	     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, 
 	  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 a
 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, 
 }
 
 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_sy
 	  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,
 
   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,
 	      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,
 
   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,
 	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,
 	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");
       }
   }
Index: gdb-head/gdb/symtab.c
===================================================================
--- gdb-head.orig/gdb/symtab.c
+++ gdb-head/gdb/symtab.c
@@ -2079,8 +2079,8 @@ find_pc_sect_symtab (CORE_ADDR pc, struc
 	   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);
Index: gdb-head/gdb/target.c
===================================================================
--- gdb-head.orig/gdb/target.c
+++ gdb-head/gdb/target.c
@@ -1378,7 +1378,7 @@ target_flash_erase (ULONGEST address, LO
 	{
 	  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;
 	}
@@ -2779,8 +2779,8 @@ deprecated_debug_xfer_memory (CORE_ADDR 
 
   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)
     {
Index: gdb-head/gdb/tracepoint.c
===================================================================
--- gdb-head.orig/gdb/tracepoint.c
+++ gdb-head/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"
@@ -1700,6 +1701,8 @@ trace_find_line_command (char *args, int
       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)
 	    {
@@ -1708,7 +1711,7 @@ trace_find_line_command (char *args, int
 	         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
@@ -1720,13 +1723,15 @@ trace_find_line_command (char *args, int
       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);
@@ -1905,7 +1910,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
@@ -1947,11 +1953,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),
@@ -1961,7 +1969,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:
Index: gdb-head/gdb/tui/tui-disasm.c
===================================================================
--- gdb-head.orig/gdb/tui/tui-disasm.c
+++ gdb-head/gdb/tui/tui-disasm.c
@@ -66,7 +66,7 @@ tui_disassemble (struct gdbarch *gdbarch
       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));
 
Index: gdb-head/gdb/tui/tui-stack.c
===================================================================
--- gdb-head.orig/gdb/tui/tui-stack.c
+++ gdb-head/gdb/tui/tui-stack.c
@@ -103,7 +103,7 @@ tui_make_status_line (struct tui_locator
 
   /* 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);
   
Index: gdb-head/gdb/utils.c
===================================================================
--- gdb-head.orig/gdb/utils.c
+++ gdb-head/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;
Index: gdb-head/gdb/valops.c
===================================================================
--- gdb-head.orig/gdb/valops.c
+++ gdb-head/gdb/valops.c
@@ -692,8 +692,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 (value_arch (new_val),
+					      value_address (new_val)));
 	      else
 		fprintf_unfiltered (gdb_stdlog, " computed");
 
Index: gdb-head/gdb/valprint.c
===================================================================
--- gdb-head.orig/gdb/valprint.c
+++ gdb-head/gdb/valprint.c
@@ -1459,13 +1459,13 @@ val_print_string (struct type *elttype, 
       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));
 	}
     }
Index: gdb-head/gdb/value.h
===================================================================
--- gdb-head.orig/gdb/value.h
+++ gdb-head/gdb/value.h
@@ -320,7 +320,8 @@ extern struct value *coerce_array (struc
 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);
Index: gdb-head/gdb/xcoffsolib.c
===================================================================
--- gdb-head.orig/gdb/xcoffsolib.c
+++ gdb-head/gdb/xcoffsolib.c
@@ -62,6 +62,7 @@ static void sharedlibrary_command (char 
 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 Obje
   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 ? "(" : "",
Index: gdb-head/gdb/ada-lang.c
===================================================================
--- gdb-head.orig/gdb/ada-lang.c
+++ gdb-head/gdb/ada-lang.c
@@ -10119,7 +10119,7 @@ print_one_exception (enum exception_catc
   if (opts.addressprint)
     {
       annotate_field (4);
-      ui_out_field_core_addr (uiout, "addr", b->loc->address);
+      ui_out_field_core_addr (uiout, "addr", b->gdbarch, b->loc->address);
     }
 
   annotate_field (5);
Index: gdb-head/gdb/mi/mi-main.c
===================================================================
--- gdb-head.orig/gdb/mi/mi-main.c
+++ gdb-head/gdb/mi/mi-main.c
@@ -932,13 +932,15 @@ mi_cmd_data_read_memory (char *command, 
     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.  */
   {
@@ -958,7 +960,7 @@ mi_cmd_data_read_memory (char *command, 
 	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);
Index: gdb-head/gdb/mi/mi-symbol-cmds.c
===================================================================
--- gdb-head.orig/gdb/mi/mi-symbol-cmds.c
+++ gdb-head/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,
      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);
     }
Index: gdb-head/gdb/ui-out.c
===================================================================
--- gdb-head.orig/gdb/ui-out.c
+++ gdb-head/gdb/ui-out.c
@@ -488,10 +488,11 @@ ui_out_field_fmt_int (struct ui_out *uio
 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;
Index: gdb-head/gdb/ui-out.h
===================================================================
--- gdb-head.orig/gdb/ui-out.h
+++ gdb-head/gdb/ui-out.h
@@ -115,7 +115,7 @@ extern void ui_out_field_fmt_int (struct
 		 		  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);
Index: gdb-head/gdb/testsuite/gdb.threads/tls-shared.exp
===================================================================
--- gdb-head.orig/gdb/testsuite/gdb.threads/tls-shared.exp
+++ gdb-head/gdb/testsuite/gdb.threads/tls-shared.exp
@@ -93,7 +93,7 @@ gdb_test "print i_tls" "2" "print thread
 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"]
Index: gdb-head/gdb/windows-tdep.c
===================================================================
--- gdb-head.orig/gdb/windows-tdep.c
+++ gdb-head/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>");
 }
Index: gdb-head/gdb/windows-tdep.h
===================================================================
--- gdb-head.orig/gdb/windows-tdep.h
+++ gdb-head/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
Index: gdb-head/gdb/windows-nat.c
===================================================================
--- gdb-head.orig/gdb/windows-nat.c
+++ gdb-head/gdb/windows-nat.c
@@ -2080,7 +2080,7 @@ windows_xfer_shared_libraries (struct ta
   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);
Index: gdb-head/gdb/amd64-tdep.c
===================================================================
--- gdb-head.orig/gdb/amd64-tdep.c
+++ gdb-head/gdb/amd64-tdep.c
@@ -1075,9 +1075,9 @@ fixup_riprel (struct gdbarch *gdbarch, s
 
   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 g
 
   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 gdbar
 
   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 gdbar
 	  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 gdbar
 
       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));
     }
 }
 
Index: gdb-head/gdb/record.c
===================================================================
--- gdb-head.orig/gdb/record.c
+++ gdb-head/gdb/record.c
@@ -261,9 +261,9 @@ record_arch_list_add_mem (CORE_ADDR addr
 
   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
       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 *
 	  /* 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.  */
Index: gdb-head/gdb/linux-record.c
===================================================================
--- gdb-head.orig/gdb/linux-record.c
+++ gdb-head/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, struc
 		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, struc
 	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, struc
 		    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, struc
 		    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, struc
 		    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, struc
 			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, struc
 		    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, struc
 			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, struc
 		    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, struc
 			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, struc
 		    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, struc
 			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, struc
 				  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, struc
 		    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, struc
 	      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;
 	    }
Index: gdb-head/gdb/darwin-nat-info.c
===================================================================
--- gdb-head.orig/gdb/darwin-nat-info.c
+++ gdb-head/gdb/darwin-nat-info.c
@@ -555,8 +555,8 @@ darwin_debug_regions (task_t task, mach_
       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),
@@ -615,8 +615,8 @@ darwin_debug_regions_recurse (task_t tas
       if (kret != KERN_SUCCESS)
 	break;
       printf_filtered (_("%s-%s %s/%s  %-5s %-10s %2d %s"),
-		       paddr(r_start),
-		       paddr(r_start + r_size),
+		       paddress(target_gdbarch, r_start),
+		       paddress(target_gdbarch, r_start + r_size),
 		       unparse_protection (r_info.protection),
 		       unparse_protection (r_info.max_protection),
 		       unparse_inheritance (r_info.inheritance),
Index: gdb-head/gdb/gnu-nat.c
===================================================================
--- gdb-head.orig/gdb/gnu-nat.c
+++ gdb-head/gdb/gnu-nat.c
@@ -2492,7 +2492,8 @@ gnu_xfer_memory (CORE_ADDR memaddr, gdb_
   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);
Index: gdb-head/gdb/mips-linux-nat.c
===================================================================
--- gdb-head.orig/gdb/mips-linux-nat.c
+++ gdb-head/gdb/mips-linux-nat.c
@@ -595,7 +595,8 @@ mips_show_dr (const char *func, CORE_ADD
 
   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_ADD
   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
Index: gdb-head/gdb/doc/gdbint.texinfo
===================================================================
--- gdb-head.orig/gdb/doc/gdbint.texinfo
+++ gdb-head/gdb/doc/gdbint.texinfo
@@ -1405,8 +1405,8 @@ This function outputs a value of an @cod
 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})
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]