Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] patch to remove language-dependent numeric output support
@ 2004-09-11  0:38 Paul Hilfinger
  2004-09-11  2:03 ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Hilfinger @ 2004-09-11  0:38 UTC (permalink / raw)
  To: gdb-patches


[Ooops.  I see my previous Subject line was a bit mangled.  So here is
the same patch with a more meaningful subject.]

At Andrew's request, I've prepared a patch that removes the
(essentially unused) features in the language vector and elsewhere
that provide for language-dependent integral output formats.  The
patch below causes GDB to use C-format throughout instead.  This change
does indeed allow for a bit of brush removal.

The idea is that if language-specific formatting were ever to be
re-introduced, it would be via a function in the language vector. (I'd
suggest that such a function take a raw string of digits and perhaps
their radix, and work from that.  For C, it would stick 0x or 0 in
front, according to radix and value; for Ada, it would stick RADIX# in
front and # after for non-decimal radices).

The patch would have been a lot shorter, but several name changes seemed 
indicated.  Comments solicited.

Paul Hilfinger


ChangeLog:

2004-09-10  Paul N. Hilfinger  <hilfingr@nile.gnat.com>

        * language.c (local_hex_format_custom): Remove.
	(local_hex_string): Rename to hex_string, use C format, and move to
	utils.c
	(local_hex_string_custom): Rename to hex_string_custom and change
	interface.  Now uses C format.  Move to utils.c
	(local_octal_format_custom): Remove.
	(local_decimal_format_custom): Remove.
	
	* utils.c: (int_string): New function.
	(hex_string): New function (from language.c).
	(hex_string_custom): New function (from language.c).
	(octal2str): New function.
	(decimal2str): Add width parameter.
	(paddr_u): Use new decimal2str interface.
	(paddr_d): Ditto.
	
	* language.h (struct language_format_info): Delete declaration.
	(struct language_defn): Remove language_format_info fields
	la_binary_format, la_octal_format, la_decimal_format, la_hex_format.
	(local_binary_format): Remove macro.
	(local_binary_format_prefix): Remove macro.
	(local_binary_format_specifier): Remove macro.
	(local_binary_format_suffix): Remove macro.
	(local_octal_format): Remove macro.
	(local_octal_format_prefix): Remove macro.
	(local_octal_format_specifier): Remove macro.
	(local_octal_format_suffix): Remove macro.
	(local_decimal_format): Remove macro.
	(local_decimal_format_prefix): Remove macro.
	(local_decimal_format_specifier): Remove macro.
	(local_decimal_format_suffix): Remove macro.
	(local_hex_format): Remove macro.
	(local_hex_format_prefix): Remove macro.
	(local_hex_format_specifier): Remove macro.
	(local_hex_format_suffix): Remove macro.
	
	(local_decimal_format_custom): Remove.
	(local_octal_format_custom): Remove.
	(local_hex_format_custom): Remove.
	(local_hex_string): Rename to hex_string and move to defs.h.
	(local_hex_string_custom): Rename to hex_string_custom, change
	interface, and move to defs.h.
	
	* defs.h (hex_string): Declare.
	(hex_string_custom): Declare.
	(int_string): Declare.
	
	* printcmd.c (print_scalar_formatted): Remove localized binary
	formatting.
	* valprint.c (print_longest): Use int_string.
	(print_floating): Use C hex format.
	(print_hex_chars): Ditto.
	(print_binary_chars): Remove language-specific formatting.
	(print_octal_chars): Use C octal format.
	(print_decimal_chars): Delocalize format.
	(print_decimal): Remove.
	
	* ada-lang.c (ada_language_defn): Remove language-specific number 
	formatting entries.
	* p-lang.c (pascal_language_defn): Ditto.
	* c-lang.c (c_language_defn): Ditto.
	(cplus_language_defn): Ditto.
	(asm_language_defn): Ditto.
	(minimal_language_defn): Ditto.
	* f-lang.c (f_language_defn): Ditto.
	* jv-lang.c (java_language_defn): Ditto.
	* language.c (unknown_language_defn): Ditto.
	(auto_language_defn): Ditto.
	(local_language_defn): Ditto.
	* m2-lang.c (m2_language_defn): Ditto.
	* scm-lang.c (scm_language_defn): Ditto.
	* objc-lang.c (objc_language_defn): Ditto.

	* memattr.c (mem_info_command): Use renamed hex_string_custom with
	new interface.
	* pa64solib.c (pa64_sharedlibrary_info_command): Ditto.
	* ui-out.c (ui_out_field_core_addr): Ditto.
	* breakpoint.c (breakpoint_adjustment_warning): Ditto.
	* exec.c (print_section_info): Ditto.
	* i387-tdep.c (print_i387_status_word): Ditto.
	(print_i387_control_word): Ditto.
	(i387_print_float_info): Ditto.
	* maint.c (maint_print_section_info): Ditto.
	* solib.c (info_sharedlibrary_command): Ditto.
	* somsolib.c (som_sharedlibrary_info_command): Ditto.
	* symtab.c (print_msymbol_info): Ditto.
	* tracepoint.c (tracepoints_info): Ditto.
	* solib-frv.c (lm_base): Ditto.
	(frv_current_sos): Ditto.
	(enable_break2): Ditto.
	(enable_break): Ditto.
	
	* buildsym.c (make_blockvector): Use renamed hex_string.
	* dbxread.c (read_dbx_symtab): Ditto.
	(process_one_symbol): Ditto.
	* infcmd.c (program_info): Ditto.
	* mdebugread.c (parse_partial_symbols): Ditto.
	* symfile.c (add_symbol_file_command): Ditto.
	* cli/cli-cmds.c (edit_command): Ditto.
	(list_command): Ditto.
	* infcall.c (call_function_by_hand): Ditto.
	* remote-vx.c (vx_run_files_info): Ditto.
	(vx_wait): Ditto.
	(vx_attach): Ditto.
	(vx_detach): Ditto.
	(vx_kill): Ditto.
	* aix-thread.c (pdc_symbol_addrs): Ditto.
	(pdc_read_regs): Ditto.
	(pdc_write_regs): Ditto.
	(pdc_read_data): Ditto.
	(pdc_write_data): Ditto.
	* d10v-tdep.c (display_trace): Ditto.
	* rs6000-nat.c (find_toc_address): Ditto.

	* aix-thread.c: Don't include language.h.
	* buildsym.c: Ditto.
	* dbxread.c: Ditto.
	* mdebugread.c: Ditto.
	* rs6000-nat.c: Ditto.

Patch:

Index: gdb/ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.51
diff -u -p -r1.51 ada-lang.c
--- gdb/ada-lang.c	29 Aug 2004 10:12:13 -0000	1.51
+++ gdb/ada-lang.c	10 Sep 2004 09:15:38 -0000
@@ -10184,11 +10184,6 @@ const struct language_defn ada_language_
   basic_lookup_transparent_type,        /* lookup_transparent_type */
   ada_la_decode,                /* Language specific symbol demangler */
   NULL,                         /* Language specific class_name_from_physname */
-  {"", "", "", ""},             /* Binary format info */
-  /* Copied from c-lang.c.  */
-  {"0%lo", "0", "o", ""},       /* Octal format info */
-  {"%ld", "", "d", ""},         /* Decimal format info */
-  {"0x%lx", "0x", "x", ""},     /* Hex format info */
   ada_op_print_tab,             /* expression operators for printing */
   0,                            /* c-style arrays */
   1,                            /* String lower bound */
Index: gdb/aix-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/aix-thread.c,v
retrieving revision 1.34
diff -u -p -r1.34 aix-thread.c
--- gdb/aix-thread.c	6 Aug 2004 16:33:17 -0000	1.34
+++ gdb/aix-thread.c	10 Sep 2004 09:15:39 -0000
@@ -48,7 +48,6 @@
 #include "inferior.h"
 #include "regcache.h"
 #include "gdbcmd.h"
-#include "language.h"		/* for local_hex_string() */
 #include "ppc-tdep.h"
 #include "gdb_string.h"
 
@@ -314,7 +313,7 @@ pdc_symbol_addrs (pthdb_user_t user, pth
 	}
       if (debug_aix_thread)
 	fprintf_unfiltered (gdb_stdlog, "  symbols[%d].addr = %s\n",
-			    i, local_hex_string (symbols[i].addr));
+			    i, hex_string (symbols[i].addr));
     }
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog, " returning PDC_SUCCESS\n");
@@ -347,7 +346,7 @@ pdc_read_regs (pthdb_user_t user, 
   
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog, "pdc_read_regs tid=%d flags=%s\n",
-                        (int) tid, local_hex_string (flags));
+                        (int) tid, hex_string (flags));
 
   /* General-purpose registers.  */
   if (flags & PTHDB_FLAG_GPRS)
@@ -413,7 +412,7 @@ pdc_write_regs (pthdb_user_t user,
 
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog, "pdc_write_regs tid=%d flags=%s\n",
-                        (int) tid, local_hex_string (flags));
+                        (int) tid, hex_string (flags));
 
   /* General-purpose registers.  */
   if (flags & PTHDB_FLAG_GPRS)
@@ -458,7 +457,7 @@ pdc_read_data (pthdb_user_t user, void *
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog,
       "pdc_read_data (user = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
-      user, (long) buf, local_hex_string (addr), len);
+      user, (long) buf, hex_string (addr), len);
 
   status = target_read_memory (addr, buf, len);
   ret = status == 0 ? PDC_SUCCESS : PDC_FAILURE;
@@ -480,7 +479,7 @@ pdc_write_data (pthdb_user_t user, void 
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog,
       "pdc_write_data (user = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
-      user, (long) buf, local_hex_string (addr), len);
+      user, (long) buf, hex_string (addr), len);
 
   status = target_write_memory (addr, buf, len);
   ret = status == 0 ? PDC_SUCCESS : PDC_FAILURE;
Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.180
diff -u -p -r1.180 breakpoint.c
--- gdb/breakpoint.c	1 Sep 2004 18:00:28 -0000	1.180
+++ gdb/breakpoint.c	10 Sep 2004 09:15:42 -0000
@@ -3925,8 +3925,8 @@ breakpoint_adjustment_warning (CORE_ADDR
   char astr1[40];
   char astr2[40];
 
-  strcpy (astr1, local_hex_string_custom ((unsigned long) from_addr, "08l"));
-  strcpy (astr2, local_hex_string_custom ((unsigned long) to_addr, "08l"));
+  strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
+  strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));
   if (have_bnum)
     warning ("Breakpoint %d address previously adjusted from %s to %s.",
              bnum, astr1, astr2);
Index: gdb/buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.39
diff -u -p -r1.39 buildsym.c
--- gdb/buildsym.c	7 Feb 2004 23:13:46 -0000	1.39
+++ gdb/buildsym.c	10 Sep 2004 09:15:42 -0000
@@ -38,7 +38,6 @@
 #include "complaints.h"
 #include "gdb_string.h"
 #include "expression.h"		/* For "enum exp_opcode" used by... */
-#include "language.h"		/* For "local_hex_string" */
 #include "bcache.h"
 #include "filenames.h"		/* For DOSish file names */
 #include "macrotab.h"
@@ -521,7 +520,7 @@ make_blockvector (struct objfile *objfil
 		= BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i));
 
 	      complaint (&symfile_complaints, "block at %s out of order",
-			 local_hex_string ((LONGEST) start));
+			 hex_string ((LONGEST) start));
 	    }
 	}
     }
Index: gdb/c-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.32
diff -u -p -r1.32 c-lang.c
--- gdb/c-lang.c	29 Aug 2004 10:12:14 -0000	1.32
+++ gdb/c-lang.c	10 Sep 2004 09:15:42 -0000
@@ -588,10 +588,6 @@ const struct language_defn c_language_de
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   c_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -650,10 +646,6 @@ const struct language_defn cplus_languag
   cp_lookup_transparent_type,   /* lookup_transparent_type */
   cplus_demangle,		/* Language specific symbol demangler */
   cp_class_name_from_physname,  /* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   c_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -689,10 +681,6 @@ const struct language_defn asm_language_
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   c_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -733,10 +721,6 @@ const struct language_defn minimal_langu
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   c_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
Index: gdb/d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.148
diff -u -p -r1.148 d10v-tdep.c
--- gdb/d10v-tdep.c	7 Aug 2004 19:25:58 -0000	1.148
+++ gdb/d10v-tdep.c	10 Sep 2004 09:15:43 -0000
@@ -1313,7 +1313,7 @@ display_trace (int low, int high)
 		  if (!suppress)
 		    /* FIXME-32x64--assumes sal.pc fits in long.  */
 		    printf_filtered ("No source file for address %s.\n",
-				 local_hex_string ((unsigned long) sal.pc));
+				     hex_string ((unsigned long) sal.pc));
 		  suppress = 1;
 		}
 	    }
Index: gdb/dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.73
diff -u -p -r1.73 dbxread.c
--- gdb/dbxread.c	7 Sep 2004 21:55:10 -0000	1.73
+++ gdb/dbxread.c	10 Sep 2004 09:15:44 -0000
@@ -54,7 +54,6 @@
 #include "stabsread.h"
 #include "gdb-stabs.h"
 #include "demangle.h"
-#include "language.h"		/* Needed for local_hex_string */
 #include "complaints.h"
 #include "cp-abi.h"
 #include "gdb_assert.h"
@@ -2097,7 +2096,7 @@ read_dbx_symtab (struct objfile *objfile
 	  default:
 	  /* If we haven't found it yet, ignore it.  It's probably some
 	     new type we don't know about yet.  */
-	  unknown_symtype_complaint (local_hex_string (nlist.n_type));
+	  unknown_symtype_complaint (hex_string (nlist.n_type));
 	  continue;
 	}
     }
@@ -3038,7 +3037,7 @@ process_one_symbol (int type, int desc, 
     case N_NBBSS:
     case N_NBSTS:
     case N_NBLCS:
-      unknown_symtype_complaint (local_hex_string (type));
+      unknown_symtype_complaint (hex_string (type));
       /* FALLTHROUGH */
 
       /* The following symbol types don't need the address field relocated,
Index: gdb/defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.164
diff -u -p -r1.164 defs.h
--- gdb/defs.h	8 Sep 2004 21:58:18 -0000	1.164
+++ gdb/defs.h	10 Sep 2004 09:15:45 -0000
@@ -515,6 +515,7 @@ extern char *paddr_d (LONGEST addr);
 
 extern char *phex (ULONGEST l, int sizeof_l);
 extern char *phex_nz (ULONGEST l, int sizeof_l);
+extern char *int_string (LONGEST, int, int, int, int);
 
 /* Like paddr() only print/scan raw CORE_ADDR.  The output from
    core_addr_to_string() can be passed direct to
Index: gdb/exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.41
diff -u -p -r1.41 exec.c
--- gdb/exec.c	7 Sep 2004 21:55:10 -0000	1.41
+++ gdb/exec.c	10 Sep 2004 09:15:45 -0000
@@ -522,8 +522,8 @@ void
 print_section_info (struct target_ops *t, bfd *abfd)
 {
   struct section_table *p;
-  /* FIXME: "016l" is not wide enough when TARGET_ADDR_BIT > 64.  */
-  char *fmt = TARGET_ADDR_BIT <= 32 ? "08l" : "016l";
+  /* FIXME: 16 is not wide enough when TARGET_ADDR_BIT > 64.  */
+  int wid = TARGET_ADDR_BIT <= 32 ? 8 : 16;
 
   printf_filtered ("\t`%s', ", bfd_get_filename (abfd));
   wrap_here ("        ");
@@ -536,8 +536,8 @@ print_section_info (struct target_ops *t
     }
   for (p = t->to_sections; p < t->to_sections_end; p++)
     {
-      printf_filtered ("\t%s", local_hex_string_custom (p->addr, fmt));
-      printf_filtered (" - %s", local_hex_string_custom (p->endaddr, fmt));
+      printf_filtered ("\t%s", hex_string_custom (p->addr, wid));
+      printf_filtered (" - %s", hex_string_custom (p->endaddr, wid));
 
       /* FIXME: A format of "08l" is not wide enough for file offsets
 	 larger than 4GB.  OTOH, making it "016l" isn't desirable either
@@ -546,7 +546,7 @@ print_section_info (struct target_ops *t
 	 format string accordingly.  */
       if (info_verbose)
 	printf_filtered (" @ %s",
-			 local_hex_string_custom (p->the_bfd_section->filepos, "08l"));
+			 hex_string_custom (p->the_bfd_section->filepos, 8));
       printf_filtered (" is %s", bfd_section_name (p->bfd, p->the_bfd_section));
       if (p->bfd != abfd)
 	{
Index: gdb/f-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.c,v
retrieving revision 1.26
diff -u -p -r1.26 f-lang.c
--- gdb/f-lang.c	29 Aug 2004 10:12:23 -0000	1.26
+++ gdb/f-lang.c	10 Sep 2004 09:15:45 -0000
@@ -480,10 +480,6 @@ const struct language_defn f_language_de
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%o", "0", "o", ""},	/* Octal format info */
-  {"%d", "", "d", ""},		/* Decimal format info */
-  {"0x%x", "0x", "x", ""},	/* Hex format info */
   f_op_print_tab,		/* expression operators for printing */
   0,				/* arrays are first-class (not c-style) */
   1,				/* String lower bound */
Index: gdb/i387-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i387-tdep.c,v
retrieving revision 1.42
diff -u -p -r1.42 i387-tdep.c
--- gdb/i387-tdep.c	4 Aug 2004 20:57:29 -0000	1.42
+++ gdb/i387-tdep.c	10 Sep 2004 09:15:46 -0000
@@ -121,7 +121,7 @@ static void
 print_i387_status_word (unsigned int status, struct ui_file *file)
 {
   fprintf_filtered (file, "Status Word:         %s",
-		   local_hex_string_custom (status, "04"));
+		    hex_string_custom (status, 4));
   fputs_filtered ("  ", file);
   fprintf_filtered (file, " %s", (status & 0x0001) ? "IE" : "  ");
   fprintf_filtered (file, " %s", (status & 0x0002) ? "DE" : "  ");
@@ -151,7 +151,7 @@ static void
 print_i387_control_word (unsigned int control, struct ui_file *file)
 {
   fprintf_filtered (file, "Control Word:        %s",
-		   local_hex_string_custom (control, "04"));
+		    hex_string_custom (control, 4));
   fputs_filtered ("  ", file);
   fprintf_filtered (file, " %s", (control & 0x0001) ? "IM" : "  ");
   fprintf_filtered (file, " %s", (control & 0x0002) ? "DM" : "  ");
@@ -276,15 +276,15 @@ i387_print_float_info (struct gdbarch *g
   print_i387_status_word (fstat, file);
   print_i387_control_word (fctrl, file);
   fprintf_filtered (file, "Tag Word:            %s\n",
-		    local_hex_string_custom (ftag, "04"));
+		    hex_string_custom (ftag, 4));
   fprintf_filtered (file, "Instruction Pointer: %s:",
-		    local_hex_string_custom (fiseg, "02"));
-  fprintf_filtered (file, "%s\n", local_hex_string_custom (fioff, "08"));
+		    hex_string_custom (fiseg, 2));
+  fprintf_filtered (file, "%s\n", hex_string_custom (fioff, 8));
   fprintf_filtered (file, "Operand Pointer:     %s:",
-		    local_hex_string_custom (foseg, "02"));
-  fprintf_filtered (file, "%s\n", local_hex_string_custom (fooff, "08"));
+		    hex_string_custom (foseg, 2));
+  fprintf_filtered (file, "%s\n", hex_string_custom (fooff, 8));
   fprintf_filtered (file, "Opcode:              %s\n",
-		    local_hex_string_custom (fop ? (fop | 0xd800) : 0, "04"));
+		    hex_string_custom (fop ? (fop | 0xd800) : 0, 4));
 
 #undef I387_ST0_REGNUM
 }
Index: gdb/infcall.c
===================================================================
RCS file: /cvs/src/src/gdb/infcall.c,v
retrieving revision 1.56
diff -u -p -r1.56 infcall.c
--- gdb/infcall.c	2 Aug 2004 17:39:53 -0000	1.56
+++ gdb/infcall.c	10 Sep 2004 09:15:46 -0000
@@ -746,7 +746,7 @@ You must use a pointer to function type 
 	  {
 	    /* Can't use a cleanup here.  It is discarded, instead use
                an alloca.  */
-	    char *tmp = xstrprintf ("at %s", local_hex_string (funaddr));
+	    char *tmp = xstrprintf ("at %s", hex_string (funaddr));
 	    char *a = alloca (strlen (tmp) + 1);
 	    strcpy (a, tmp);
 	    xfree (tmp);
Index: gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.121
diff -u -p -r1.121 infcmd.c
--- gdb/infcmd.c	3 Aug 2004 03:52:01 -0000	1.121
+++ gdb/infcmd.c	10 Sep 2004 09:15:47 -0000
@@ -1317,7 +1317,7 @@ program_info (char *args, int from_tty)
 
   target_files_info ();
   printf_filtered ("Program stopped at %s.\n",
-		   local_hex_string ((unsigned long) stop_pc));
+		   hex_string ((unsigned long) stop_pc));
   if (stop_step)
     printf_filtered ("It stopped after being stepped.\n");
   else if (num != 0)
Index: gdb/jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.34
diff -u -p -r1.34 jv-lang.c
--- gdb/jv-lang.c	29 Aug 2004 10:12:24 -0000	1.34
+++ gdb/jv-lang.c	10 Sep 2004 09:15:47 -0000
@@ -1106,10 +1106,6 @@ const struct language_defn java_language
   basic_lookup_transparent_type,/* lookup_transparent_type */
   java_demangle,		/* Language specific symbol demangler */
   java_class_name_from_physname,/* Language specific class name */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   java_op_print_tab,		/* expression operators for printing */
   0,				/* not c-style arrays */
   0,				/* String lower bound */
Index: gdb/language.c
===================================================================
RCS file: /cvs/src/src/gdb/language.c,v
retrieving revision 1.49
diff -u -p -r1.49 language.c
--- gdb/language.c	29 Aug 2004 10:12:24 -0000	1.49
+++ gdb/language.c	10 Sep 2004 09:15:48 -0000
@@ -583,124 +583,41 @@ binop_result_type (struct value *v1, str
 /* This page contains functions that return format strings for
    printf for printing out numbers in different formats */
 
-/* Returns the appropriate printf format for hexadecimal
-   numbers. */
-char *
-local_hex_format_custom (char *pre)
-{
-  static char form[50];
-
-  strcpy (form, local_hex_format_prefix ());
-  strcat (form, "%");
-  strcat (form, pre);
-  strcat (form, local_hex_format_specifier ());
-  strcat (form, local_hex_format_suffix ());
-  return form;
-}
+#define MAX_NUM_STRING_LEN 50
 
-/* Converts a LONGEST to custom hexadecimal and stores it in a static
-   string.  Returns a pointer to this string. */
+/* Converts a LONGEST to a C-format hexadecimal literal and stores it in
+   a static string.  Returns a pointer to this string. */
 char *
-local_hex_string (LONGEST num)
+hex_string (LONGEST num)
 {
-  return local_hex_string_custom (num, "l");
+  static char result[MAX_NUM_STRING_LEN];
+  sprintf (result, "0x%s", phex_nz (num, sizeof (num)));
+  return result;
 }
 
-/* Converts a LONGEST number to custom hexadecimal and stores it in a static
-   string.  Returns a pointer to this string. Note that the width parameter
-   should end with "l", e.g. "08l" as with calls to local_hex_string_custom */
+/* Converts a LONGEST number to a C-format hexadecimal literal and stores 
+   it in a static string.  Returns a pointer to this string that is 
+   valid until the next call.  The number is padded on the left with 
+   0s to at least WIDTH characters. */
 
 char *
-local_hex_string_custom (LONGEST num, char *width)
+hex_string_custom (LONGEST num, int width)
 {
-#define RESULT_BUF_LEN 50
-  static char res2[RESULT_BUF_LEN];
-  char format[RESULT_BUF_LEN];
-  int field_width;
-  int num_len;
-  int num_pad_chars;
-  char *pad_char;		/* string with one character */
-  int pad_on_left;
-  char *parse_ptr;
-  char temp_nbr_buf[RESULT_BUF_LEN];
-
-  /* Use phex_nz to print the number into a string, then
-     build the result string from local_hex_format_prefix, padding and 
-     the hex representation as indicated by "width".  */
-  strcpy (temp_nbr_buf, phex_nz (num, sizeof (num)));
-  /* parse width */
-  parse_ptr = width;
-  pad_on_left = 1;
-  pad_char = " ";
-  if (*parse_ptr == '-')
-    {
-      parse_ptr++;
-      pad_on_left = 0;
-    }
-  if (*parse_ptr == '0')
-    {
-      parse_ptr++;
-      if (pad_on_left)
-	pad_char = "0";		/* If padding is on the right, it is blank */
-    }
-  field_width = atoi (parse_ptr);
-  num_len = strlen (temp_nbr_buf);
-  num_pad_chars = field_width - strlen (temp_nbr_buf);	/* possibly negative */
-
-  if (strlen (local_hex_format_prefix ()) + num_len + num_pad_chars
-      >= RESULT_BUF_LEN)		/* paranoia */
+  static char result[MAX_NUM_STRING_LEN];
+  char *result_end = result + MAX_NUM_STRING_LEN - 1;
+  const char* hex = phex_nz (num, sizeof (num));
+  int hex_len = strlen (hex);
+
+  if (hex_len > width)
+    width = hex_len;
+  if (width + 2 >= MAX_NUM_STRING_LEN)
     internal_error (__FILE__, __LINE__,
-		    "local_hex_string_custom: insufficient space to store result");
-
-  strcpy (res2, local_hex_format_prefix ());
-  if (pad_on_left)
-    {
-      while (num_pad_chars > 0)
-	{
-	  strcat (res2, pad_char);
-	  num_pad_chars--;
-	}
-    }
-  strcat (res2, temp_nbr_buf);
-  if (!pad_on_left)
-    {
-      while (num_pad_chars > 0)
-	{
-	  strcat (res2, pad_char);
-	  num_pad_chars--;
-	}
-    }
-  return res2;
-
-}				/* local_hex_string_custom */
-
-/* Returns the appropriate printf format for octal
-   numbers. */
-char *
-local_octal_format_custom (char *pre)
-{
-  static char form[50];
-
-  strcpy (form, local_octal_format_prefix ());
-  strcat (form, "%");
-  strcat (form, pre);
-  strcat (form, local_octal_format_specifier ());
-  strcat (form, local_octal_format_suffix ());
-  return form;
-}
-
-/* Returns the appropriate printf format for decimal numbers. */
-char *
-local_decimal_format_custom (char *pre)
-{
-  static char form[50];
+		    "hex_string_custom: insufficient space to store result");
 
-  strcpy (form, local_decimal_format_prefix ());
-  strcat (form, "%");
-  strcat (form, pre);
-  strcat (form, local_decimal_format_specifier ());
-  strcat (form, local_decimal_format_suffix ());
-  return form;
+  strcpy (result_end - width - 2, "0x");
+  memset (result_end - width, '0', width);
+  strcpy (result_end - hex_len, hex);
+  return result_end - width - 2;
 }
 \f
 #if 0
@@ -1313,10 +1230,6 @@ const struct language_defn unknown_langu
   basic_lookup_transparent_type,/* lookup_transparent_type */
   unk_lang_demangle,		/* Language specific symbol demangler */
   unk_lang_class_name,		/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   unk_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -1353,10 +1266,6 @@ const struct language_defn auto_language
   basic_lookup_transparent_type,/* lookup_transparent_type */
   unk_lang_demangle,		/* Language specific symbol demangler */
   unk_lang_class_name,		/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   unk_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -1392,10 +1301,6 @@ const struct language_defn local_languag
   basic_lookup_transparent_type,/* lookup_transparent_type */
   unk_lang_demangle,		/* Language specific symbol demangler */
   unk_lang_class_name,		/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   unk_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
Index: gdb/language.h
===================================================================
RCS file: /cvs/src/src/gdb/language.h,v
retrieving revision 1.30
diff -u -p -r1.30 language.h
--- gdb/language.h	29 Aug 2004 10:12:24 -0000	1.30
+++ gdb/language.h	10 Sep 2004 09:15:48 -0000
@@ -117,37 +117,6 @@ extern enum case_sensitivity
   }
 case_sensitivity;
 \f
-/* Information for doing language dependent formatting of printed values. */
-
-struct language_format_info
-  {
-    /* The format that can be passed directly to standard C printf functions
-       to generate a completely formatted value in the format appropriate for
-       the language. */
-
-    char *la_format;
-
-    /* The prefix to be used when directly printing a value, or constructing
-       a standard C printf format.  This generally is everything up to the
-       conversion specification (the part introduced by the '%' character
-       and terminated by the conversion specifier character). */
-
-    char *la_format_prefix;
-
-    /* The conversion specifier.  This is generally everything after the
-       field width and precision, typically only a single character such
-       as 'o' for octal format or 'x' for hexadecimal format. */
-
-    char *la_format_specifier;
-
-    /* The suffix to be used when directly printing a value, or constructing
-       a standard C printf format.  This generally is everything after the
-       conversion specification (the part introduced by the '%' character
-       and terminated by the conversion specifier character). */
-
-    char *la_format_suffix;	/* Suffix for custom format string */
-  };
-
 /* Per architecture (OS/ABI) language information.  */
 
 struct language_arch_info
@@ -284,22 +253,6 @@ struct language_defn
     /* Return class name of a mangled method name or NULL.  */
     char *(*la_class_name_from_physname) (const char *physname);
 
-    /* Base 2 (binary) formats. */
-
-    struct language_format_info la_binary_format;
-
-    /* Base 8 (octal) formats. */
-
-    struct language_format_info la_octal_format;
-
-    /* Base 10 (decimal) formats */
-
-    struct language_format_info la_decimal_format;
-
-    /* Base 16 (hexadecimal) formats */
-
-    struct language_format_info la_hex_format;
-
     /* Table for printing expressions */
 
     const struct op_print *la_op_print_tab;
@@ -402,47 +355,6 @@ extern enum language set_language (enum 
 #define LA_VALUE_PRINT(val,stream,fmt,pretty) \
   (current_language->la_value_print(val,stream,fmt,pretty))
 
-/* Return a format string for printf that will print a number in one of
-   the local (language-specific) formats.  Result is static and is
-   overwritten by the next call.  Takes printf options like "08" or "l"
-   (to produce e.g. %08x or %lx).  */
-
-#define local_binary_format() \
-  (current_language->la_binary_format.la_format)
-#define local_binary_format_prefix() \
-  (current_language->la_binary_format.la_format_prefix)
-#define local_binary_format_specifier() \
-  (current_language->la_binary_format.la_format_specifier)
-#define local_binary_format_suffix() \
-  (current_language->la_binary_format.la_format_suffix)
-
-#define local_octal_format() \
-  (current_language->la_octal_format.la_format)
-#define local_octal_format_prefix() \
-  (current_language->la_octal_format.la_format_prefix)
-#define local_octal_format_specifier() \
-  (current_language->la_octal_format.la_format_specifier)
-#define local_octal_format_suffix() \
-  (current_language->la_octal_format.la_format_suffix)
-
-#define local_decimal_format() \
-  (current_language->la_decimal_format.la_format)
-#define local_decimal_format_prefix() \
-  (current_language->la_decimal_format.la_format_prefix)
-#define local_decimal_format_specifier() \
-  (current_language->la_decimal_format.la_format_specifier)
-#define local_decimal_format_suffix() \
-  (current_language->la_decimal_format.la_format_suffix)
-
-#define local_hex_format() \
-  (current_language->la_hex_format.la_format)
-#define local_hex_format_prefix() \
-  (current_language->la_hex_format.la_format_prefix)
-#define local_hex_format_specifier() \
-  (current_language->la_hex_format.la_format_specifier)
-#define local_hex_format_suffix() \
-  (current_language->la_hex_format.la_format_suffix)
-
 #define LA_PRINT_CHAR(ch, stream) \
   (current_language->la_printchar(ch, stream))
 #define LA_PRINT_STRING(stream, string, length, width, force_ellipses) \
@@ -461,17 +373,6 @@ extern enum language set_language (enum 
    && ((c) < 0x7F || (c) >= 0xA0)	\
    && (!sevenbit_strings || (c) < 0x80))
 
-/* Return a format string for printf that will print a number in one of
-   the local (language-specific) formats.  Result is static and is
-   overwritten by the next call.  Takes printf options like "08" or "l"
-   (to produce e.g. %08x or %lx).  */
-
-extern char *local_decimal_format_custom (char *);	/* language.c */
-
-extern char *local_octal_format_custom (char *);	/* language.c */
-
-extern char *local_hex_format_custom (char *);	/* language.c */
-
 #if 0
 /* FIXME: cagney/2000-03-04: This function does not appear to be used.
    It can be deleted once 5.0 has been released. */
@@ -481,13 +382,11 @@ extern char *local_hex_format_custom (ch
 extern char *longest_raw_hex_string (LONGEST);
 #endif
 
-/* Return a string that contains a number formatted in one of the local
-   (language-specific) formats.  Result is static and is overwritten by
-   the next call.  Takes printf options like "08l" or "l".  */
+/* Return a string that contains a number formatted as a hex string */
 
-extern char *local_hex_string (LONGEST);	/* language.c */
+extern char *hex_string (LONGEST);	        /* language.c */
 
-extern char *local_hex_string_custom (LONGEST, char *);	/* language.c */
+extern char *hex_string_custom (LONGEST, int);	/* language.c */
 
 /* Type predicates */
 
Index: gdb/m2-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/m2-lang.c,v
retrieving revision 1.19
diff -u -p -r1.19 m2-lang.c
--- gdb/m2-lang.c	29 Aug 2004 10:12:24 -0000	1.19
+++ gdb/m2-lang.c	10 Sep 2004 09:15:48 -0000
@@ -433,10 +433,6 @@ const struct language_defn m2_language_d
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"%loB", "", "o", "B"},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0%lXH", "0", "X", "H"},	/* Hex format info */
   m2_op_print_tab,		/* expression operators for printing */
   0,				/* arrays are first-class (not c-style) */
   0,				/* String lower bound */
Index: gdb/maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.43
diff -u -p -r1.43 maint.c
--- gdb/maint.c	28 Jul 2004 17:26:27 -0000	1.43
+++ gdb/maint.c	10 Sep 2004 09:15:49 -0000
@@ -308,7 +308,7 @@ maint_print_section_info (const char *na
   printf_filtered ("    0x%s", paddr (addr));
   printf_filtered ("->0x%s", paddr (endaddr));
   printf_filtered (" at %s",
-		   local_hex_string_custom ((unsigned long) filepos, "08l"));
+		   hex_string_custom ((unsigned long) filepos, 8));
   printf_filtered (": %s", name);
   print_bfd_flags (flags);
   printf_filtered ("\n");
Index: gdb/mdebugread.c
===================================================================
RCS file: /cvs/src/src/gdb/mdebugread.c,v
retrieving revision 1.63
diff -u -p -r1.63 mdebugread.c
--- gdb/mdebugread.c	7 Sep 2004 21:55:11 -0000	1.63
+++ gdb/mdebugread.c	10 Sep 2004 09:15:50 -0000
@@ -88,7 +88,6 @@ typedef struct mips_extra_func_info
 #include "aout/stab_gnu.h"	/* STABS information */
 
 #include "expression.h"
-#include "language.h"		/* For local_hex_string() */
 
 extern void _initialize_mdebugread (void);
 
@@ -3266,7 +3265,7 @@ parse_partial_symbols (struct objfile *o
 		    /* If we haven't found it yet, ignore it.  It's probably some
 		       new type we don't know about yet.  */
 		    complaint (&symfile_complaints, "unknown symbol type %s",
-			       local_hex_string (type_code)); /*CUR_SYMBOL_TYPE*/
+			       hex_string (type_code)); /*CUR_SYMBOL_TYPE*/
 		    continue;
 		  }
 		if (stabstring
Index: gdb/memattr.c
===================================================================
RCS file: /cvs/src/src/gdb/memattr.c,v
retrieving revision 1.15
diff -u -p -r1.15 memattr.c
--- gdb/memattr.c	8 Jun 2003 18:27:14 -0000	1.15
+++ gdb/memattr.c	10 Sep 2004 09:15:51 -0000
@@ -240,9 +240,9 @@ mem_info_command (char *args, int from_t
 		       m->number,
 		       m->enabled_p ? 'y' : 'n');
       if (TARGET_ADDR_BIT <= 32)
-	tmp = local_hex_string_custom ((unsigned long) m->lo, "08l");
+	tmp = hex_string_custom ((unsigned long) m->lo, 8);
       else
-	tmp = local_hex_string_custom ((unsigned long) m->lo, "016l");
+	tmp = hex_string_custom ((unsigned long) m->lo, 16);
       
       printf_filtered ("%s ", tmp);
 
@@ -251,14 +251,14 @@ mem_info_command (char *args, int from_t
 	if (m->hi == 0)
 	  tmp = "0x100000000";
 	else
-	  tmp = local_hex_string_custom ((unsigned long) m->hi, "08l");
+	  tmp = hex_string_custom ((unsigned long) m->hi, 8);
 	}
       else
 	{
 	if (m->hi == 0)
 	  tmp = "0x10000000000000000";
 	else
-	  tmp = local_hex_string_custom ((unsigned long) m->hi, "016l");
+	  tmp = hex_string_custom ((unsigned long) m->hi, 16);
 	}
 
       printf_filtered ("%s ", tmp);
Index: gdb/objc-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.c,v
retrieving revision 1.38
diff -u -p -r1.38 objc-lang.c
--- gdb/objc-lang.c	29 Aug 2004 10:12:24 -0000	1.38
+++ gdb/objc-lang.c	10 Sep 2004 09:15:51 -0000
@@ -677,10 +677,6 @@ const struct language_defn objc_language
   basic_lookup_transparent_type,/* lookup_transparent_type */
   objc_demangle,		/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"",     "",    "",  ""},	/* Binary format info */
-  {"0%lo",  "0",   "o", ""},	/* Octal format info */
-  {"%ld",   "",    "d", ""},	/* Decimal format info */
-  {"0x%lx", "0x",  "x", ""},	/* Hex format info */
   objc_op_print_tab,		/* Expression operators for printing */
   1,				/* C-style arrays */
   0,				/* String lower bound */
Index: gdb/p-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/p-lang.c,v
retrieving revision 1.21
diff -u -p -r1.21 p-lang.c
--- gdb/p-lang.c	29 Aug 2004 10:12:24 -0000	1.21
+++ gdb/p-lang.c	10 Sep 2004 09:15:51 -0000
@@ -469,10 +469,6 @@ const struct language_defn pascal_langua
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "%", "b", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"$%lx", "$", "x", ""},	/* Hex format info */
   pascal_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
Index: gdb/pa64solib.c
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.c,v
retrieving revision 1.25
diff -u -p -r1.25 pa64solib.c
--- gdb/pa64solib.c	30 Jul 2004 19:17:19 -0000	1.25
+++ gdb/pa64solib.c	10 Sep 2004 09:15:52 -0000
@@ -796,23 +796,18 @@ pa64_sharedlibrary_info_command (char *i
       if (so_list->loaded == 0)
 	printf_unfiltered ("  (shared library unloaded)");
       printf_unfiltered ("  %-18s",
-	local_hex_string_custom (so_list->pa64_solib_desc.linkage_ptr,
-				 "016l"));
+	hex_string_custom (so_list->pa64_solib_desc.linkage_ptr, 16));
       printf_unfiltered ("\n");
       printf_unfiltered ("%-18s",
-	local_hex_string_custom (so_list->pa64_solib_desc.text_base,
-				 "016l"));
+	hex_string_custom (so_list->pa64_solib_desc.text_base, 16));
       printf_unfiltered (" %-18s",
-	local_hex_string_custom ((so_list->pa64_solib_desc.text_base
-				  + so_list->pa64_solib_desc.text_size),
-				 "016l"));
+	hex_string_custom ((so_list->pa64_solib_desc.text_base
+			    + so_list->pa64_solib_desc.text_size), 16));
       printf_unfiltered (" %-18s",
-	local_hex_string_custom (so_list->pa64_solib_desc.data_base,
-				 "016l"));
+	hex_string_custom (so_list->pa64_solib_desc.data_base, 16));
       printf_unfiltered (" %-18s\n",
-	local_hex_string_custom ((so_list->pa64_solib_desc.data_base
-				  + so_list->pa64_solib_desc.data_size),
-				 "016l"));
+	hex_string_custom ((so_list->pa64_solib_desc.data_base
+			    + so_list->pa64_solib_desc.data_size), 16));
       so_list = so_list->next;
     }
 }
Index: gdb/printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.78
diff -u -p -r1.78 printcmd.c
--- gdb/printcmd.c	26 Jul 2004 14:53:04 -0000	1.78
+++ gdb/printcmd.c	10 Sep 2004 09:15:53 -0000
@@ -499,9 +499,7 @@ print_scalar_formatted (void *valaddr, s
 	    if (*cp == '\0')
 	      cp--;
 	  }
-	strcpy (buf, local_binary_format_prefix ());
-	strcat (buf, cp);
-	strcat (buf, local_binary_format_suffix ());
+	strcpy (buf, cp);
 	fputs_filtered (buf, stream);
       }
       break;
Index: gdb/remote-vx.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-vx.c,v
retrieving revision 1.34
diff -u -p -r1.34 remote-vx.c
--- gdb/remote-vx.c	3 Aug 2004 02:02:23 -0000	1.34
+++ gdb/remote-vx.c	10 Sep 2004 09:15:53 -0000
@@ -566,7 +566,7 @@ vx_run_files_info (void)
 {
   printf_unfiltered ("\tRunning %s VxWorks process %s",
 		     vx_running ? "child" : "attached",
-		     local_hex_string (PIDGET (inferior_ptid)));
+		     hex_string (PIDGET (inferior_ptid)));
   if (vx_running)
     printf_unfiltered (", function `%s'", vx_running);
   printf_unfiltered (".\n");
@@ -972,7 +972,7 @@ vx_wait (ptid_t ptid_to_wait_for, struct
       else if (pid != PIDGET (inferior_ptid))
 	internal_error (__FILE__, __LINE__,
 			"Bad pid for debugged task: %s\n",
-			local_hex_string ((unsigned long) pid));
+			hex_string ((unsigned long) pid));
     }
   while (pid == 0);
 
@@ -1183,7 +1183,7 @@ vx_attach (char *args, int from_tty)
 
   if (from_tty)
     printf_unfiltered ("Attaching pid %s.\n",
-		       local_hex_string ((unsigned long) pid));
+		       hex_string ((unsigned long) pid));
 
   memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in));
   memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out));
@@ -1230,7 +1230,7 @@ vx_detach (char *args, int from_tty)
 
   if (from_tty)
     printf_unfiltered ("Detaching pid %s.\n",
-		       local_hex_string (
+		       hex_string (
 		         (unsigned long) PIDGET (inferior_ptid)));
 
   if (args)			/* FIXME, should be possible to leave suspended */
@@ -1262,7 +1262,8 @@ vx_kill (void)
   Ptrace_return ptrace_out;
   int status;
 
-  printf_unfiltered ("Killing pid %s.\n", local_hex_string ((unsigned long) PIDGET (inferior_ptid)));
+  printf_unfiltered ("Killing pid %s.\n", 
+		     hex_string ((unsigned long) PIDGET (inferior_ptid)));
 
   memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in));
   memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out));
Index: gdb/rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.52
diff -u -p -r1.52 rs6000-nat.c
--- gdb/rs6000-nat.c	3 Aug 2004 00:57:26 -0000	1.52
+++ gdb/rs6000-nat.c	10 Sep 2004 09:15:54 -0000
@@ -33,7 +33,6 @@
 #include "gdb-stabs.h"
 #include "regcache.h"
 #include "arch-utils.h"
-#include "language.h"		/* for local_hex_string().  */
 #include "ppc-tdep.h"
 #include "exec.h"
 
@@ -1229,7 +1228,7 @@ find_toc_address (CORE_ADDR pc)
 					      : vp->objfile);
 	}
     }
-  error ("Unable to find TOC entry for pc %s\n", local_hex_string (pc));
+  error ("Unable to find TOC entry for pc %s\n", hex_string (pc));
 }
 \f
 /* Register that we are able to handle rs6000 core file formats. */
Index: gdb/scm-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/scm-lang.c,v
retrieving revision 1.27
diff -u -p -r1.27 scm-lang.c
--- gdb/scm-lang.c	29 Aug 2004 10:12:24 -0000	1.27
+++ gdb/scm-lang.c	10 Sep 2004 09:15:54 -0000
@@ -266,10 +266,6 @@ const struct language_defn scm_language_
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"#o%lo", "#o", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"#x%lX", "#X", "X", ""},	/* Hex format info */
   NULL,				/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
Index: gdb/solib-frv.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-frv.c,v
retrieving revision 1.3
diff -u -p -r1.3 solib-frv.c
--- gdb/solib-frv.c	26 Jul 2004 14:53:04 -0000	1.3
+++ gdb/solib-frv.c	10 Sep 2004 09:15:54 -0000
@@ -375,7 +375,7 @@ lm_base (void)
   if (solib_frv_debug)
     fprintf_unfiltered (gdb_stdlog,
 			"lm_base: _GLOBAL_OFFSET_TABLE_ + 8 = %s\n",
-			local_hex_string_custom (addr, "08l"));
+			hex_string_custom (addr, 8));
 
   if (target_read_memory (addr, buf, sizeof buf) != 0)
     return 0;
@@ -384,7 +384,7 @@ lm_base (void)
   if (solib_frv_debug)
     fprintf_unfiltered (gdb_stdlog,
 			"lm_base: lm_base_cache = %s\n",
-			local_hex_string_custom (lm_base_cache, "08l"));
+			hex_string_custom (lm_base_cache, 8));
 
   return lm_base_cache;
 }
@@ -431,7 +431,7 @@ frv_current_sos (void)
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 			    "current_sos: reading link_map entry at %s\n",
-			    local_hex_string_custom (lm_addr, "08l"));
+			    hex_string_custom (lm_addr, 8));
 
       if (target_read_memory (lm_addr, (char *) &lm_buf, sizeof (lm_buf)) != 0)
 	{
@@ -670,14 +670,13 @@ enable_break2 (void)
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 	                    "enable_break: interp_loadmap_addr = %s\n",
-			    local_hex_string_custom (interp_loadmap_addr,
-			                             "08l"));
+			    hex_string_custom (interp_loadmap_addr, 8));
 
       ldm = fetch_loadmap (interp_loadmap_addr);
       if (ldm == NULL)
 	{
 	  warning ("Unable to load dynamic linker loadmap at address %s\n",
-	           local_hex_string_custom (interp_loadmap_addr, "08l"));
+	           hex_string_custom (interp_loadmap_addr, 8));
 	  enable_break_failure_warning ();
 	  bfd_close (tmp_bfd);
 	  return 0;
@@ -718,20 +717,20 @@ enable_break2 (void)
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 	                    "enable_break: _dl_debug_addr (prior to relocation) = %s\n",
-			    local_hex_string_custom (addr, "08l"));
+			    hex_string_custom (addr, 8));
 
       addr += displacement_from_map (ldm, addr);
 
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 	                    "enable_break: _dl_debug_addr (after relocation) = %s\n",
-			    local_hex_string_custom (addr, "08l"));
+			    hex_string_custom (addr, 8));
 
       /* Fetch the address of the r_debug struct.  */
       if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
 	{
 	  warning ("Unable to fetch contents of _dl_debug_addr (at address %s) from dynamic linker",
-	           local_hex_string_custom (addr, "08l"));
+	           hex_string_custom (addr, 8));
 	}
       addr = extract_unsigned_integer (addr_buf, sizeof addr_buf);
 
@@ -740,7 +739,7 @@ enable_break2 (void)
       if (target_read_memory (addr + 8, addr_buf, sizeof addr_buf) != 0)
 	{
 	  warning ("Unable to fetch _dl_debug_addr->r_brk (at address %s) from dynamic linker",
-	           local_hex_string_custom (addr + 8, "08l"));
+	           hex_string_custom (addr + 8, 8));
 	  enable_break_failure_warning ();
 	  bfd_close (tmp_bfd);
 	  return 0;
@@ -751,7 +750,7 @@ enable_break2 (void)
       if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
 	{
 	  warning ("Unable to fetch _dl_debug_addr->.r_brk entry point (at address %s) from dynamic linker",
-	           local_hex_string_custom (addr, "08l"));
+	           hex_string_custom (addr, 8));
 	  enable_break_failure_warning ();
 	  bfd_close (tmp_bfd);
 	  return 0;
@@ -799,8 +798,8 @@ enable_break (void)
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 			    "enable_break: solib event breakpoint placed at entry point: %s\n",
-			    local_hex_string_custom
-			      (symfile_objfile->ei.entry_point, "08l"));
+			    hex_string_custom
+			      (symfile_objfile->ei.entry_point, 8));
     }
   else
     {
Index: gdb/solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.67
diff -u -p -r1.67 solib.c
--- gdb/solib.c	1 Sep 2004 18:00:29 -0000	1.67
+++ gdb/solib.c	10 Sep 2004 09:15:55 -0000
@@ -645,18 +645,11 @@ info_sharedlibrary_command (char *ignore
   struct so_list *so = NULL;	/* link map state variable */
   int header_done = 0;
   int addr_width;
-  char *addr_fmt;
 
   if (TARGET_PTR_BIT == 32)
-    {
-      addr_width = 8 + 4;
-      addr_fmt = "08l";
-    }
+    addr_width = 8 + 4;
   else if (TARGET_PTR_BIT == 64)
-    {
-      addr_width = 16 + 4;
-      addr_fmt = "016l";
-    }
+    addr_width = 16 + 4;
   else
     {
       internal_error (__FILE__, __LINE__,
@@ -680,15 +673,15 @@ info_sharedlibrary_command (char *ignore
 
 	  printf_unfiltered ("%-*s", addr_width,
 			     so->textsection != NULL 
-			       ? local_hex_string_custom (
+			       ? hex_string_custom (
 			           (LONGEST) so->textsection->addr,
-	                           addr_fmt)
+	                           addr_width - 4)
 			       : "");
 	  printf_unfiltered ("%-*s", addr_width,
 			     so->textsection != NULL 
-			       ? local_hex_string_custom (
+			       ? hex_string_custom (
 			           (LONGEST) so->textsection->endaddr,
-	                           addr_fmt)
+	                           addr_width - 4)
 			       : "");
 	  printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No");
 	  printf_unfiltered ("%s\n", so->so_name);
Index: gdb/somsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.c,v
retrieving revision 1.36
diff -u -p -r1.36 somsolib.c
--- gdb/somsolib.c	30 Jul 2004 19:17:19 -0000	1.36
+++ gdb/somsolib.c	10 Sep 2004 09:15:55 -0000
@@ -1463,17 +1463,17 @@ som_sharedlibrary_info_command (char *ig
       if (so_list->objfile == NULL)
 	printf_unfiltered ("  (symbols not loaded)");
       printf_unfiltered ("\n");
-      printf_unfiltered ("    %-12s", local_hex_string_custom (flags, "08l"));
+      printf_unfiltered ("    %-12s", hex_string_custom (flags, 8));
       printf_unfiltered ("%-12s",
-	     local_hex_string_custom (so_list->som_solib.text_addr, "08l"));
+			 hex_string_custom (so_list->som_solib.text_addr, 8));
       printf_unfiltered ("%-12s",
-	      local_hex_string_custom (so_list->som_solib.text_end, "08l"));
+			 hex_string_custom (so_list->som_solib.text_end, 8));
       printf_unfiltered ("%-12s",
-	    local_hex_string_custom (so_list->som_solib.data_start, "08l"));
+			 hex_string_custom (so_list->som_solib.data_start, 8));
       printf_unfiltered ("%-12s",
-	      local_hex_string_custom (so_list->som_solib.data_end, "08l"));
+			 hex_string_custom (so_list->som_solib.data_end, 8));
       printf_unfiltered ("%-12s\n",
-	     local_hex_string_custom (so_list->som_solib.got_value, "08l"));
+			 hex_string_custom (so_list->som_solib.got_value, 8));
       so_list = so_list->next;
     }
 }
Index: gdb/symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.141
diff -u -p -r1.141 symfile.c
--- gdb/symfile.c	8 Sep 2004 21:58:19 -0000	1.141
+++ gdb/symfile.c	10 Sep 2004 09:15:57 -0000
@@ -1742,7 +1742,7 @@ add_symbol_file_command (char *args, int
   /* Print the prompt for the query below. And save the arguments into
      a sect_addr_info structure to be passed around to other
      functions.  We have to split this up into separate print
-     statements because local_hex_string returns a local static
+     statements because hex_string returns a local static
      string. */
 
   printf_unfiltered ("add symbol table from file \"%s\" at\n", filename);
@@ -1761,8 +1761,7 @@ add_symbol_file_command (char *args, int
       section_addrs->other[sec_num].name = sec;
       section_addrs->other[sec_num].addr = addr;
       printf_unfiltered ("\t%s_addr = %s\n",
-		       sec,
-		       local_hex_string ((unsigned long)addr));
+		       sec, hex_string ((unsigned long)addr));
       sec_num++;
 
       /* The object's sections are initialized when a
Index: gdb/symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.135
diff -u -p -r1.135 symtab.c
--- gdb/symtab.c	10 Aug 2004 21:16:13 -0000	1.135
+++ gdb/symtab.c	10 Sep 2004 09:15:59 -0000
@@ -3136,12 +3136,12 @@ print_msymbol_info (struct minimal_symbo
   char *tmp;
 
   if (TARGET_ADDR_BIT <= 32)
-    tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol)
-				   & (CORE_ADDR) 0xffffffff,
-				   "08l");
+    tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol)
+			     & (CORE_ADDR) 0xffffffff,
+			     8);
   else
-    tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol),
-				   "016l");
+    tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol),
+			     16);
   printf_filtered ("%s  %s\n",
 		   tmp, SYMBOL_PRINT_NAME (msymbol));
 }
Index: gdb/tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.62
diff -u -p -r1.62 tracepoint.c
--- gdb/tracepoint.c	3 Aug 2004 00:57:27 -0000	1.62
+++ gdb/tracepoint.c	10 Sep 2004 09:16:00 -0000
@@ -494,11 +494,10 @@ tracepoints_info (char *tpnum_exp, int f
 	  char *tmp;
 
 	  if (TARGET_ADDR_BIT <= 32)
-	    tmp = local_hex_string_custom (t->address
-					   & (CORE_ADDR) 0xffffffff, 
-					   "08l");
+	    tmp = hex_string_custom (t->address & (CORE_ADDR) 0xffffffff, 
+				     8);
 	  else
-	    tmp = local_hex_string_custom (t->address, "016l");
+	    tmp = hex_string_custom (t->address, 16);
 
 	  printf_filtered ("%s ", tmp);
 	}
Index: gdb/ui-out.c
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.c,v
retrieving revision 1.29
diff -u -p -r1.29 ui-out.c
--- gdb/ui-out.c	19 Jan 2004 01:20:11 -0000	1.29
+++ gdb/ui-out.c	10 Sep 2004 09:16:00 -0000
@@ -496,9 +496,9 @@ ui_out_field_core_addr (struct ui_out *u
      based on TARGET_ADDR_BIT.  */
   /* print_address_numeric (address, 1, local_stream); */
   if (TARGET_ADDR_BIT <= 32)
-    strcpy (addstr, local_hex_string_custom (address, "08l"));
+    strcpy (addstr, hex_string_custom (address, 8));
   else
-    strcpy (addstr, local_hex_string_custom (address, "016l"));
+    strcpy (addstr, hex_string_custom (address, 16));
 
   ui_out_field_string (uiout, fldname, addstr);
 }
Index: gdb/utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.133
diff -u -p -r1.133 utils.c
--- gdb/utils.c	8 Sep 2004 21:58:19 -0000	1.133
+++ gdb/utils.c	10 Sep 2004 09:16:01 -0000
@@ -2636,7 +2636,7 @@ paddr_nz (CORE_ADDR addr)
 }
 
 static void
-decimal2str (char *paddr_str, char *sign, ULONGEST addr)
+decimal2str (char *paddr_str, char *sign, ULONGEST addr, int width)
 {
   /* steal code from valprint.c:print_decimal().  Should this worry
      about the real size of addr as the above does? */
@@ -2647,18 +2647,60 @@ decimal2str (char *paddr_str, char *sign
       temp[i] = addr % (1000 * 1000 * 1000);
       addr /= (1000 * 1000 * 1000);
       i++;
+      width -= 9;
     }
   while (addr != 0 && i < (sizeof (temp) / sizeof (temp[0])));
+  width += 9;
+  if (width < 0)
+    width = 0;
   switch (i)
     {
     case 1:
-      sprintf (paddr_str, "%s%lu", sign, temp[0]);
+      sprintf (paddr_str, "%s%0*lu", sign, width, temp[0]);
       break;
     case 2:
-      sprintf (paddr_str, "%s%lu%09lu", sign, temp[1], temp[0]);
+      sprintf (paddr_str, "%s%0*lu%09lu", sign, width, temp[1], temp[0]);
       break;
     case 3:
-      sprintf (paddr_str, "%s%lu%09lu%09lu", sign, temp[2], temp[1], temp[0]);
+      sprintf (paddr_str, "%s%0*lu%09lu%09lu", sign, width,
+	       temp[2], temp[1], temp[0]);
+      break;
+    default:
+      internal_error (__FILE__, __LINE__,
+		      "failed internal consistency check");
+    }
+}
+
+static void
+octal2str (char *paddr_str, ULONGEST addr, int width)
+{
+  unsigned long temp[3];
+  int i = 0;
+  do
+    {
+      temp[i] = addr % (0100000 * 0100000);
+      addr /= (0100000 * 0100000);
+      i++;
+      width -= 10;
+    }
+  while (addr != 0 && i < (sizeof (temp) / sizeof (temp[0])));
+  width += 10;
+  if (width < 0)
+    width = 0;
+  switch (i)
+    {
+    case 1:
+      if (temp[0] == 0)
+	sprintf (paddr_str, "%*o", width, 0);
+      else
+	sprintf (paddr_str, "0%0*lo", width, temp[0]);
+      break;
+    case 2:
+      sprintf (paddr_str, "0%0*lo%010lo", width, temp[1], temp[0]);
+      break;
+    case 3:
+      sprintf (paddr_str, "0%0*lo%010lo%010lo", width,
+	       temp[2], temp[1], temp[0]);
       break;
     default:
       internal_error (__FILE__, __LINE__,
@@ -2670,7 +2712,7 @@ char *
 paddr_u (CORE_ADDR addr)
 {
   char *paddr_str = get_cell ();
-  decimal2str (paddr_str, "", addr);
+  decimal2str (paddr_str, "", addr, 0);
   return paddr_str;
 }
 
@@ -2679,9 +2721,9 @@ paddr_d (LONGEST addr)
 {
   char *paddr_str = get_cell ();
   if (addr < 0)
-    decimal2str (paddr_str, "-", -addr);
+    decimal2str (paddr_str, "-", -addr, 0);
   else
-    decimal2str (paddr_str, "", addr);
+    decimal2str (paddr_str, "", addr, 0);
   return paddr_str;
 }
 
@@ -2747,6 +2789,54 @@ phex_nz (ULONGEST l, int sizeof_l)
 }
 
 
+/* Convert VAL to a numeral in the given radix.  For
+ * radix 10, IS_SIGNED may be true, indicating a signed quantity;
+ * otherwise VAL is interpreted as unsigned.  If WIDTH is supplied, 
+ * it is the minimum width (0-padded if needed).  USE_C_FORMAT means
+ * to use C format in all cases.  If it is false, then 'x' 
+ * and 'o' formats do not include a prefix (0x or leading 0). */
+
+char *
+int_string (LONGEST val, int radix, int is_signed, int width, 
+	    int use_c_format)
+{
+  switch (radix) 
+    {
+    case 16:
+      {
+	char *result;
+	if (width == 0)
+	  result = hex_string (val);
+	else
+	  result = hex_string_custom (val, width);
+	if (! use_c_format)
+	  result += 2;
+	return result;
+      }
+    case 10:
+      {
+	char *result = get_cell ();
+	if (is_signed && val < 0)
+	  decimal2str (result, "-", -val, width);
+	else
+	  decimal2str (result, "", val, width);
+	return result;
+      }
+    case 8:
+      {
+	char *result = get_cell ();
+	octal2str (result, val, width);
+	if (use_c_format || val == 0)
+	  return result;
+	else
+	  return result + 1;
+      }
+    default:
+      internal_error (__FILE__, __LINE__,
+		      "failed internal consistency check");
+    }
+}	
+
 /* Convert a CORE_ADDR into a string.  */
 const char *
 core_addr_to_string (const CORE_ADDR addr)
Index: gdb/valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.33
diff -u -p -r1.33 valprint.c
--- gdb/valprint.c	26 Jul 2004 14:53:06 -0000	1.33
+++ gdb/valprint.c	10 Sep 2004 09:16:01 -0000
@@ -209,202 +209,52 @@ val_print_type_code_int (struct type *ty
 
 /* Print a number according to FORMAT which is one of d,u,x,o,b,h,w,g.
    The raison d'etre of this function is to consolidate printing of 
-   LONG_LONG's into this one function.  Some platforms have long longs but
-   don't have a printf() that supports "ll" in the format string.  We handle
-   these by seeing if the number is representable as either a signed or
-   unsigned long, depending upon what format is desired, and if not we just
-   bail out and print the number in hex.
-
-   The format chars b,h,w,g are from print_scalar_formatted().  If USE_LOCAL,
-   format it according to the current language (this should be used for most
-   integers which GDB prints, the exception is things like protocols where
-   the format of the integer is a protocol thing, not a user-visible thing).
- */
-
-#if defined (CC_HAS_LONG_LONG) && !defined (PRINTF_HAS_LONG_LONG)
-static void print_decimal (struct ui_file * stream, char *sign,
-			   int use_local, ULONGEST val_ulong);
-static void
-print_decimal (struct ui_file *stream, char *sign, int use_local,
-	       ULONGEST val_ulong)
-{
-  unsigned long temp[3];
-  int i = 0;
-  do
-    {
-      temp[i] = val_ulong % (1000 * 1000 * 1000);
-      val_ulong /= (1000 * 1000 * 1000);
-      i++;
-    }
-  while (val_ulong != 0 && i < (sizeof (temp) / sizeof (temp[0])));
-  switch (i)
-    {
-    case 1:
-      fprintf_filtered (stream, "%s%lu",
-			sign, temp[0]);
-      break;
-    case 2:
-      fprintf_filtered (stream, "%s%lu%09lu",
-			sign, temp[1], temp[0]);
-      break;
-    case 3:
-      fprintf_filtered (stream, "%s%lu%09lu%09lu",
-			sign, temp[2], temp[1], temp[0]);
-      break;
-    default:
-      internal_error (__FILE__, __LINE__, "failed internal consistency check");
-    }
-  return;
-}
-#endif
+   LONG_LONG's into this one function. The format chars b,h,w,g are 
+   from print_scalar_formatted().  Numbers are printed using C
+   format. 
+
+   USE_C_FORMAT means to use C format in all cases.  Without it, 
+   'o' and 'x' format do not include the standard C radix prefix
+   (leading 0 or 0x). 
+   
+   Hilfinger/2004-09-09: USE_C_FORMAT was originally called USE_LOCAL
+   and was intended to request formating according to the current
+   language and would be used for most integers that GDB prints.  The
+   exceptional cases were things like protocols where the format of
+   the integer is a protocol thing, not a user-visible thing).  The
+   parameter remains to preserve the information of what things might
+   be printed with language-specific format, should we ever resurrect
+   that capability. */
 
 void
-print_longest (struct ui_file *stream, int format, int use_local,
+print_longest (struct ui_file *stream, int format, int use_c_format,
 	       LONGEST val_long)
 {
-#if defined (CC_HAS_LONG_LONG) && !defined (PRINTF_HAS_LONG_LONG)
-  if (sizeof (long) < sizeof (LONGEST))
-    {
-      switch (format)
-	{
-	case 'd':
-	  {
-	    /* Print a signed value, that doesn't fit in a long */
-	    if ((long) val_long != val_long)
-	      {
-		if (val_long < 0)
-		  print_decimal (stream, "-", use_local, -val_long);
-		else
-		  print_decimal (stream, "", use_local, val_long);
-		return;
-	      }
-	    break;
-	  }
-	case 'u':
-	  {
-	    /* Print an unsigned value, that doesn't fit in a long */
-	    if ((unsigned long) val_long != (ULONGEST) val_long)
-	      {
-		print_decimal (stream, "", use_local, val_long);
-		return;
-	      }
-	    break;
-	  }
-	case 'x':
-	case 'o':
-	case 'b':
-	case 'h':
-	case 'w':
-	case 'g':
-	  /* Print as unsigned value, must fit completely in unsigned long */
-	  {
-	    unsigned long temp = val_long;
-	    if (temp != val_long)
-	      {
-		/* Urk, can't represent value in long so print in hex.
-		   Do shift in two operations so that if sizeof (long)
-		   == sizeof (LONGEST) we can avoid warnings from
-		   picky compilers about shifts >= the size of the
-		   shiftee in bits */
-		unsigned long vbot = (unsigned long) val_long;
-		LONGEST temp = (val_long >> (sizeof (long) * HOST_CHAR_BIT - 1));
-		unsigned long vtop = temp >> 1;
-		fprintf_filtered (stream, "0x%lx%08lx", vtop, vbot);
-		return;
-	      }
-	    break;
-	  }
-	}
-    }
-#endif
-
-#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
+  char *val;
   switch (format)
     {
     case 'd':
-      fprintf_filtered (stream,
-			use_local ? local_decimal_format_custom ("ll")
-			: "%lld",
-			(long long) val_long);
-      break;
+      val = int_string (val_long, 10, 1, 0, 1); break;
     case 'u':
-      fprintf_filtered (stream, "%llu", (long long) val_long);
-      break;
+      val = int_string (val_long, 10, 0, 0, 1); break;
     case 'x':
-      fprintf_filtered (stream,
-			use_local ? local_hex_format_custom ("ll")
-			: "%llx",
-			(unsigned long long) val_long);
-      break;
-    case 'o':
-      fprintf_filtered (stream,
-			use_local ? local_octal_format_custom ("ll")
-			: "%llo",
-			(unsigned long long) val_long);
-      break;
+      val = int_string (val_long, 16, 0, 0, use_c_format); break;
     case 'b':
-      fprintf_filtered (stream, local_hex_format_custom ("02ll"), val_long);
-      break;
+      val = int_string (val_long, 16, 0, 2, 1); break;
     case 'h':
-      fprintf_filtered (stream, local_hex_format_custom ("04ll"), val_long);
-      break;
+      val = int_string (val_long, 16, 0, 4, 1); break;
     case 'w':
-      fprintf_filtered (stream, local_hex_format_custom ("08ll"), val_long);
-      break;
+      val = int_string (val_long, 16, 0, 8, 1); break;
     case 'g':
-      fprintf_filtered (stream, local_hex_format_custom ("016ll"), val_long);
-      break;
-    default:
-      internal_error (__FILE__, __LINE__, "failed internal consistency check");
-    }
-#else /* !CC_HAS_LONG_LONG || !PRINTF_HAS_LONG_LONG */
-  /* In the following it is important to coerce (val_long) to a long. It does
-     nothing if !LONG_LONG, but it will chop off the top half (which we know
-     we can ignore) if the host supports long longs.  */
-
-  switch (format)
-    {
-    case 'd':
-      fprintf_filtered (stream,
-			use_local ? local_decimal_format_custom ("l")
-			: "%ld",
-			(long) val_long);
-      break;
-    case 'u':
-      fprintf_filtered (stream, "%lu", (unsigned long) val_long);
-      break;
-    case 'x':
-      fprintf_filtered (stream,
-			use_local ? local_hex_format_custom ("l")
-			: "%lx",
-			(unsigned long) val_long);
+      val = int_string (val_long, 16, 0, 16, 1); break;
       break;
     case 'o':
-      fprintf_filtered (stream,
-			use_local ? local_octal_format_custom ("l")
-			: "%lo",
-			(unsigned long) val_long);
-      break;
-    case 'b':
-      fprintf_filtered (stream, local_hex_format_custom ("02l"),
-			(unsigned long) val_long);
-      break;
-    case 'h':
-      fprintf_filtered (stream, local_hex_format_custom ("04l"),
-			(unsigned long) val_long);
-      break;
-    case 'w':
-      fprintf_filtered (stream, local_hex_format_custom ("08l"),
-			(unsigned long) val_long);
-      break;
-    case 'g':
-      fprintf_filtered (stream, local_hex_format_custom ("016l"),
-			(unsigned long) val_long);
-      break;
+      val = int_string (val_long, 8, 0, 0, use_c_format); break;
     default:
       internal_error (__FILE__, __LINE__, "failed internal consistency check");
-    }
-#endif /* CC_HAS_LONG_LONG || PRINTF_HAS_LONG_LONG */
+    } 
+
+  fprintf_filtered (stream, val);
 }
 
 /* This used to be a macro, but I don't think it is called often enough
@@ -449,9 +299,8 @@ print_floating (char *valaddr, struct ty
       if (floatformat_is_negative (fmt, valaddr))
 	fprintf_filtered (stream, "-");
       fprintf_filtered (stream, "nan(");
-      fputs_filtered (local_hex_format_prefix (), stream);
+      fputs_filtered ("0x", stream);
       fputs_filtered (floatformat_mantissa (fmt, valaddr), stream);
-      fputs_filtered (local_hex_format_suffix (), stream);
       fprintf_filtered (stream, ")");
       return;
     }
@@ -512,7 +361,6 @@ print_binary_chars (struct ui_file *stre
 
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
-  fputs_filtered (local_binary_format_prefix (), stream);
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
@@ -550,7 +398,6 @@ print_binary_chars (struct ui_file *stre
 	    }
 	}
     }
-  fputs_filtered (local_binary_format_suffix (), stream);
 }
 
 /* VALADDR points to an integer of LEN bytes.
@@ -599,7 +446,7 @@ print_octal_chars (struct ui_file *strea
   cycle = (len * BITS_IN_BYTES) % BITS_IN_OCTAL;
   carry = 0;
 
-  fputs_filtered (local_octal_format_prefix (), stream);
+  fputs_filtered ("0", stream);
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
@@ -698,7 +545,6 @@ print_octal_chars (struct ui_file *strea
 	}
     }
 
-  fputs_filtered (local_octal_format_suffix (), stream);
 }
 
 /* VALADDR points to an integer of LEN bytes.
@@ -741,8 +587,6 @@ print_decimal_chars (struct ui_file *str
       digits[i] = 0;
     }
 
-  fputs_filtered (local_decimal_format_prefix (), stream);
-
   /* Ok, we have an unknown number of bytes of data to be printed in
    * decimal.
    *
@@ -837,8 +681,6 @@ print_decimal_chars (struct ui_file *str
       fprintf_filtered (stream, "%1d", digits[i]);
     }
   xfree (digits);
-
-  fputs_filtered (local_decimal_format_suffix (), stream);
 }
 
 /* VALADDR points to an integer of LEN bytes.  Print it in hex on stream.  */
@@ -850,7 +692,7 @@ print_hex_chars (struct ui_file *stream,
 
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
-  fputs_filtered (local_hex_format_prefix (), stream);
+  fputs_filtered ("0x", stream);
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
@@ -869,7 +711,6 @@ print_hex_chars (struct ui_file *stream,
 	  fprintf_filtered (stream, "%02x", *p);
 	}
     }
-  fputs_filtered (local_hex_format_suffix (), stream);
 }
 
 /* VALADDR points to a char integer of LEN bytes.  Print it out in appropriate language form on stream.  
Index: gdb/cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.45
diff -u -p -r1.45 cli-cmds.c
--- gdb/cli/cli-cmds.c	26 Jul 2004 14:53:06 -0000	1.45
+++ gdb/cli/cli-cmds.c	10 Sep 2004 09:16:02 -0000
@@ -600,7 +600,7 @@ edit_command (char *arg, int from_tty)
           if (sal.symtab == 0)
 	    /* FIXME-32x64--assumes sal.pc fits in long.  */
 	    error ("No source file for address %s.",
-		   local_hex_string((unsigned long) sal.pc));
+		   hex_string ((unsigned long) sal.pc));
           sym = find_pc_function (sal.pc);
           if (sym)
 	    {
@@ -767,7 +767,7 @@ list_command (char *arg, int from_tty)
       if (sal.symtab == 0)
 	/* FIXME-32x64--assumes sal.pc fits in long.  */
 	error ("No source file for address %s.",
-	       local_hex_string ((unsigned long) sal.pc));
+	       hex_string ((unsigned long) sal.pc));
       sym = find_pc_function (sal.pc);
       if (sym)
 	{


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] patch to remove language-dependent numeric output support
  2004-09-11  0:38 [RFA] patch to remove language-dependent numeric output support Paul Hilfinger
@ 2004-09-11  2:03 ` Andrew Cagney
  2004-09-11  2:40   ` Paul Hilfinger
  2004-09-11 10:29   ` Paul Hilfinger
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Cagney @ 2004-09-11  2:03 UTC (permalink / raw)
  To: Paul Hilfinger; +Cc: gdb-patches

> [Ooops.  I see my previous Subject line was a bit mangled.  So here is
> the same patch with a more meaningful subject.]

Think your self lucky - my disk failed and ate it :-)

> At Andrew's request, I've prepared a patch that removes the
> (essentially unused) features in the language vector and elsewhere
> that provide for language-dependent integral output formats.  The
> patch below causes GDB to use C-format throughout instead.  This change
> does indeed allow for a bit of brush removal.
> 
> The idea is that if language-specific formatting were ever to be
> re-introduced, it would be via a function in the language vector. (I'd
> suggest that such a function take a raw string of digits and perhaps
> their radix, and work from that.  For C, it would stick 0x or 0 in
> front, according to radix and value; for Ada, it would stick RADIX# in
> front and # after for non-decimal radices).
> 
> The patch would have been a lot shorter, but several name changes seemed 
> indicated.  Comments solicited.

the code changes are ok - the language specific changes being mindless 
follow suit (and I think I'll have a drink, thanks!).

Just some notes though:
> 	(local_decimal_format_custom): Remove.
> 	
> 	* utils.c: (int_string): New function.
I suspect that the the blank lines aren't needed - blank lines separate 
  commits rather than separate parts of the same commit - whichever.

>       functions.  We have to split this up into separate print
> -     statements because local_hex_string returns a local static
> +     statements because hex_string returns a local static

can you file a bug report - that pre-existing behavior is a recipe for 
desaster :-(

Makefile.in will eventually need an update.  If you want to do it 
there's a script (gdb_makefile.in) hanging off of the ari web page that 
you might find useful.  Fixing the file is obvious.

I suspect that the special Makefile rule for printcmd.o can be deleted - 
  something for later.   Ditto.

Again, thanks.  Now where were we with Ada.

Andrew



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] patch to remove language-dependent numeric output support
  2004-09-11  2:03 ` Andrew Cagney
@ 2004-09-11  2:40   ` Paul Hilfinger
  2004-09-11  3:50     ` Daniel Jacobowitz
  2004-09-11 10:29   ` Paul Hilfinger
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Hilfinger @ 2004-09-11  2:40 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches


 > Just some notes though:
 > > 	(local_decimal_format_custom): Remove.
 > > 	
 > > 	* utils.c: (int_string): New function.
 > I suspect that the the blank lines aren't needed - blank lines separate 
 >   commits rather than separate parts of the same commit - whichever.

Really?  OK.  Actually, I was putting in blank lines just to break up
a long ChangeLog entry, but if there's actually a convention, I'm
happy to follow it.

 > >       functions.  We have to split this up into separate print
 > > -     statements because local_hex_string returns a local static
 > > +     statements because hex_string returns a local static
 > 
 > can you file a bug report - that pre-existing behavior is a recipe for 
 > desaster :-(

And what do you think of the get_cell mechanism in utils.c?

Actually, I had considered changing the interface for that reason into 
something like:

	  hex_string (buffer, value)

and have hex_string return the result it puts into BUFFER (and
likewise for other functions, mutatis mutandis).  This would
require each hex_string client to supply the return space.  

 > Makefile.in will eventually need an update.  If you want to do it 
 > there's a script (gdb_makefile.in) hanging off of the ari web page that 
 > you might find useful.  Fixing the file is obvious.
 > I suspect that the special Makefile rule for printcmd.o can be deleted - 
 >   something for later.   Ditto.

Oops.  I had, in fact, intended to do this.

 > Again, thanks.  Now where were we with Ada.

That's a good question.  The only thing I've heard about at the moment
is that Joel mentioned that you had said something about the
architecture vector for language-specific types (I believe it was).  I
have got a patch for getting Ada to handle that the way C now does.

However, in the process, I've come up with a question about intended use:
Suppose one is in the evaluation code for language X and wants to use
built-in type FOO defined for language X.  What is the preferred way
to do so?  Calling language_lookup_primitive_type_by_name?  Seems a
shame to conduct a search in language-specific code when you know the
offset in that language's type vector:  is that how we're supposed to
do it instead, using values from an enumerated type such as enum
c_primitive_types?  Anyway, I can see several ways to do it, but the
intent is a little unclear.

Paul


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] patch to remove language-dependent numeric output support
  2004-09-11  2:40   ` Paul Hilfinger
@ 2004-09-11  3:50     ` Daniel Jacobowitz
  2004-09-12 15:53       ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2004-09-11  3:50 UTC (permalink / raw)
  To: Hilfinger; +Cc: Andrew Cagney, gdb-patches

On Fri, Sep 10, 2004 at 07:40:32PM -0700, Paul Hilfinger wrote:
> 
>  > Just some notes though:
>  > > 	(local_decimal_format_custom): Remove.
>  > > 	
>  > > 	* utils.c: (int_string): New function.
>  > I suspect that the the blank lines aren't needed - blank lines separate 
>  >   commits rather than separate parts of the same commit - whichever.
> 
> Really?  OK.  Actually, I was putting in blank lines just to break up
> a long ChangeLog entry, but if there's actually a convention, I'm
> happy to follow it.

FWIW, I've always used blank lines to separate logically distinct
portions of a changelog entry.  I have no idea what the actual
convention is :-)

-- 
Daniel Jacobowitz


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] patch to remove language-dependent numeric output support
  2004-09-11  2:03 ` Andrew Cagney
  2004-09-11  2:40   ` Paul Hilfinger
@ 2004-09-11 10:29   ` Paul Hilfinger
  2004-09-11 11:32     ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Hilfinger @ 2004-09-11 10:29 UTC (permalink / raw)
  To: cagney; +Cc: gdb-patches


OK. Committed.

2004-09-11  Paul N. Hilfinger  <hilfinger@gnat.com>

        * language.c (local_hex_format_custom): Remove.
	(local_hex_string): Rename to hex_string, use C format, and move to
	utils.c
	(local_hex_string_custom): Rename to hex_string_custom and change
	interface.  Now uses C format.  Move to utils.c
	(local_octal_format_custom): Remove.
	(local_decimal_format_custom): Remove.
	(unknown_language_defn): Remove language-specific number 
	formatting entries.
	(auto_language_defn): Ditto.
	(local_language_defn): Ditto.
	* language.h (struct language_format_info): Delete declaration.
	(struct language_defn): Remove language_format_info fields
	la_binary_format, la_octal_format, la_decimal_format, la_hex_format.
	(local_binary_format): Remove macro.
	(local_binary_format_prefix): Remove macro.
	(local_binary_format_specifier): Remove macro.
	(local_binary_format_suffix): Remove macro.
	(local_octal_format): Remove macro.
	(local_octal_format_prefix): Remove macro.
	(local_octal_format_specifier): Remove macro.
	(local_octal_format_suffix): Remove macro.
	(local_decimal_format): Remove macro.
	(local_decimal_format_prefix): Remove macro.
	(local_decimal_format_specifier): Remove macro.
	(local_decimal_format_suffix): Remove macro.
	(local_hex_format): Remove macro.
	(local_hex_format_prefix): Remove macro.
	(local_hex_format_specifier): Remove macro.
	(local_hex_format_suffix): Remove macro.
	(local_decimal_format_custom): Remove.
	(local_octal_format_custom): Remove.
	(local_hex_format_custom): Remove.
	(local_hex_string): Rename to hex_string and move to defs.h.
	(local_hex_string_custom): Rename to hex_string_custom, change
	interface, and move to defs.h.
	* utils.c: (int_string): New function.
	(hex_string): New function (from language.c).
	(hex_string_custom): New function (from language.c).
	(octal2str): New function.
	(decimal2str): Add width parameter.
	(paddr_u): Use new decimal2str interface.
	(paddr_d): Ditto.
	* defs.h (hex_string): Declare.
	(hex_string_custom): Declare.
	(int_string): Declare.
	* printcmd.c (print_scalar_formatted): Remove localized binary
	formatting.
	* valprint.c (print_longest): Use int_string.
	(print_floating): Use C hex format.
	(print_hex_chars): Ditto.
	(print_binary_chars): Remove language-specific formatting.
	(print_octal_chars): Use C octal format.
	(print_decimal_chars): Delocalize format.
	(print_decimal): Remove.
	* ada-lang.c (ada_language_defn): Remove language-specific number 
	formatting entries.
	* p-lang.c (pascal_language_defn): Ditto.
	* c-lang.c (c_language_defn): Ditto.
	(cplus_language_defn): Ditto.
	(asm_language_defn): Ditto.
	(minimal_language_defn): Ditto.
	* f-lang.c (f_language_defn): Ditto.
	* jv-lang.c (java_language_defn): Ditto.
	* m2-lang.c (m2_language_defn): Ditto.
	* scm-lang.c (scm_language_defn): Ditto.
	* objc-lang.c (objc_language_defn): Ditto.
	* memattr.c (mem_info_command): Use renamed hex_string_custom with
	new interface.
	* pa64solib.c (pa64_sharedlibrary_info_command): Ditto.
	* ui-out.c (ui_out_field_core_addr): Ditto.
	* breakpoint.c (breakpoint_adjustment_warning): Ditto.
	* exec.c (print_section_info): Ditto.
	* i387-tdep.c (print_i387_status_word): Ditto.
	(print_i387_control_word): Ditto.
	(i387_print_float_info): Ditto.
	* maint.c (maint_print_section_info): Ditto.
	* solib.c (info_sharedlibrary_command): Ditto.
	* somsolib.c (som_sharedlibrary_info_command): Ditto.
	* symtab.c (print_msymbol_info): Ditto.
	* tracepoint.c (tracepoints_info): Ditto.
	* solib-frv.c (lm_base): Ditto.
	(frv_current_sos): Ditto.
	(enable_break2): Ditto.
	(enable_break): Ditto.
	* dbxread.c (read_dbx_symtab): Use renamed hex_string.
	(process_one_symbol): Ditto.
	* infcmd.c (program_info): Ditto.
	* mdebugread.c (parse_partial_symbols): Ditto.
	* symfile.c (add_symbol_file_command): Ditto.
	* cli/cli-cmds.c (edit_command): Ditto.
	(list_command): Ditto.
	* infcall.c (call_function_by_hand): Ditto.
	* remote-vx.c (vx_run_files_info): Ditto.
	(vx_wait): Ditto.
	(vx_attach): Ditto.
	(vx_detach): Ditto.
	(vx_kill): Ditto.
	* aix-thread.c (pdc_symbol_addrs): Ditto.
	(pdc_read_regs): Ditto.
	(pdc_write_regs): Ditto.
	(pdc_read_data): Ditto.
	(pdc_write_data): Ditto.
	* d10v-tdep.c (display_trace): Ditto.
	* rs6000-nat.c (find_toc_address): Ditto.
	* aix-thread.c: Don't include language.h.
	* buildsym.c: Ditto.
	* dbxread.c: Ditto.
	* mdebugread.c: Ditto.
	* rs6000-nat.c: Ditto.
	* buildsym.c (make_blockvector): Use renamed hex_string.
	


Index: gdb/ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.51
diff -u -p -r1.51 ada-lang.c
--- gdb/ada-lang.c	29 Aug 2004 10:12:13 -0000	1.51
+++ gdb/ada-lang.c	11 Sep 2004 10:00:21 -0000
@@ -10184,11 +10184,6 @@ const struct language_defn ada_language_
   basic_lookup_transparent_type,        /* lookup_transparent_type */
   ada_la_decode,                /* Language specific symbol demangler */
   NULL,                         /* Language specific class_name_from_physname */
-  {"", "", "", ""},             /* Binary format info */
-  /* Copied from c-lang.c.  */
-  {"0%lo", "0", "o", ""},       /* Octal format info */
-  {"%ld", "", "d", ""},         /* Decimal format info */
-  {"0x%lx", "0x", "x", ""},     /* Hex format info */
   ada_op_print_tab,             /* expression operators for printing */
   0,                            /* c-style arrays */
   1,                            /* String lower bound */
Index: gdb/aix-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/aix-thread.c,v
retrieving revision 1.34
diff -u -p -r1.34 aix-thread.c
--- gdb/aix-thread.c	6 Aug 2004 16:33:17 -0000	1.34
+++ gdb/aix-thread.c	11 Sep 2004 10:00:21 -0000
@@ -48,7 +48,6 @@
 #include "inferior.h"
 #include "regcache.h"
 #include "gdbcmd.h"
-#include "language.h"		/* for local_hex_string() */
 #include "ppc-tdep.h"
 #include "gdb_string.h"
 
@@ -314,7 +313,7 @@ pdc_symbol_addrs (pthdb_user_t user, pth
 	}
       if (debug_aix_thread)
 	fprintf_unfiltered (gdb_stdlog, "  symbols[%d].addr = %s\n",
-			    i, local_hex_string (symbols[i].addr));
+			    i, hex_string (symbols[i].addr));
     }
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog, " returning PDC_SUCCESS\n");
@@ -347,7 +346,7 @@ pdc_read_regs (pthdb_user_t user, 
   
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog, "pdc_read_regs tid=%d flags=%s\n",
-                        (int) tid, local_hex_string (flags));
+                        (int) tid, hex_string (flags));
 
   /* General-purpose registers.  */
   if (flags & PTHDB_FLAG_GPRS)
@@ -413,7 +412,7 @@ pdc_write_regs (pthdb_user_t user,
 
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog, "pdc_write_regs tid=%d flags=%s\n",
-                        (int) tid, local_hex_string (flags));
+                        (int) tid, hex_string (flags));
 
   /* General-purpose registers.  */
   if (flags & PTHDB_FLAG_GPRS)
@@ -458,7 +457,7 @@ pdc_read_data (pthdb_user_t user, void *
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog,
       "pdc_read_data (user = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
-      user, (long) buf, local_hex_string (addr), len);
+      user, (long) buf, hex_string (addr), len);
 
   status = target_read_memory (addr, buf, len);
   ret = status == 0 ? PDC_SUCCESS : PDC_FAILURE;
@@ -480,7 +479,7 @@ pdc_write_data (pthdb_user_t user, void 
   if (debug_aix_thread)
     fprintf_unfiltered (gdb_stdlog,
       "pdc_write_data (user = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
-      user, (long) buf, local_hex_string (addr), len);
+      user, (long) buf, hex_string (addr), len);
 
   status = target_write_memory (addr, buf, len);
   ret = status == 0 ? PDC_SUCCESS : PDC_FAILURE;
Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.180
diff -u -p -r1.180 breakpoint.c
--- gdb/breakpoint.c	1 Sep 2004 18:00:28 -0000	1.180
+++ gdb/breakpoint.c	11 Sep 2004 10:00:22 -0000
@@ -3925,8 +3925,8 @@ breakpoint_adjustment_warning (CORE_ADDR
   char astr1[40];
   char astr2[40];
 
-  strcpy (astr1, local_hex_string_custom ((unsigned long) from_addr, "08l"));
-  strcpy (astr2, local_hex_string_custom ((unsigned long) to_addr, "08l"));
+  strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
+  strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));
   if (have_bnum)
     warning ("Breakpoint %d address previously adjusted from %s to %s.",
              bnum, astr1, astr2);
Index: gdb/buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.39
diff -u -p -r1.39 buildsym.c
--- gdb/buildsym.c	7 Feb 2004 23:13:46 -0000	1.39
+++ gdb/buildsym.c	11 Sep 2004 10:00:22 -0000
@@ -38,7 +38,6 @@
 #include "complaints.h"
 #include "gdb_string.h"
 #include "expression.h"		/* For "enum exp_opcode" used by... */
-#include "language.h"		/* For "local_hex_string" */
 #include "bcache.h"
 #include "filenames.h"		/* For DOSish file names */
 #include "macrotab.h"
@@ -521,7 +520,7 @@ make_blockvector (struct objfile *objfil
 		= BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i));
 
 	      complaint (&symfile_complaints, "block at %s out of order",
-			 local_hex_string ((LONGEST) start));
+			 hex_string ((LONGEST) start));
 	    }
 	}
     }
Index: gdb/c-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.32
diff -u -p -r1.32 c-lang.c
--- gdb/c-lang.c	29 Aug 2004 10:12:14 -0000	1.32
+++ gdb/c-lang.c	11 Sep 2004 10:00:23 -0000
@@ -588,10 +588,6 @@ const struct language_defn c_language_de
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   c_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -650,10 +646,6 @@ const struct language_defn cplus_languag
   cp_lookup_transparent_type,   /* lookup_transparent_type */
   cplus_demangle,		/* Language specific symbol demangler */
   cp_class_name_from_physname,  /* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   c_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -689,10 +681,6 @@ const struct language_defn asm_language_
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   c_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -733,10 +721,6 @@ const struct language_defn minimal_langu
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   c_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
Index: gdb/d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.148
diff -u -p -r1.148 d10v-tdep.c
--- gdb/d10v-tdep.c	7 Aug 2004 19:25:58 -0000	1.148
+++ gdb/d10v-tdep.c	11 Sep 2004 10:00:23 -0000
@@ -1313,7 +1313,7 @@ display_trace (int low, int high)
 		  if (!suppress)
 		    /* FIXME-32x64--assumes sal.pc fits in long.  */
 		    printf_filtered ("No source file for address %s.\n",
-				 local_hex_string ((unsigned long) sal.pc));
+				     hex_string ((unsigned long) sal.pc));
 		  suppress = 1;
 		}
 	    }
Index: gdb/dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.73
diff -u -p -r1.73 dbxread.c
--- gdb/dbxread.c	7 Sep 2004 21:55:10 -0000	1.73
+++ gdb/dbxread.c	11 Sep 2004 10:00:24 -0000
@@ -54,7 +54,6 @@
 #include "stabsread.h"
 #include "gdb-stabs.h"
 #include "demangle.h"
-#include "language.h"		/* Needed for local_hex_string */
 #include "complaints.h"
 #include "cp-abi.h"
 #include "gdb_assert.h"
@@ -2097,7 +2096,7 @@ read_dbx_symtab (struct objfile *objfile
 	  default:
 	  /* If we haven't found it yet, ignore it.  It's probably some
 	     new type we don't know about yet.  */
-	  unknown_symtype_complaint (local_hex_string (nlist.n_type));
+	  unknown_symtype_complaint (hex_string (nlist.n_type));
 	  continue;
 	}
     }
@@ -3038,7 +3037,7 @@ process_one_symbol (int type, int desc, 
     case N_NBBSS:
     case N_NBSTS:
     case N_NBLCS:
-      unknown_symtype_complaint (local_hex_string (type));
+      unknown_symtype_complaint (hex_string (type));
       /* FALLTHROUGH */
 
       /* The following symbol types don't need the address field relocated,
Index: gdb/defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.164
diff -u -p -r1.164 defs.h
--- gdb/defs.h	8 Sep 2004 21:58:18 -0000	1.164
+++ gdb/defs.h	11 Sep 2004 10:00:24 -0000
@@ -515,6 +515,7 @@ extern char *paddr_d (LONGEST addr);
 
 extern char *phex (ULONGEST l, int sizeof_l);
 extern char *phex_nz (ULONGEST l, int sizeof_l);
+extern char *int_string (LONGEST, int, int, int, int);
 
 /* Like paddr() only print/scan raw CORE_ADDR.  The output from
    core_addr_to_string() can be passed direct to
Index: gdb/exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.41
diff -u -p -r1.41 exec.c
--- gdb/exec.c	7 Sep 2004 21:55:10 -0000	1.41
+++ gdb/exec.c	11 Sep 2004 10:00:24 -0000
@@ -522,8 +522,8 @@ void
 print_section_info (struct target_ops *t, bfd *abfd)
 {
   struct section_table *p;
-  /* FIXME: "016l" is not wide enough when TARGET_ADDR_BIT > 64.  */
-  char *fmt = TARGET_ADDR_BIT <= 32 ? "08l" : "016l";
+  /* FIXME: 16 is not wide enough when TARGET_ADDR_BIT > 64.  */
+  int wid = TARGET_ADDR_BIT <= 32 ? 8 : 16;
 
   printf_filtered ("\t`%s', ", bfd_get_filename (abfd));
   wrap_here ("        ");
@@ -536,8 +536,8 @@ print_section_info (struct target_ops *t
     }
   for (p = t->to_sections; p < t->to_sections_end; p++)
     {
-      printf_filtered ("\t%s", local_hex_string_custom (p->addr, fmt));
-      printf_filtered (" - %s", local_hex_string_custom (p->endaddr, fmt));
+      printf_filtered ("\t%s", hex_string_custom (p->addr, wid));
+      printf_filtered (" - %s", hex_string_custom (p->endaddr, wid));
 
       /* FIXME: A format of "08l" is not wide enough for file offsets
 	 larger than 4GB.  OTOH, making it "016l" isn't desirable either
@@ -546,7 +546,7 @@ print_section_info (struct target_ops *t
 	 format string accordingly.  */
       if (info_verbose)
 	printf_filtered (" @ %s",
-			 local_hex_string_custom (p->the_bfd_section->filepos, "08l"));
+			 hex_string_custom (p->the_bfd_section->filepos, 8));
       printf_filtered (" is %s", bfd_section_name (p->bfd, p->the_bfd_section));
       if (p->bfd != abfd)
 	{
Index: gdb/f-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.c,v
retrieving revision 1.26
diff -u -p -r1.26 f-lang.c
--- gdb/f-lang.c	29 Aug 2004 10:12:23 -0000	1.26
+++ gdb/f-lang.c	11 Sep 2004 10:00:24 -0000
@@ -480,10 +480,6 @@ const struct language_defn f_language_de
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%o", "0", "o", ""},	/* Octal format info */
-  {"%d", "", "d", ""},		/* Decimal format info */
-  {"0x%x", "0x", "x", ""},	/* Hex format info */
   f_op_print_tab,		/* expression operators for printing */
   0,				/* arrays are first-class (not c-style) */
   1,				/* String lower bound */
Index: gdb/i387-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i387-tdep.c,v
retrieving revision 1.42
diff -u -p -r1.42 i387-tdep.c
--- gdb/i387-tdep.c	4 Aug 2004 20:57:29 -0000	1.42
+++ gdb/i387-tdep.c	11 Sep 2004 10:00:24 -0000
@@ -121,7 +121,7 @@ static void
 print_i387_status_word (unsigned int status, struct ui_file *file)
 {
   fprintf_filtered (file, "Status Word:         %s",
-		   local_hex_string_custom (status, "04"));
+		    hex_string_custom (status, 4));
   fputs_filtered ("  ", file);
   fprintf_filtered (file, " %s", (status & 0x0001) ? "IE" : "  ");
   fprintf_filtered (file, " %s", (status & 0x0002) ? "DE" : "  ");
@@ -151,7 +151,7 @@ static void
 print_i387_control_word (unsigned int control, struct ui_file *file)
 {
   fprintf_filtered (file, "Control Word:        %s",
-		   local_hex_string_custom (control, "04"));
+		    hex_string_custom (control, 4));
   fputs_filtered ("  ", file);
   fprintf_filtered (file, " %s", (control & 0x0001) ? "IM" : "  ");
   fprintf_filtered (file, " %s", (control & 0x0002) ? "DM" : "  ");
@@ -276,15 +276,15 @@ i387_print_float_info (struct gdbarch *g
   print_i387_status_word (fstat, file);
   print_i387_control_word (fctrl, file);
   fprintf_filtered (file, "Tag Word:            %s\n",
-		    local_hex_string_custom (ftag, "04"));
+		    hex_string_custom (ftag, 4));
   fprintf_filtered (file, "Instruction Pointer: %s:",
-		    local_hex_string_custom (fiseg, "02"));
-  fprintf_filtered (file, "%s\n", local_hex_string_custom (fioff, "08"));
+		    hex_string_custom (fiseg, 2));
+  fprintf_filtered (file, "%s\n", hex_string_custom (fioff, 8));
   fprintf_filtered (file, "Operand Pointer:     %s:",
-		    local_hex_string_custom (foseg, "02"));
-  fprintf_filtered (file, "%s\n", local_hex_string_custom (fooff, "08"));
+		    hex_string_custom (foseg, 2));
+  fprintf_filtered (file, "%s\n", hex_string_custom (fooff, 8));
   fprintf_filtered (file, "Opcode:              %s\n",
-		    local_hex_string_custom (fop ? (fop | 0xd800) : 0, "04"));
+		    hex_string_custom (fop ? (fop | 0xd800) : 0, 4));
 
 #undef I387_ST0_REGNUM
 }
Index: gdb/infcall.c
===================================================================
RCS file: /cvs/src/src/gdb/infcall.c,v
retrieving revision 1.56
diff -u -p -r1.56 infcall.c
--- gdb/infcall.c	2 Aug 2004 17:39:53 -0000	1.56
+++ gdb/infcall.c	11 Sep 2004 10:00:24 -0000
@@ -746,7 +746,7 @@ You must use a pointer to function type 
 	  {
 	    /* Can't use a cleanup here.  It is discarded, instead use
                an alloca.  */
-	    char *tmp = xstrprintf ("at %s", local_hex_string (funaddr));
+	    char *tmp = xstrprintf ("at %s", hex_string (funaddr));
 	    char *a = alloca (strlen (tmp) + 1);
 	    strcpy (a, tmp);
 	    xfree (tmp);
Index: gdb/infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.121
diff -u -p -r1.121 infcmd.c
--- gdb/infcmd.c	3 Aug 2004 03:52:01 -0000	1.121
+++ gdb/infcmd.c	11 Sep 2004 10:00:25 -0000
@@ -1317,7 +1317,7 @@ program_info (char *args, int from_tty)
 
   target_files_info ();
   printf_filtered ("Program stopped at %s.\n",
-		   local_hex_string ((unsigned long) stop_pc));
+		   hex_string ((unsigned long) stop_pc));
   if (stop_step)
     printf_filtered ("It stopped after being stepped.\n");
   else if (num != 0)
Index: gdb/jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.34
diff -u -p -r1.34 jv-lang.c
--- gdb/jv-lang.c	29 Aug 2004 10:12:24 -0000	1.34
+++ gdb/jv-lang.c	11 Sep 2004 10:00:25 -0000
@@ -1106,10 +1106,6 @@ const struct language_defn java_language
   basic_lookup_transparent_type,/* lookup_transparent_type */
   java_demangle,		/* Language specific symbol demangler */
   java_class_name_from_physname,/* Language specific class name */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   java_op_print_tab,		/* expression operators for printing */
   0,				/* not c-style arrays */
   0,				/* String lower bound */
Index: gdb/language.c
===================================================================
RCS file: /cvs/src/src/gdb/language.c,v
retrieving revision 1.49
diff -u -p -r1.49 language.c
--- gdb/language.c	29 Aug 2004 10:12:24 -0000	1.49
+++ gdb/language.c	11 Sep 2004 10:00:25 -0000
@@ -583,124 +583,41 @@ binop_result_type (struct value *v1, str
 /* This page contains functions that return format strings for
    printf for printing out numbers in different formats */
 
-/* Returns the appropriate printf format for hexadecimal
-   numbers. */
-char *
-local_hex_format_custom (char *pre)
-{
-  static char form[50];
-
-  strcpy (form, local_hex_format_prefix ());
-  strcat (form, "%");
-  strcat (form, pre);
-  strcat (form, local_hex_format_specifier ());
-  strcat (form, local_hex_format_suffix ());
-  return form;
-}
+#define MAX_NUM_STRING_LEN 50
 
-/* Converts a LONGEST to custom hexadecimal and stores it in a static
-   string.  Returns a pointer to this string. */
+/* Converts a LONGEST to a C-format hexadecimal literal and stores it in
+   a static string.  Returns a pointer to this string. */
 char *
-local_hex_string (LONGEST num)
+hex_string (LONGEST num)
 {
-  return local_hex_string_custom (num, "l");
+  static char result[MAX_NUM_STRING_LEN];
+  sprintf (result, "0x%s", phex_nz (num, sizeof (num)));
+  return result;
 }
 
-/* Converts a LONGEST number to custom hexadecimal and stores it in a static
-   string.  Returns a pointer to this string. Note that the width parameter
-   should end with "l", e.g. "08l" as with calls to local_hex_string_custom */
+/* Converts a LONGEST number to a C-format hexadecimal literal and stores 
+   it in a static string.  Returns a pointer to this string that is 
+   valid until the next call.  The number is padded on the left with 
+   0s to at least WIDTH characters. */
 
 char *
-local_hex_string_custom (LONGEST num, char *width)
+hex_string_custom (LONGEST num, int width)
 {
-#define RESULT_BUF_LEN 50
-  static char res2[RESULT_BUF_LEN];
-  char format[RESULT_BUF_LEN];
-  int field_width;
-  int num_len;
-  int num_pad_chars;
-  char *pad_char;		/* string with one character */
-  int pad_on_left;
-  char *parse_ptr;
-  char temp_nbr_buf[RESULT_BUF_LEN];
-
-  /* Use phex_nz to print the number into a string, then
-     build the result string from local_hex_format_prefix, padding and 
-     the hex representation as indicated by "width".  */
-  strcpy (temp_nbr_buf, phex_nz (num, sizeof (num)));
-  /* parse width */
-  parse_ptr = width;
-  pad_on_left = 1;
-  pad_char = " ";
-  if (*parse_ptr == '-')
-    {
-      parse_ptr++;
-      pad_on_left = 0;
-    }
-  if (*parse_ptr == '0')
-    {
-      parse_ptr++;
-      if (pad_on_left)
-	pad_char = "0";		/* If padding is on the right, it is blank */
-    }
-  field_width = atoi (parse_ptr);
-  num_len = strlen (temp_nbr_buf);
-  num_pad_chars = field_width - strlen (temp_nbr_buf);	/* possibly negative */
-
-  if (strlen (local_hex_format_prefix ()) + num_len + num_pad_chars
-      >= RESULT_BUF_LEN)		/* paranoia */
+  static char result[MAX_NUM_STRING_LEN];
+  char *result_end = result + MAX_NUM_STRING_LEN - 1;
+  const char* hex = phex_nz (num, sizeof (num));
+  int hex_len = strlen (hex);
+
+  if (hex_len > width)
+    width = hex_len;
+  if (width + 2 >= MAX_NUM_STRING_LEN)
     internal_error (__FILE__, __LINE__,
-		    "local_hex_string_custom: insufficient space to store result");
-
-  strcpy (res2, local_hex_format_prefix ());
-  if (pad_on_left)
-    {
-      while (num_pad_chars > 0)
-	{
-	  strcat (res2, pad_char);
-	  num_pad_chars--;
-	}
-    }
-  strcat (res2, temp_nbr_buf);
-  if (!pad_on_left)
-    {
-      while (num_pad_chars > 0)
-	{
-	  strcat (res2, pad_char);
-	  num_pad_chars--;
-	}
-    }
-  return res2;
-
-}				/* local_hex_string_custom */
-
-/* Returns the appropriate printf format for octal
-   numbers. */
-char *
-local_octal_format_custom (char *pre)
-{
-  static char form[50];
-
-  strcpy (form, local_octal_format_prefix ());
-  strcat (form, "%");
-  strcat (form, pre);
-  strcat (form, local_octal_format_specifier ());
-  strcat (form, local_octal_format_suffix ());
-  return form;
-}
-
-/* Returns the appropriate printf format for decimal numbers. */
-char *
-local_decimal_format_custom (char *pre)
-{
-  static char form[50];
+		    "hex_string_custom: insufficient space to store result");
 
-  strcpy (form, local_decimal_format_prefix ());
-  strcat (form, "%");
-  strcat (form, pre);
-  strcat (form, local_decimal_format_specifier ());
-  strcat (form, local_decimal_format_suffix ());
-  return form;
+  strcpy (result_end - width - 2, "0x");
+  memset (result_end - width, '0', width);
+  strcpy (result_end - hex_len, hex);
+  return result_end - width - 2;
 }
 \f
 #if 0
@@ -1313,10 +1230,6 @@ const struct language_defn unknown_langu
   basic_lookup_transparent_type,/* lookup_transparent_type */
   unk_lang_demangle,		/* Language specific symbol demangler */
   unk_lang_class_name,		/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   unk_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -1353,10 +1266,6 @@ const struct language_defn auto_language
   basic_lookup_transparent_type,/* lookup_transparent_type */
   unk_lang_demangle,		/* Language specific symbol demangler */
   unk_lang_class_name,		/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   unk_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
@@ -1392,10 +1301,6 @@ const struct language_defn local_languag
   basic_lookup_transparent_type,/* lookup_transparent_type */
   unk_lang_demangle,		/* Language specific symbol demangler */
   unk_lang_class_name,		/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0x%lx", "0x", "x", ""},	/* Hex format info */
   unk_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
Index: gdb/language.h
===================================================================
RCS file: /cvs/src/src/gdb/language.h,v
retrieving revision 1.30
diff -u -p -r1.30 language.h
--- gdb/language.h	29 Aug 2004 10:12:24 -0000	1.30
+++ gdb/language.h	11 Sep 2004 10:00:25 -0000
@@ -117,37 +117,6 @@ extern enum case_sensitivity
   }
 case_sensitivity;
 \f
-/* Information for doing language dependent formatting of printed values. */
-
-struct language_format_info
-  {
-    /* The format that can be passed directly to standard C printf functions
-       to generate a completely formatted value in the format appropriate for
-       the language. */
-
-    char *la_format;
-
-    /* The prefix to be used when directly printing a value, or constructing
-       a standard C printf format.  This generally is everything up to the
-       conversion specification (the part introduced by the '%' character
-       and terminated by the conversion specifier character). */
-
-    char *la_format_prefix;
-
-    /* The conversion specifier.  This is generally everything after the
-       field width and precision, typically only a single character such
-       as 'o' for octal format or 'x' for hexadecimal format. */
-
-    char *la_format_specifier;
-
-    /* The suffix to be used when directly printing a value, or constructing
-       a standard C printf format.  This generally is everything after the
-       conversion specification (the part introduced by the '%' character
-       and terminated by the conversion specifier character). */
-
-    char *la_format_suffix;	/* Suffix for custom format string */
-  };
-
 /* Per architecture (OS/ABI) language information.  */
 
 struct language_arch_info
@@ -284,22 +253,6 @@ struct language_defn
     /* Return class name of a mangled method name or NULL.  */
     char *(*la_class_name_from_physname) (const char *physname);
 
-    /* Base 2 (binary) formats. */
-
-    struct language_format_info la_binary_format;
-
-    /* Base 8 (octal) formats. */
-
-    struct language_format_info la_octal_format;
-
-    /* Base 10 (decimal) formats */
-
-    struct language_format_info la_decimal_format;
-
-    /* Base 16 (hexadecimal) formats */
-
-    struct language_format_info la_hex_format;
-
     /* Table for printing expressions */
 
     const struct op_print *la_op_print_tab;
@@ -402,47 +355,6 @@ extern enum language set_language (enum 
 #define LA_VALUE_PRINT(val,stream,fmt,pretty) \
   (current_language->la_value_print(val,stream,fmt,pretty))
 
-/* Return a format string for printf that will print a number in one of
-   the local (language-specific) formats.  Result is static and is
-   overwritten by the next call.  Takes printf options like "08" or "l"
-   (to produce e.g. %08x or %lx).  */
-
-#define local_binary_format() \
-  (current_language->la_binary_format.la_format)
-#define local_binary_format_prefix() \
-  (current_language->la_binary_format.la_format_prefix)
-#define local_binary_format_specifier() \
-  (current_language->la_binary_format.la_format_specifier)
-#define local_binary_format_suffix() \
-  (current_language->la_binary_format.la_format_suffix)
-
-#define local_octal_format() \
-  (current_language->la_octal_format.la_format)
-#define local_octal_format_prefix() \
-  (current_language->la_octal_format.la_format_prefix)
-#define local_octal_format_specifier() \
-  (current_language->la_octal_format.la_format_specifier)
-#define local_octal_format_suffix() \
-  (current_language->la_octal_format.la_format_suffix)
-
-#define local_decimal_format() \
-  (current_language->la_decimal_format.la_format)
-#define local_decimal_format_prefix() \
-  (current_language->la_decimal_format.la_format_prefix)
-#define local_decimal_format_specifier() \
-  (current_language->la_decimal_format.la_format_specifier)
-#define local_decimal_format_suffix() \
-  (current_language->la_decimal_format.la_format_suffix)
-
-#define local_hex_format() \
-  (current_language->la_hex_format.la_format)
-#define local_hex_format_prefix() \
-  (current_language->la_hex_format.la_format_prefix)
-#define local_hex_format_specifier() \
-  (current_language->la_hex_format.la_format_specifier)
-#define local_hex_format_suffix() \
-  (current_language->la_hex_format.la_format_suffix)
-
 #define LA_PRINT_CHAR(ch, stream) \
   (current_language->la_printchar(ch, stream))
 #define LA_PRINT_STRING(stream, string, length, width, force_ellipses) \
@@ -461,17 +373,6 @@ extern enum language set_language (enum 
    && ((c) < 0x7F || (c) >= 0xA0)	\
    && (!sevenbit_strings || (c) < 0x80))
 
-/* Return a format string for printf that will print a number in one of
-   the local (language-specific) formats.  Result is static and is
-   overwritten by the next call.  Takes printf options like "08" or "l"
-   (to produce e.g. %08x or %lx).  */
-
-extern char *local_decimal_format_custom (char *);	/* language.c */
-
-extern char *local_octal_format_custom (char *);	/* language.c */
-
-extern char *local_hex_format_custom (char *);	/* language.c */
-
 #if 0
 /* FIXME: cagney/2000-03-04: This function does not appear to be used.
    It can be deleted once 5.0 has been released. */
@@ -481,13 +382,11 @@ extern char *local_hex_format_custom (ch
 extern char *longest_raw_hex_string (LONGEST);
 #endif
 
-/* Return a string that contains a number formatted in one of the local
-   (language-specific) formats.  Result is static and is overwritten by
-   the next call.  Takes printf options like "08l" or "l".  */
+/* Return a string that contains a number formatted as a hex string */
 
-extern char *local_hex_string (LONGEST);	/* language.c */
+extern char *hex_string (LONGEST);	        /* language.c */
 
-extern char *local_hex_string_custom (LONGEST, char *);	/* language.c */
+extern char *hex_string_custom (LONGEST, int);	/* language.c */
 
 /* Type predicates */
 
Index: gdb/m2-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/m2-lang.c,v
retrieving revision 1.19
diff -u -p -r1.19 m2-lang.c
--- gdb/m2-lang.c	29 Aug 2004 10:12:24 -0000	1.19
+++ gdb/m2-lang.c	11 Sep 2004 10:00:25 -0000
@@ -433,10 +433,6 @@ const struct language_defn m2_language_d
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"%loB", "", "o", "B"},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"0%lXH", "0", "X", "H"},	/* Hex format info */
   m2_op_print_tab,		/* expression operators for printing */
   0,				/* arrays are first-class (not c-style) */
   0,				/* String lower bound */
Index: gdb/maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.43
diff -u -p -r1.43 maint.c
--- gdb/maint.c	28 Jul 2004 17:26:27 -0000	1.43
+++ gdb/maint.c	11 Sep 2004 10:00:25 -0000
@@ -308,7 +308,7 @@ maint_print_section_info (const char *na
   printf_filtered ("    0x%s", paddr (addr));
   printf_filtered ("->0x%s", paddr (endaddr));
   printf_filtered (" at %s",
-		   local_hex_string_custom ((unsigned long) filepos, "08l"));
+		   hex_string_custom ((unsigned long) filepos, 8));
   printf_filtered (": %s", name);
   print_bfd_flags (flags);
   printf_filtered ("\n");
Index: gdb/mdebugread.c
===================================================================
RCS file: /cvs/src/src/gdb/mdebugread.c,v
retrieving revision 1.63
diff -u -p -r1.63 mdebugread.c
--- gdb/mdebugread.c	7 Sep 2004 21:55:11 -0000	1.63
+++ gdb/mdebugread.c	11 Sep 2004 10:00:26 -0000
@@ -88,7 +88,6 @@ typedef struct mips_extra_func_info
 #include "aout/stab_gnu.h"	/* STABS information */
 
 #include "expression.h"
-#include "language.h"		/* For local_hex_string() */
 
 extern void _initialize_mdebugread (void);
 
@@ -3266,7 +3265,7 @@ parse_partial_symbols (struct objfile *o
 		    /* If we haven't found it yet, ignore it.  It's probably some
 		       new type we don't know about yet.  */
 		    complaint (&symfile_complaints, "unknown symbol type %s",
-			       local_hex_string (type_code)); /*CUR_SYMBOL_TYPE*/
+			       hex_string (type_code)); /*CUR_SYMBOL_TYPE*/
 		    continue;
 		  }
 		if (stabstring
Index: gdb/memattr.c
===================================================================
RCS file: /cvs/src/src/gdb/memattr.c,v
retrieving revision 1.15
diff -u -p -r1.15 memattr.c
--- gdb/memattr.c	8 Jun 2003 18:27:14 -0000	1.15
+++ gdb/memattr.c	11 Sep 2004 10:00:26 -0000
@@ -240,9 +240,9 @@ mem_info_command (char *args, int from_t
 		       m->number,
 		       m->enabled_p ? 'y' : 'n');
       if (TARGET_ADDR_BIT <= 32)
-	tmp = local_hex_string_custom ((unsigned long) m->lo, "08l");
+	tmp = hex_string_custom ((unsigned long) m->lo, 8);
       else
-	tmp = local_hex_string_custom ((unsigned long) m->lo, "016l");
+	tmp = hex_string_custom ((unsigned long) m->lo, 16);
       
       printf_filtered ("%s ", tmp);
 
@@ -251,14 +251,14 @@ mem_info_command (char *args, int from_t
 	if (m->hi == 0)
 	  tmp = "0x100000000";
 	else
-	  tmp = local_hex_string_custom ((unsigned long) m->hi, "08l");
+	  tmp = hex_string_custom ((unsigned long) m->hi, 8);
 	}
       else
 	{
 	if (m->hi == 0)
 	  tmp = "0x10000000000000000";
 	else
-	  tmp = local_hex_string_custom ((unsigned long) m->hi, "016l");
+	  tmp = hex_string_custom ((unsigned long) m->hi, 16);
 	}
 
       printf_filtered ("%s ", tmp);
Index: gdb/objc-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.c,v
retrieving revision 1.38
diff -u -p -r1.38 objc-lang.c
--- gdb/objc-lang.c	29 Aug 2004 10:12:24 -0000	1.38
+++ gdb/objc-lang.c	11 Sep 2004 10:00:27 -0000
@@ -677,10 +677,6 @@ const struct language_defn objc_language
   basic_lookup_transparent_type,/* lookup_transparent_type */
   objc_demangle,		/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"",     "",    "",  ""},	/* Binary format info */
-  {"0%lo",  "0",   "o", ""},	/* Octal format info */
-  {"%ld",   "",    "d", ""},	/* Decimal format info */
-  {"0x%lx", "0x",  "x", ""},	/* Hex format info */
   objc_op_print_tab,		/* Expression operators for printing */
   1,				/* C-style arrays */
   0,				/* String lower bound */
Index: gdb/p-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/p-lang.c,v
retrieving revision 1.21
diff -u -p -r1.21 p-lang.c
--- gdb/p-lang.c	29 Aug 2004 10:12:24 -0000	1.21
+++ gdb/p-lang.c	11 Sep 2004 10:00:27 -0000
@@ -469,10 +469,6 @@ const struct language_defn pascal_langua
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "%", "b", ""},		/* Binary format info */
-  {"0%lo", "0", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"$%lx", "$", "x", ""},	/* Hex format info */
   pascal_op_print_tab,		/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
Index: gdb/pa64solib.c
===================================================================
RCS file: /cvs/src/src/gdb/pa64solib.c,v
retrieving revision 1.25
diff -u -p -r1.25 pa64solib.c
--- gdb/pa64solib.c	30 Jul 2004 19:17:19 -0000	1.25
+++ gdb/pa64solib.c	11 Sep 2004 10:00:27 -0000
@@ -796,23 +796,18 @@ pa64_sharedlibrary_info_command (char *i
       if (so_list->loaded == 0)
 	printf_unfiltered ("  (shared library unloaded)");
       printf_unfiltered ("  %-18s",
-	local_hex_string_custom (so_list->pa64_solib_desc.linkage_ptr,
-				 "016l"));
+	hex_string_custom (so_list->pa64_solib_desc.linkage_ptr, 16));
       printf_unfiltered ("\n");
       printf_unfiltered ("%-18s",
-	local_hex_string_custom (so_list->pa64_solib_desc.text_base,
-				 "016l"));
+	hex_string_custom (so_list->pa64_solib_desc.text_base, 16));
       printf_unfiltered (" %-18s",
-	local_hex_string_custom ((so_list->pa64_solib_desc.text_base
-				  + so_list->pa64_solib_desc.text_size),
-				 "016l"));
+	hex_string_custom ((so_list->pa64_solib_desc.text_base
+			    + so_list->pa64_solib_desc.text_size), 16));
       printf_unfiltered (" %-18s",
-	local_hex_string_custom (so_list->pa64_solib_desc.data_base,
-				 "016l"));
+	hex_string_custom (so_list->pa64_solib_desc.data_base, 16));
       printf_unfiltered (" %-18s\n",
-	local_hex_string_custom ((so_list->pa64_solib_desc.data_base
-				  + so_list->pa64_solib_desc.data_size),
-				 "016l"));
+	hex_string_custom ((so_list->pa64_solib_desc.data_base
+			    + so_list->pa64_solib_desc.data_size), 16));
       so_list = so_list->next;
     }
 }
Index: gdb/printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.78
diff -u -p -r1.78 printcmd.c
--- gdb/printcmd.c	26 Jul 2004 14:53:04 -0000	1.78
+++ gdb/printcmd.c	11 Sep 2004 10:00:27 -0000
@@ -499,9 +499,7 @@ print_scalar_formatted (void *valaddr, s
 	    if (*cp == '\0')
 	      cp--;
 	  }
-	strcpy (buf, local_binary_format_prefix ());
-	strcat (buf, cp);
-	strcat (buf, local_binary_format_suffix ());
+	strcpy (buf, cp);
 	fputs_filtered (buf, stream);
       }
       break;
Index: gdb/remote-vx.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-vx.c,v
retrieving revision 1.34
diff -u -p -r1.34 remote-vx.c
--- gdb/remote-vx.c	3 Aug 2004 02:02:23 -0000	1.34
+++ gdb/remote-vx.c	11 Sep 2004 10:00:27 -0000
@@ -566,7 +566,7 @@ vx_run_files_info (void)
 {
   printf_unfiltered ("\tRunning %s VxWorks process %s",
 		     vx_running ? "child" : "attached",
-		     local_hex_string (PIDGET (inferior_ptid)));
+		     hex_string (PIDGET (inferior_ptid)));
   if (vx_running)
     printf_unfiltered (", function `%s'", vx_running);
   printf_unfiltered (".\n");
@@ -972,7 +972,7 @@ vx_wait (ptid_t ptid_to_wait_for, struct
       else if (pid != PIDGET (inferior_ptid))
 	internal_error (__FILE__, __LINE__,
 			"Bad pid for debugged task: %s\n",
-			local_hex_string ((unsigned long) pid));
+			hex_string ((unsigned long) pid));
     }
   while (pid == 0);
 
@@ -1183,7 +1183,7 @@ vx_attach (char *args, int from_tty)
 
   if (from_tty)
     printf_unfiltered ("Attaching pid %s.\n",
-		       local_hex_string ((unsigned long) pid));
+		       hex_string ((unsigned long) pid));
 
   memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in));
   memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out));
@@ -1230,7 +1230,7 @@ vx_detach (char *args, int from_tty)
 
   if (from_tty)
     printf_unfiltered ("Detaching pid %s.\n",
-		       local_hex_string (
+		       hex_string (
 		         (unsigned long) PIDGET (inferior_ptid)));
 
   if (args)			/* FIXME, should be possible to leave suspended */
@@ -1262,7 +1262,8 @@ vx_kill (void)
   Ptrace_return ptrace_out;
   int status;
 
-  printf_unfiltered ("Killing pid %s.\n", local_hex_string ((unsigned long) PIDGET (inferior_ptid)));
+  printf_unfiltered ("Killing pid %s.\n", 
+		     hex_string ((unsigned long) PIDGET (inferior_ptid)));
 
   memset ((char *) &ptrace_in, '\0', sizeof (ptrace_in));
   memset ((char *) &ptrace_out, '\0', sizeof (ptrace_out));
Index: gdb/rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.52
diff -u -p -r1.52 rs6000-nat.c
--- gdb/rs6000-nat.c	3 Aug 2004 00:57:26 -0000	1.52
+++ gdb/rs6000-nat.c	11 Sep 2004 10:00:28 -0000
@@ -33,7 +33,6 @@
 #include "gdb-stabs.h"
 #include "regcache.h"
 #include "arch-utils.h"
-#include "language.h"		/* for local_hex_string().  */
 #include "ppc-tdep.h"
 #include "exec.h"
 
@@ -1229,7 +1228,7 @@ find_toc_address (CORE_ADDR pc)
 					      : vp->objfile);
 	}
     }
-  error ("Unable to find TOC entry for pc %s\n", local_hex_string (pc));
+  error ("Unable to find TOC entry for pc %s\n", hex_string (pc));
 }
 \f
 /* Register that we are able to handle rs6000 core file formats. */
Index: gdb/scm-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/scm-lang.c,v
retrieving revision 1.27
diff -u -p -r1.27 scm-lang.c
--- gdb/scm-lang.c	29 Aug 2004 10:12:24 -0000	1.27
+++ gdb/scm-lang.c	11 Sep 2004 10:00:28 -0000
@@ -266,10 +266,6 @@ const struct language_defn scm_language_
   basic_lookup_transparent_type,/* lookup_transparent_type */
   NULL,				/* Language specific symbol demangler */
   NULL,				/* Language specific class_name_from_physname */
-  {"", "", "", ""},		/* Binary format info */
-  {"#o%lo", "#o", "o", ""},	/* Octal format info */
-  {"%ld", "", "d", ""},		/* Decimal format info */
-  {"#x%lX", "#X", "X", ""},	/* Hex format info */
   NULL,				/* expression operators for printing */
   1,				/* c-style arrays */
   0,				/* String lower bound */
Index: gdb/solib-frv.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-frv.c,v
retrieving revision 1.3
diff -u -p -r1.3 solib-frv.c
--- gdb/solib-frv.c	26 Jul 2004 14:53:04 -0000	1.3
+++ gdb/solib-frv.c	11 Sep 2004 10:00:28 -0000
@@ -375,7 +375,7 @@ lm_base (void)
   if (solib_frv_debug)
     fprintf_unfiltered (gdb_stdlog,
 			"lm_base: _GLOBAL_OFFSET_TABLE_ + 8 = %s\n",
-			local_hex_string_custom (addr, "08l"));
+			hex_string_custom (addr, 8));
 
   if (target_read_memory (addr, buf, sizeof buf) != 0)
     return 0;
@@ -384,7 +384,7 @@ lm_base (void)
   if (solib_frv_debug)
     fprintf_unfiltered (gdb_stdlog,
 			"lm_base: lm_base_cache = %s\n",
-			local_hex_string_custom (lm_base_cache, "08l"));
+			hex_string_custom (lm_base_cache, 8));
 
   return lm_base_cache;
 }
@@ -431,7 +431,7 @@ frv_current_sos (void)
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 			    "current_sos: reading link_map entry at %s\n",
-			    local_hex_string_custom (lm_addr, "08l"));
+			    hex_string_custom (lm_addr, 8));
 
       if (target_read_memory (lm_addr, (char *) &lm_buf, sizeof (lm_buf)) != 0)
 	{
@@ -670,14 +670,13 @@ enable_break2 (void)
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 	                    "enable_break: interp_loadmap_addr = %s\n",
-			    local_hex_string_custom (interp_loadmap_addr,
-			                             "08l"));
+			    hex_string_custom (interp_loadmap_addr, 8));
 
       ldm = fetch_loadmap (interp_loadmap_addr);
       if (ldm == NULL)
 	{
 	  warning ("Unable to load dynamic linker loadmap at address %s\n",
-	           local_hex_string_custom (interp_loadmap_addr, "08l"));
+	           hex_string_custom (interp_loadmap_addr, 8));
 	  enable_break_failure_warning ();
 	  bfd_close (tmp_bfd);
 	  return 0;
@@ -718,20 +717,20 @@ enable_break2 (void)
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 	                    "enable_break: _dl_debug_addr (prior to relocation) = %s\n",
-			    local_hex_string_custom (addr, "08l"));
+			    hex_string_custom (addr, 8));
 
       addr += displacement_from_map (ldm, addr);
 
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 	                    "enable_break: _dl_debug_addr (after relocation) = %s\n",
-			    local_hex_string_custom (addr, "08l"));
+			    hex_string_custom (addr, 8));
 
       /* Fetch the address of the r_debug struct.  */
       if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
 	{
 	  warning ("Unable to fetch contents of _dl_debug_addr (at address %s) from dynamic linker",
-	           local_hex_string_custom (addr, "08l"));
+	           hex_string_custom (addr, 8));
 	}
       addr = extract_unsigned_integer (addr_buf, sizeof addr_buf);
 
@@ -740,7 +739,7 @@ enable_break2 (void)
       if (target_read_memory (addr + 8, addr_buf, sizeof addr_buf) != 0)
 	{
 	  warning ("Unable to fetch _dl_debug_addr->r_brk (at address %s) from dynamic linker",
-	           local_hex_string_custom (addr + 8, "08l"));
+	           hex_string_custom (addr + 8, 8));
 	  enable_break_failure_warning ();
 	  bfd_close (tmp_bfd);
 	  return 0;
@@ -751,7 +750,7 @@ enable_break2 (void)
       if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
 	{
 	  warning ("Unable to fetch _dl_debug_addr->.r_brk entry point (at address %s) from dynamic linker",
-	           local_hex_string_custom (addr, "08l"));
+	           hex_string_custom (addr, 8));
 	  enable_break_failure_warning ();
 	  bfd_close (tmp_bfd);
 	  return 0;
@@ -799,8 +798,8 @@ enable_break (void)
       if (solib_frv_debug)
 	fprintf_unfiltered (gdb_stdlog,
 			    "enable_break: solib event breakpoint placed at entry point: %s\n",
-			    local_hex_string_custom
-			      (symfile_objfile->ei.entry_point, "08l"));
+			    hex_string_custom
+			      (symfile_objfile->ei.entry_point, 8));
     }
   else
     {
Index: gdb/solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.67
diff -u -p -r1.67 solib.c
--- gdb/solib.c	1 Sep 2004 18:00:29 -0000	1.67
+++ gdb/solib.c	11 Sep 2004 10:00:28 -0000
@@ -645,18 +645,11 @@ info_sharedlibrary_command (char *ignore
   struct so_list *so = NULL;	/* link map state variable */
   int header_done = 0;
   int addr_width;
-  char *addr_fmt;
 
   if (TARGET_PTR_BIT == 32)
-    {
-      addr_width = 8 + 4;
-      addr_fmt = "08l";
-    }
+    addr_width = 8 + 4;
   else if (TARGET_PTR_BIT == 64)
-    {
-      addr_width = 16 + 4;
-      addr_fmt = "016l";
-    }
+    addr_width = 16 + 4;
   else
     {
       internal_error (__FILE__, __LINE__,
@@ -680,15 +673,15 @@ info_sharedlibrary_command (char *ignore
 
 	  printf_unfiltered ("%-*s", addr_width,
 			     so->textsection != NULL 
-			       ? local_hex_string_custom (
+			       ? hex_string_custom (
 			           (LONGEST) so->textsection->addr,
-	                           addr_fmt)
+	                           addr_width - 4)
 			       : "");
 	  printf_unfiltered ("%-*s", addr_width,
 			     so->textsection != NULL 
-			       ? local_hex_string_custom (
+			       ? hex_string_custom (
 			           (LONGEST) so->textsection->endaddr,
-	                           addr_fmt)
+	                           addr_width - 4)
 			       : "");
 	  printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No");
 	  printf_unfiltered ("%s\n", so->so_name);
Index: gdb/somsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.c,v
retrieving revision 1.36
diff -u -p -r1.36 somsolib.c
--- gdb/somsolib.c	30 Jul 2004 19:17:19 -0000	1.36
+++ gdb/somsolib.c	11 Sep 2004 10:00:28 -0000
@@ -1463,17 +1463,17 @@ som_sharedlibrary_info_command (char *ig
       if (so_list->objfile == NULL)
 	printf_unfiltered ("  (symbols not loaded)");
       printf_unfiltered ("\n");
-      printf_unfiltered ("    %-12s", local_hex_string_custom (flags, "08l"));
+      printf_unfiltered ("    %-12s", hex_string_custom (flags, 8));
       printf_unfiltered ("%-12s",
-	     local_hex_string_custom (so_list->som_solib.text_addr, "08l"));
+			 hex_string_custom (so_list->som_solib.text_addr, 8));
       printf_unfiltered ("%-12s",
-	      local_hex_string_custom (so_list->som_solib.text_end, "08l"));
+			 hex_string_custom (so_list->som_solib.text_end, 8));
       printf_unfiltered ("%-12s",
-	    local_hex_string_custom (so_list->som_solib.data_start, "08l"));
+			 hex_string_custom (so_list->som_solib.data_start, 8));
       printf_unfiltered ("%-12s",
-	      local_hex_string_custom (so_list->som_solib.data_end, "08l"));
+			 hex_string_custom (so_list->som_solib.data_end, 8));
       printf_unfiltered ("%-12s\n",
-	     local_hex_string_custom (so_list->som_solib.got_value, "08l"));
+			 hex_string_custom (so_list->som_solib.got_value, 8));
       so_list = so_list->next;
     }
 }
Index: gdb/symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.141
diff -u -p -r1.141 symfile.c
--- gdb/symfile.c	8 Sep 2004 21:58:19 -0000	1.141
+++ gdb/symfile.c	11 Sep 2004 10:00:29 -0000
@@ -1742,7 +1742,7 @@ add_symbol_file_command (char *args, int
   /* Print the prompt for the query below. And save the arguments into
      a sect_addr_info structure to be passed around to other
      functions.  We have to split this up into separate print
-     statements because local_hex_string returns a local static
+     statements because hex_string returns a local static
      string. */
 
   printf_unfiltered ("add symbol table from file \"%s\" at\n", filename);
@@ -1761,8 +1761,7 @@ add_symbol_file_command (char *args, int
       section_addrs->other[sec_num].name = sec;
       section_addrs->other[sec_num].addr = addr;
       printf_unfiltered ("\t%s_addr = %s\n",
-		       sec,
-		       local_hex_string ((unsigned long)addr));
+		       sec, hex_string ((unsigned long)addr));
       sec_num++;
 
       /* The object's sections are initialized when a
Index: gdb/symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.135
diff -u -p -r1.135 symtab.c
--- gdb/symtab.c	10 Aug 2004 21:16:13 -0000	1.135
+++ gdb/symtab.c	11 Sep 2004 10:00:30 -0000
@@ -3136,12 +3136,12 @@ print_msymbol_info (struct minimal_symbo
   char *tmp;
 
   if (TARGET_ADDR_BIT <= 32)
-    tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol)
-				   & (CORE_ADDR) 0xffffffff,
-				   "08l");
+    tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol)
+			     & (CORE_ADDR) 0xffffffff,
+			     8);
   else
-    tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol),
-				   "016l");
+    tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol),
+			     16);
   printf_filtered ("%s  %s\n",
 		   tmp, SYMBOL_PRINT_NAME (msymbol));
 }
Index: gdb/tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.62
diff -u -p -r1.62 tracepoint.c
--- gdb/tracepoint.c	3 Aug 2004 00:57:27 -0000	1.62
+++ gdb/tracepoint.c	11 Sep 2004 10:00:30 -0000
@@ -494,11 +494,10 @@ tracepoints_info (char *tpnum_exp, int f
 	  char *tmp;
 
 	  if (TARGET_ADDR_BIT <= 32)
-	    tmp = local_hex_string_custom (t->address
-					   & (CORE_ADDR) 0xffffffff, 
-					   "08l");
+	    tmp = hex_string_custom (t->address & (CORE_ADDR) 0xffffffff, 
+				     8);
 	  else
-	    tmp = local_hex_string_custom (t->address, "016l");
+	    tmp = hex_string_custom (t->address, 16);
 
 	  printf_filtered ("%s ", tmp);
 	}
Index: gdb/ui-out.c
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.c,v
retrieving revision 1.29
diff -u -p -r1.29 ui-out.c
--- gdb/ui-out.c	19 Jan 2004 01:20:11 -0000	1.29
+++ gdb/ui-out.c	11 Sep 2004 10:00:30 -0000
@@ -496,9 +496,9 @@ ui_out_field_core_addr (struct ui_out *u
      based on TARGET_ADDR_BIT.  */
   /* print_address_numeric (address, 1, local_stream); */
   if (TARGET_ADDR_BIT <= 32)
-    strcpy (addstr, local_hex_string_custom (address, "08l"));
+    strcpy (addstr, hex_string_custom (address, 8));
   else
-    strcpy (addstr, local_hex_string_custom (address, "016l"));
+    strcpy (addstr, hex_string_custom (address, 16));
 
   ui_out_field_string (uiout, fldname, addstr);
 }
Index: gdb/utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.133
diff -u -p -r1.133 utils.c
--- gdb/utils.c	8 Sep 2004 21:58:19 -0000	1.133
+++ gdb/utils.c	11 Sep 2004 10:00:31 -0000
@@ -2636,7 +2636,7 @@ paddr_nz (CORE_ADDR addr)
 }
 
 static void
-decimal2str (char *paddr_str, char *sign, ULONGEST addr)
+decimal2str (char *paddr_str, char *sign, ULONGEST addr, int width)
 {
   /* steal code from valprint.c:print_decimal().  Should this worry
      about the real size of addr as the above does? */
@@ -2647,18 +2647,60 @@ decimal2str (char *paddr_str, char *sign
       temp[i] = addr % (1000 * 1000 * 1000);
       addr /= (1000 * 1000 * 1000);
       i++;
+      width -= 9;
     }
   while (addr != 0 && i < (sizeof (temp) / sizeof (temp[0])));
+  width += 9;
+  if (width < 0)
+    width = 0;
   switch (i)
     {
     case 1:
-      sprintf (paddr_str, "%s%lu", sign, temp[0]);
+      sprintf (paddr_str, "%s%0*lu", sign, width, temp[0]);
       break;
     case 2:
-      sprintf (paddr_str, "%s%lu%09lu", sign, temp[1], temp[0]);
+      sprintf (paddr_str, "%s%0*lu%09lu", sign, width, temp[1], temp[0]);
       break;
     case 3:
-      sprintf (paddr_str, "%s%lu%09lu%09lu", sign, temp[2], temp[1], temp[0]);
+      sprintf (paddr_str, "%s%0*lu%09lu%09lu", sign, width,
+	       temp[2], temp[1], temp[0]);
+      break;
+    default:
+      internal_error (__FILE__, __LINE__,
+		      "failed internal consistency check");
+    }
+}
+
+static void
+octal2str (char *paddr_str, ULONGEST addr, int width)
+{
+  unsigned long temp[3];
+  int i = 0;
+  do
+    {
+      temp[i] = addr % (0100000 * 0100000);
+      addr /= (0100000 * 0100000);
+      i++;
+      width -= 10;
+    }
+  while (addr != 0 && i < (sizeof (temp) / sizeof (temp[0])));
+  width += 10;
+  if (width < 0)
+    width = 0;
+  switch (i)
+    {
+    case 1:
+      if (temp[0] == 0)
+	sprintf (paddr_str, "%*o", width, 0);
+      else
+	sprintf (paddr_str, "0%0*lo", width, temp[0]);
+      break;
+    case 2:
+      sprintf (paddr_str, "0%0*lo%010lo", width, temp[1], temp[0]);
+      break;
+    case 3:
+      sprintf (paddr_str, "0%0*lo%010lo%010lo", width,
+	       temp[2], temp[1], temp[0]);
       break;
     default:
       internal_error (__FILE__, __LINE__,
@@ -2670,7 +2712,7 @@ char *
 paddr_u (CORE_ADDR addr)
 {
   char *paddr_str = get_cell ();
-  decimal2str (paddr_str, "", addr);
+  decimal2str (paddr_str, "", addr, 0);
   return paddr_str;
 }
 
@@ -2679,9 +2721,9 @@ paddr_d (LONGEST addr)
 {
   char *paddr_str = get_cell ();
   if (addr < 0)
-    decimal2str (paddr_str, "-", -addr);
+    decimal2str (paddr_str, "-", -addr, 0);
   else
-    decimal2str (paddr_str, "", addr);
+    decimal2str (paddr_str, "", addr, 0);
   return paddr_str;
 }
 
@@ -2747,6 +2789,54 @@ phex_nz (ULONGEST l, int sizeof_l)
 }
 
 
+/* Convert VAL to a numeral in the given radix.  For
+ * radix 10, IS_SIGNED may be true, indicating a signed quantity;
+ * otherwise VAL is interpreted as unsigned.  If WIDTH is supplied, 
+ * it is the minimum width (0-padded if needed).  USE_C_FORMAT means
+ * to use C format in all cases.  If it is false, then 'x' 
+ * and 'o' formats do not include a prefix (0x or leading 0). */
+
+char *
+int_string (LONGEST val, int radix, int is_signed, int width, 
+	    int use_c_format)
+{
+  switch (radix) 
+    {
+    case 16:
+      {
+	char *result;
+	if (width == 0)
+	  result = hex_string (val);
+	else
+	  result = hex_string_custom (val, width);
+	if (! use_c_format)
+	  result += 2;
+	return result;
+      }
+    case 10:
+      {
+	char *result = get_cell ();
+	if (is_signed && val < 0)
+	  decimal2str (result, "-", -val, width);
+	else
+	  decimal2str (result, "", val, width);
+	return result;
+      }
+    case 8:
+      {
+	char *result = get_cell ();
+	octal2str (result, val, width);
+	if (use_c_format || val == 0)
+	  return result;
+	else
+	  return result + 1;
+      }
+    default:
+      internal_error (__FILE__, __LINE__,
+		      "failed internal consistency check");
+    }
+}	
+
 /* Convert a CORE_ADDR into a string.  */
 const char *
 core_addr_to_string (const CORE_ADDR addr)
Index: gdb/valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/valprint.c,v
retrieving revision 1.33
diff -u -p -r1.33 valprint.c
--- gdb/valprint.c	26 Jul 2004 14:53:06 -0000	1.33
+++ gdb/valprint.c	11 Sep 2004 10:00:31 -0000
@@ -209,202 +209,52 @@ val_print_type_code_int (struct type *ty
 
 /* Print a number according to FORMAT which is one of d,u,x,o,b,h,w,g.
    The raison d'etre of this function is to consolidate printing of 
-   LONG_LONG's into this one function.  Some platforms have long longs but
-   don't have a printf() that supports "ll" in the format string.  We handle
-   these by seeing if the number is representable as either a signed or
-   unsigned long, depending upon what format is desired, and if not we just
-   bail out and print the number in hex.
-
-   The format chars b,h,w,g are from print_scalar_formatted().  If USE_LOCAL,
-   format it according to the current language (this should be used for most
-   integers which GDB prints, the exception is things like protocols where
-   the format of the integer is a protocol thing, not a user-visible thing).
- */
-
-#if defined (CC_HAS_LONG_LONG) && !defined (PRINTF_HAS_LONG_LONG)
-static void print_decimal (struct ui_file * stream, char *sign,
-			   int use_local, ULONGEST val_ulong);
-static void
-print_decimal (struct ui_file *stream, char *sign, int use_local,
-	       ULONGEST val_ulong)
-{
-  unsigned long temp[3];
-  int i = 0;
-  do
-    {
-      temp[i] = val_ulong % (1000 * 1000 * 1000);
-      val_ulong /= (1000 * 1000 * 1000);
-      i++;
-    }
-  while (val_ulong != 0 && i < (sizeof (temp) / sizeof (temp[0])));
-  switch (i)
-    {
-    case 1:
-      fprintf_filtered (stream, "%s%lu",
-			sign, temp[0]);
-      break;
-    case 2:
-      fprintf_filtered (stream, "%s%lu%09lu",
-			sign, temp[1], temp[0]);
-      break;
-    case 3:
-      fprintf_filtered (stream, "%s%lu%09lu%09lu",
-			sign, temp[2], temp[1], temp[0]);
-      break;
-    default:
-      internal_error (__FILE__, __LINE__, "failed internal consistency check");
-    }
-  return;
-}
-#endif
+   LONG_LONG's into this one function. The format chars b,h,w,g are 
+   from print_scalar_formatted().  Numbers are printed using C
+   format. 
+
+   USE_C_FORMAT means to use C format in all cases.  Without it, 
+   'o' and 'x' format do not include the standard C radix prefix
+   (leading 0 or 0x). 
+   
+   Hilfinger/2004-09-09: USE_C_FORMAT was originally called USE_LOCAL
+   and was intended to request formating according to the current
+   language and would be used for most integers that GDB prints.  The
+   exceptional cases were things like protocols where the format of
+   the integer is a protocol thing, not a user-visible thing).  The
+   parameter remains to preserve the information of what things might
+   be printed with language-specific format, should we ever resurrect
+   that capability. */
 
 void
-print_longest (struct ui_file *stream, int format, int use_local,
+print_longest (struct ui_file *stream, int format, int use_c_format,
 	       LONGEST val_long)
 {
-#if defined (CC_HAS_LONG_LONG) && !defined (PRINTF_HAS_LONG_LONG)
-  if (sizeof (long) < sizeof (LONGEST))
-    {
-      switch (format)
-	{
-	case 'd':
-	  {
-	    /* Print a signed value, that doesn't fit in a long */
-	    if ((long) val_long != val_long)
-	      {
-		if (val_long < 0)
-		  print_decimal (stream, "-", use_local, -val_long);
-		else
-		  print_decimal (stream, "", use_local, val_long);
-		return;
-	      }
-	    break;
-	  }
-	case 'u':
-	  {
-	    /* Print an unsigned value, that doesn't fit in a long */
-	    if ((unsigned long) val_long != (ULONGEST) val_long)
-	      {
-		print_decimal (stream, "", use_local, val_long);
-		return;
-	      }
-	    break;
-	  }
-	case 'x':
-	case 'o':
-	case 'b':
-	case 'h':
-	case 'w':
-	case 'g':
-	  /* Print as unsigned value, must fit completely in unsigned long */
-	  {
-	    unsigned long temp = val_long;
-	    if (temp != val_long)
-	      {
-		/* Urk, can't represent value in long so print in hex.
-		   Do shift in two operations so that if sizeof (long)
-		   == sizeof (LONGEST) we can avoid warnings from
-		   picky compilers about shifts >= the size of the
-		   shiftee in bits */
-		unsigned long vbot = (unsigned long) val_long;
-		LONGEST temp = (val_long >> (sizeof (long) * HOST_CHAR_BIT - 1));
-		unsigned long vtop = temp >> 1;
-		fprintf_filtered (stream, "0x%lx%08lx", vtop, vbot);
-		return;
-	      }
-	    break;
-	  }
-	}
-    }
-#endif
-
-#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
+  char *val;
   switch (format)
     {
     case 'd':
-      fprintf_filtered (stream,
-			use_local ? local_decimal_format_custom ("ll")
-			: "%lld",
-			(long long) val_long);
-      break;
+      val = int_string (val_long, 10, 1, 0, 1); break;
     case 'u':
-      fprintf_filtered (stream, "%llu", (long long) val_long);
-      break;
+      val = int_string (val_long, 10, 0, 0, 1); break;
     case 'x':
-      fprintf_filtered (stream,
-			use_local ? local_hex_format_custom ("ll")
-			: "%llx",
-			(unsigned long long) val_long);
-      break;
-    case 'o':
-      fprintf_filtered (stream,
-			use_local ? local_octal_format_custom ("ll")
-			: "%llo",
-			(unsigned long long) val_long);
-      break;
+      val = int_string (val_long, 16, 0, 0, use_c_format); break;
     case 'b':
-      fprintf_filtered (stream, local_hex_format_custom ("02ll"), val_long);
-      break;
+      val = int_string (val_long, 16, 0, 2, 1); break;
     case 'h':
-      fprintf_filtered (stream, local_hex_format_custom ("04ll"), val_long);
-      break;
+      val = int_string (val_long, 16, 0, 4, 1); break;
     case 'w':
-      fprintf_filtered (stream, local_hex_format_custom ("08ll"), val_long);
-      break;
+      val = int_string (val_long, 16, 0, 8, 1); break;
     case 'g':
-      fprintf_filtered (stream, local_hex_format_custom ("016ll"), val_long);
-      break;
-    default:
-      internal_error (__FILE__, __LINE__, "failed internal consistency check");
-    }
-#else /* !CC_HAS_LONG_LONG || !PRINTF_HAS_LONG_LONG */
-  /* In the following it is important to coerce (val_long) to a long. It does
-     nothing if !LONG_LONG, but it will chop off the top half (which we know
-     we can ignore) if the host supports long longs.  */
-
-  switch (format)
-    {
-    case 'd':
-      fprintf_filtered (stream,
-			use_local ? local_decimal_format_custom ("l")
-			: "%ld",
-			(long) val_long);
-      break;
-    case 'u':
-      fprintf_filtered (stream, "%lu", (unsigned long) val_long);
-      break;
-    case 'x':
-      fprintf_filtered (stream,
-			use_local ? local_hex_format_custom ("l")
-			: "%lx",
-			(unsigned long) val_long);
+      val = int_string (val_long, 16, 0, 16, 1); break;
       break;
     case 'o':
-      fprintf_filtered (stream,
-			use_local ? local_octal_format_custom ("l")
-			: "%lo",
-			(unsigned long) val_long);
-      break;
-    case 'b':
-      fprintf_filtered (stream, local_hex_format_custom ("02l"),
-			(unsigned long) val_long);
-      break;
-    case 'h':
-      fprintf_filtered (stream, local_hex_format_custom ("04l"),
-			(unsigned long) val_long);
-      break;
-    case 'w':
-      fprintf_filtered (stream, local_hex_format_custom ("08l"),
-			(unsigned long) val_long);
-      break;
-    case 'g':
-      fprintf_filtered (stream, local_hex_format_custom ("016l"),
-			(unsigned long) val_long);
-      break;
+      val = int_string (val_long, 8, 0, 0, use_c_format); break;
     default:
       internal_error (__FILE__, __LINE__, "failed internal consistency check");
-    }
-#endif /* CC_HAS_LONG_LONG || PRINTF_HAS_LONG_LONG */
+    } 
+
+  fprintf_filtered (stream, val);
 }
 
 /* This used to be a macro, but I don't think it is called often enough
@@ -449,9 +299,8 @@ print_floating (char *valaddr, struct ty
       if (floatformat_is_negative (fmt, valaddr))
 	fprintf_filtered (stream, "-");
       fprintf_filtered (stream, "nan(");
-      fputs_filtered (local_hex_format_prefix (), stream);
+      fputs_filtered ("0x", stream);
       fputs_filtered (floatformat_mantissa (fmt, valaddr), stream);
-      fputs_filtered (local_hex_format_suffix (), stream);
       fprintf_filtered (stream, ")");
       return;
     }
@@ -512,7 +361,6 @@ print_binary_chars (struct ui_file *stre
 
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
-  fputs_filtered (local_binary_format_prefix (), stream);
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
@@ -550,7 +398,6 @@ print_binary_chars (struct ui_file *stre
 	    }
 	}
     }
-  fputs_filtered (local_binary_format_suffix (), stream);
 }
 
 /* VALADDR points to an integer of LEN bytes.
@@ -599,7 +446,7 @@ print_octal_chars (struct ui_file *strea
   cycle = (len * BITS_IN_BYTES) % BITS_IN_OCTAL;
   carry = 0;
 
-  fputs_filtered (local_octal_format_prefix (), stream);
+  fputs_filtered ("0", stream);
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
@@ -698,7 +545,6 @@ print_octal_chars (struct ui_file *strea
 	}
     }
 
-  fputs_filtered (local_octal_format_suffix (), stream);
 }
 
 /* VALADDR points to an integer of LEN bytes.
@@ -741,8 +587,6 @@ print_decimal_chars (struct ui_file *str
       digits[i] = 0;
     }
 
-  fputs_filtered (local_decimal_format_prefix (), stream);
-
   /* Ok, we have an unknown number of bytes of data to be printed in
    * decimal.
    *
@@ -837,8 +681,6 @@ print_decimal_chars (struct ui_file *str
       fprintf_filtered (stream, "%1d", digits[i]);
     }
   xfree (digits);
-
-  fputs_filtered (local_decimal_format_suffix (), stream);
 }
 
 /* VALADDR points to an integer of LEN bytes.  Print it in hex on stream.  */
@@ -850,7 +692,7 @@ print_hex_chars (struct ui_file *stream,
 
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
-  fputs_filtered (local_hex_format_prefix (), stream);
+  fputs_filtered ("0x", stream);
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
       for (p = valaddr;
@@ -869,7 +711,6 @@ print_hex_chars (struct ui_file *stream,
 	  fprintf_filtered (stream, "%02x", *p);
 	}
     }
-  fputs_filtered (local_hex_format_suffix (), stream);
 }
 
 /* VALADDR points to a char integer of LEN bytes.  Print it out in appropriate language form on stream.  
Index: gdb/cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.45
diff -u -p -r1.45 cli-cmds.c
--- gdb/cli/cli-cmds.c	26 Jul 2004 14:53:06 -0000	1.45
+++ gdb/cli/cli-cmds.c	11 Sep 2004 10:00:31 -0000
@@ -600,7 +600,7 @@ edit_command (char *arg, int from_tty)
           if (sal.symtab == 0)
 	    /* FIXME-32x64--assumes sal.pc fits in long.  */
 	    error ("No source file for address %s.",
-		   local_hex_string((unsigned long) sal.pc));
+		   hex_string ((unsigned long) sal.pc));
           sym = find_pc_function (sal.pc);
           if (sym)
 	    {
@@ -767,7 +767,7 @@ list_command (char *arg, int from_tty)
       if (sal.symtab == 0)
 	/* FIXME-32x64--assumes sal.pc fits in long.  */
 	error ("No source file for address %s.",
-	       local_hex_string ((unsigned long) sal.pc));
+	       hex_string ((unsigned long) sal.pc));
       sym = find_pc_function (sal.pc);
       if (sym)
 	{


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] patch to remove language-dependent numeric output support
  2004-09-11 10:29   ` Paul Hilfinger
@ 2004-09-11 11:32     ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2004-09-11 11:32 UTC (permalink / raw)
  To: Paul Hilfinger; +Cc: cagney, gdb-patches

> From: Paul Hilfinger <hilfingr@gnat.com>
> Cc: gdb-patches@sources.redhat.com
> Date: Sat, 11 Sep 2004 06:28:51 -0400 (EDT)
> 
> 
> OK. Committed.

I'd appreciate if in the future you'd wait a few days before
committing such jumbo changes.  That will give other maintainers a
chance to read it and respond, even if they aren't on-line 100% of
time, let alone live in another time zone.  (E.g., I've just posted a
small request related to this patch.)

I know that Andrew sort-of approved it, but that hardly qualifies as
enough in this case, since the patch itself was crafted at Andrew's
request.

TIA


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] patch to remove language-dependent numeric output support
  2004-09-11  3:50     ` Daniel Jacobowitz
@ 2004-09-12 15:53       ` Andrew Cagney
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2004-09-12 15:53 UTC (permalink / raw)
  To: Daniel Jacobowitz, Hilfinger; +Cc: gdb-patches

> On Fri, Sep 10, 2004 at 07:40:32PM -0700, Paul Hilfinger wrote:
> 
>>> 
>>>  > Just some notes though:
>>>  > > 	(local_decimal_format_custom): Remove.
>>>  > > 	
>>>  > > 	* utils.c: (int_string): New function.
>>>  > I suspect that the the blank lines aren't needed - blank lines separate 
>>>  >   commits rather than separate parts of the same commit - whichever.
>>> 
>>> Really?  OK.  Actually, I was putting in blank lines just to break up
>>> a long ChangeLog entry, but if there's actually a convention, I'm
>>> happy to follow it.

Near enough.   Here's the exact text:
http://www.gnu.org/prep/standards_42.html#SEC42
> Separate unrelated change log entries with blank lines. When two entries represent parts of the same change, so that they work together, then don't put blank lines between them. Then you can omit the file name and the asterisk when successive entries are in the same file.


> FWIW, I've always used blank lines to separate logically distinct
> portions of a changelog entry.  I have no idea what the actual
> convention is :-)

Or this.  It has the same effect - we never combine logically distinct 
changes into a single commit.

Andrew



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-12 15:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-11  0:38 [RFA] patch to remove language-dependent numeric output support Paul Hilfinger
2004-09-11  2:03 ` Andrew Cagney
2004-09-11  2:40   ` Paul Hilfinger
2004-09-11  3:50     ` Daniel Jacobowitz
2004-09-12 15:53       ` Andrew Cagney
2004-09-11 10:29   ` Paul Hilfinger
2004-09-11 11:32     ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox