Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch]: Get rid of deprecated_print_address_numeric
@ 2008-05-19 15:18 Markus Deuling
  2008-05-20 17:40 ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Deuling @ 2008-05-19 15:18 UTC (permalink / raw)
  To: GDB Patches; +Cc: Ulrich Weigand

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

Hi,

this patch gets completely rid of deprecated_print_address_numeric. Tested on x86_64 without
regression.

This patch breaks Insight. I'll come up with a patch to fix it on the Insight ml.

Ok to commit?


ChangeLog:

	* annotate.c (annotate_source, annotate_frame_begin): Replace
	deprecated_print_address_numeric with paddress.
	* cli/cli-cmds.c (list_command, edit_command): Likewise.
	* tui/tui-stack.c (tui_make_status_line): Likewise.

	* defs.h (deprecated_print_address_numeric): Remove.
	* printcmd.c (deprecated_print_address_numeric): Remove.
	* maint.c (maint_print_section_info): Fix comment.


Regards,
Markus

-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: diff-deprecated_print_address_numeric --]
[-- Type: text/plain, Size: 5098 bytes --]

diff -urpN src/gdb/annotate.c dev/gdb/annotate.c
--- src/gdb/annotate.c	2008-01-01 23:53:09.000000000 +0100
+++ dev/gdb/annotate.c	2008-05-19 10:27:14.000000000 +0200
@@ -418,10 +418,9 @@ annotate_source (char *filename, int lin
   else
     printf_filtered (("\032\032"));
 
-  printf_filtered (("%s:%d:%d:%s:0x"), filename,
-		   line, character,
+  printf_filtered (("%s:%d:%d:%s:"), filename, line, character,
 		   mid ? "middle" : "beg");
-  deprecated_print_address_numeric (pc, 0, gdb_stdout);
+  fputs_filtered (paddress (pc), gdb_stdout);
   printf_filtered (("\n"));
 }
 
@@ -430,8 +429,8 @@ annotate_frame_begin (int level, CORE_AD
 {
   if (annotation_level > 1)
     {
-      printf_filtered (("\n\032\032frame-begin %d 0x"), level);
-      deprecated_print_address_numeric (pc, 0, gdb_stdout);
+      printf_filtered (("\n\032\032frame-begin %d "), level);
+      fputs_filtered (paddress (pc), gdb_stdout);
       printf_filtered (("\n"));
     }
 }
diff -urpN src/gdb/cli/cli-cmds.c dev/gdb/cli/cli-cmds.c
--- src/gdb/cli/cli-cmds.c	2008-05-09 11:34:58.000000000 +0200
+++ dev/gdb/cli/cli-cmds.c	2008-05-19 09:28:51.000000000 +0200
@@ -669,14 +669,14 @@ edit_command (char *arg, int from_tty)
           sym = find_pc_function (sal.pc);
           if (sym)
 	    {
-	      deprecated_print_address_numeric (sal.pc, 1, gdb_stdout);
+	      fputs_filtered (paddress (sal.pc), gdb_stdout);
 	      printf_filtered (" is in ");
 	      fputs_filtered (SYMBOL_PRINT_NAME (sym), gdb_stdout);
 	      printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
 	    }
           else
 	    {
-	      deprecated_print_address_numeric (sal.pc, 1, gdb_stdout);
+	      fputs_filtered (paddress (sal.pc), gdb_stdout);
 	      printf_filtered (" is at %s:%d.\n",
 			       sal.symtab->filename, sal.line);
 	    }
@@ -839,14 +839,14 @@ list_command (char *arg, int from_tty)
       sym = find_pc_function (sal.pc);
       if (sym)
 	{
-	  deprecated_print_address_numeric (sal.pc, 1, gdb_stdout);
+	  fputs_filtered (paddress (sal.pc), gdb_stdout);
 	  printf_filtered (" is in ");
 	  fputs_filtered (SYMBOL_PRINT_NAME (sym), gdb_stdout);
 	  printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
 	}
       else
 	{
-	  deprecated_print_address_numeric (sal.pc, 1, gdb_stdout);
+	  fputs_filtered (paddress (sal.pc), gdb_stdout);
 	  printf_filtered (" is at %s:%d.\n",
 			   sal.symtab->filename, sal.line);
 	}
diff -urpN src/gdb/defs.h dev/gdb/defs.h
--- src/gdb/defs.h	2008-05-05 05:50:36.000000000 +0200
+++ dev/gdb/defs.h	2008-05-19 08:56:37.000000000 +0200
@@ -479,7 +479,7 @@ extern char *paddr_nz (CORE_ADDR addr);
 extern char *paddr_u (CORE_ADDR addr);
 extern char *paddr_d (LONGEST addr);
 
-/* Like 0x%lx, replaces deprecated_print_address_numeric.  */
+/* Like 0x%lx.  */
 extern const char *paddress (CORE_ADDR addr);
 
 extern char *phex (ULONGEST l, int sizeof_l);
@@ -565,8 +565,6 @@ extern int build_address_symbolic (CORE_
 				   int *line, 	
 				   int *unmapped);
 
-extern void deprecated_print_address_numeric (CORE_ADDR, int, struct ui_file *);
-
 extern void print_address (CORE_ADDR, struct ui_file *);
 
 /* From source.c */
diff -urpN src/gdb/maint.c dev/gdb/maint.c
--- src/gdb/maint.c	2008-01-01 23:53:12.000000000 +0100
+++ dev/gdb/maint.c	2008-05-19 08:56:37.000000000 +0200
@@ -306,8 +306,7 @@ maint_print_section_info (const char *na
 			  CORE_ADDR addr, CORE_ADDR endaddr, 
 			  unsigned long filepos)
 {
-  /* FIXME-32x64: Need deprecated_print_address_numeric with field
-     width.  */
+  /* FIXME-32x64: Need paddress with field width.  */
   printf_filtered ("    0x%s", paddr (addr));
   printf_filtered ("->0x%s", paddr (endaddr));
   printf_filtered (" at %s",
diff -urpN src/gdb/printcmd.c dev/gdb/printcmd.c
--- src/gdb/printcmd.c	2008-05-09 11:34:55.000000000 +0200
+++ dev/gdb/printcmd.c	2008-05-19 08:56:37.000000000 +0200
@@ -675,23 +675,6 @@ build_address_symbolic (CORE_ADDR addr, 
   return 0;
 }
 
-/* Print address ADDR on STREAM.  USE_LOCAL means the same thing as for
-   print_longest.  */
-void
-deprecated_print_address_numeric (CORE_ADDR addr, int use_local,
-				  struct ui_file *stream)
-{
-  if (use_local)
-    fputs_filtered (paddress (addr), stream);
-  else
-    {
-      int addr_bit = gdbarch_addr_bit (current_gdbarch);
-
-      if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-	addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
-      print_longest (stream, 'x', 0, (ULONGEST) addr);
-    }
-}
 
 /* Print address ADDR symbolically on STREAM.
    First print it as a number.  Then perhaps print
diff -urpN src/gdb/tui/tui-stack.c dev/gdb/tui/tui-stack.c
--- src/gdb/tui/tui-stack.c	2008-01-01 23:53:22.000000000 +0100
+++ dev/gdb/tui/tui-stack.c	2008-05-19 09:31:02.000000000 +0200
@@ -102,7 +102,7 @@ tui_make_status_line (struct tui_locator
 
   /* Translate PC address.  */
   pc_out = tui_sfileopen (128);
-  deprecated_print_address_numeric (loc->addr, 1, pc_out);
+  fputs_filtered (paddress (loc->addr), pc_out);
   pc_buf = tui_file_get_strbuf (pc_out);
   pc_width = strlen (pc_buf);
   

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

* Re: [patch]: Get rid of deprecated_print_address_numeric
  2008-05-19 15:18 [patch]: Get rid of deprecated_print_address_numeric Markus Deuling
@ 2008-05-20 17:40 ` Ulrich Weigand
  2008-05-21 15:52   ` Markus Deuling
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2008-05-20 17:40 UTC (permalink / raw)
  To: Markus Deuling; +Cc: GDB Patches

Markus Deuling wrote:

> 	* annotate.c (annotate_source, annotate_frame_begin): Replace
> 	deprecated_print_address_numeric with paddress.
> 	* cli/cli-cmds.c (list_command, edit_command): Likewise.
> 	* tui/tui-stack.c (tui_make_status_line): Likewise.
> 
> 	* defs.h (deprecated_print_address_numeric): Remove.
> 	* printcmd.c (deprecated_print_address_numeric): Remove.
> 	* maint.c (maint_print_section_info): Fix comment.

In general, I like the idea, but I was wondering about one thing:

> @@ -418,10 +418,9 @@ annotate_source (char *filename, int lin
>    else
>      printf_filtered (("\032\032"));
>  
> -  printf_filtered (("%s:%d:%d:%s:0x"), filename,
> -		   line, character,
> +  printf_filtered (("%s:%d:%d:%s:"), filename, line, character,
>  		   mid ? "middle" : "beg");
> -  deprecated_print_address_numeric (pc, 0, gdb_stdout);
> +  fputs_filtered (paddress (pc), gdb_stdout);
>    printf_filtered (("\n"));


Hmm, I guess one of the benefits of paddress is that you no longer
need to break out a single (logical) message into multiple pieces.

Something like

  printf_filtered (("%s:%d:%d:%s:%s\n"), filename, line, character,
  		   mid ? "middle" : "beg", paddress (pc));

instead of the lines above would be better.

(Even if that doesn't really matter in this particular case, in
general it is also better to use complete phrases as strings for
translation.)


Would you mind changing the patch accordingly?

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [patch]: Get rid of deprecated_print_address_numeric
  2008-05-20 17:40 ` Ulrich Weigand
@ 2008-05-21 15:52   ` Markus Deuling
  2008-05-21 18:36     ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Deuling @ 2008-05-21 15:52 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

Hi Uli,

Ulrich Weigand schrieb:
> Hmm, I guess one of the benefits of paddress is that you no longer
> need to break out a single (logical) message into multiple pieces.
> 
> Something like
> 
>   printf_filtered (("%s:%d:%d:%s:%s\n"), filename, line, character,
>   		   mid ? "middle" : "beg", paddress (pc));
> 
> instead of the lines above would be better.
> 
> (Even if that doesn't really matter in this particular case, in
> general it is also better to use complete phrases as strings for
> translation.)
> 
> 
> Would you mind changing the patch accordingly?

thanks. I reworked that patch now and also integrated the other occurences of paddress
where suitable. Re-tested on x86_64 without regression.

Is this Ok ?

Regards,
Markus


-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: diff-deprecated_print_address_numeric --]
[-- Type: text/plain, Size: 5579 bytes --]

diff -urpN src/gdb/annotate.c dev/gdb/annotate.c
--- src/gdb/annotate.c	2008-05-21 06:30:20.000000000 +0200
+++ dev/gdb/annotate.c	2008-05-21 07:14:45.000000000 +0200
@@ -427,22 +427,15 @@ annotate_source (char *filename, int lin
   else
     printf_filtered (("\032\032"));
 
-  printf_filtered (("%s:%d:%d:%s:0x"), filename,
-		   line, character,
-		   mid ? "middle" : "beg");
-  deprecated_print_address_numeric (pc, 0, gdb_stdout);
-  printf_filtered (("\n"));
+  printf_filtered (("%s:%d:%d:%s:%s\n"), filename, line, character,
+		   mid ? "middle" : "beg", paddress (pc));
 }
 
 void
 annotate_frame_begin (int level, CORE_ADDR pc)
 {
   if (annotation_level > 1)
-    {
-      printf_filtered (("\n\032\032frame-begin %d 0x"), level);
-      deprecated_print_address_numeric (pc, 0, gdb_stdout);
-      printf_filtered (("\n"));
-    }
+    printf_filtered (("\n\032\032frame-begin %d %s\n"), level, paddress (pc));
 }
 
 void
diff -urpN src/gdb/cli/cli-cmds.c dev/gdb/cli/cli-cmds.c
--- src/gdb/cli/cli-cmds.c	2008-05-09 11:34:58.000000000 +0200
+++ dev/gdb/cli/cli-cmds.c	2008-05-21 07:19:08.000000000 +0200
@@ -668,18 +668,12 @@ edit_command (char *arg, int from_tty)
 		   hex_string ((unsigned long) sal.pc));
           sym = find_pc_function (sal.pc);
           if (sym)
-	    {
-	      deprecated_print_address_numeric (sal.pc, 1, gdb_stdout);
-	      printf_filtered (" is in ");
-	      fputs_filtered (SYMBOL_PRINT_NAME (sym), gdb_stdout);
-	      printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
-	    }
+	    printf_filtered ("%s is in %s (%s:%d).\n", paddress (sal.pc),
+			     SYMBOL_PRINT_NAME (sym), sal.symtab->filename,
+			     sal.line);
           else
-	    {
-	      deprecated_print_address_numeric (sal.pc, 1, gdb_stdout);
-	      printf_filtered (" is at %s:%d.\n",
-			       sal.symtab->filename, sal.line);
-	    }
+	    printf_filtered ("%s is at %s:%d.\n", paddress (sal.pc),
+			     sal.symtab->filename, sal.line);
         }
 
       /* If what was given does not imply a symtab, it must be an undebuggable
@@ -838,18 +832,12 @@ list_command (char *arg, int from_tty)
 	       hex_string ((unsigned long) sal.pc));
       sym = find_pc_function (sal.pc);
       if (sym)
-	{
-	  deprecated_print_address_numeric (sal.pc, 1, gdb_stdout);
-	  printf_filtered (" is in ");
-	  fputs_filtered (SYMBOL_PRINT_NAME (sym), gdb_stdout);
-	  printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
-	}
+	printf_filtered ("%s is in %s (%s:%d).\n",
+			 paddress (sal.pc), SYMBOL_PRINT_NAME (sym),
+			 sal.symtab->filename, sal.line);
       else
-	{
-	  deprecated_print_address_numeric (sal.pc, 1, gdb_stdout);
-	  printf_filtered (" is at %s:%d.\n",
-			   sal.symtab->filename, sal.line);
-	}
+	printf_filtered ("%s is at %s:%d.\n", paddress (sal.pc),
+			 sal.symtab->filename, sal.line);
     }
 
   /* If line was not specified by just a line number,
diff -urpN src/gdb/defs.h dev/gdb/defs.h
--- src/gdb/defs.h	2008-05-05 05:50:36.000000000 +0200
+++ dev/gdb/defs.h	2008-05-21 07:03:42.000000000 +0200
@@ -479,7 +479,7 @@ extern char *paddr_nz (CORE_ADDR addr);
 extern char *paddr_u (CORE_ADDR addr);
 extern char *paddr_d (LONGEST addr);
 
-/* Like 0x%lx, replaces deprecated_print_address_numeric.  */
+/* Like 0x%lx.  */
 extern const char *paddress (CORE_ADDR addr);
 
 extern char *phex (ULONGEST l, int sizeof_l);
@@ -565,8 +565,6 @@ extern int build_address_symbolic (CORE_
 				   int *line, 	
 				   int *unmapped);
 
-extern void deprecated_print_address_numeric (CORE_ADDR, int, struct ui_file *);
-
 extern void print_address (CORE_ADDR, struct ui_file *);
 
 /* From source.c */
diff -urpN src/gdb/maint.c dev/gdb/maint.c
--- src/gdb/maint.c	2008-01-01 23:53:12.000000000 +0100
+++ dev/gdb/maint.c	2008-05-21 07:03:42.000000000 +0200
@@ -306,8 +306,7 @@ maint_print_section_info (const char *na
 			  CORE_ADDR addr, CORE_ADDR endaddr, 
 			  unsigned long filepos)
 {
-  /* FIXME-32x64: Need deprecated_print_address_numeric with field
-     width.  */
+  /* FIXME-32x64: Need paddress with field width.  */
   printf_filtered ("    0x%s", paddr (addr));
   printf_filtered ("->0x%s", paddr (endaddr));
   printf_filtered (" at %s",
diff -urpN src/gdb/printcmd.c dev/gdb/printcmd.c
--- src/gdb/printcmd.c	2008-05-21 06:30:21.000000000 +0200
+++ dev/gdb/printcmd.c	2008-05-21 07:03:42.000000000 +0200
@@ -675,23 +675,6 @@ build_address_symbolic (CORE_ADDR addr, 
   return 0;
 }
 
-/* Print address ADDR on STREAM.  USE_LOCAL means the same thing as for
-   print_longest.  */
-void
-deprecated_print_address_numeric (CORE_ADDR addr, int use_local,
-				  struct ui_file *stream)
-{
-  if (use_local)
-    fputs_filtered (paddress (addr), stream);
-  else
-    {
-      int addr_bit = gdbarch_addr_bit (current_gdbarch);
-
-      if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-	addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
-      print_longest (stream, 'x', 0, (ULONGEST) addr);
-    }
-}
 
 /* Print address ADDR symbolically on STREAM.
    First print it as a number.  Then perhaps print
diff -urpN src/gdb/tui/tui-stack.c dev/gdb/tui/tui-stack.c
--- src/gdb/tui/tui-stack.c	2008-01-01 23:53:22.000000000 +0100
+++ dev/gdb/tui/tui-stack.c	2008-05-21 07:03:42.000000000 +0200
@@ -102,7 +102,7 @@ tui_make_status_line (struct tui_locator
 
   /* Translate PC address.  */
   pc_out = tui_sfileopen (128);
-  deprecated_print_address_numeric (loc->addr, 1, pc_out);
+  fputs_filtered (paddress (loc->addr), pc_out);
   pc_buf = tui_file_get_strbuf (pc_out);
   pc_width = strlen (pc_buf);
   

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

* Re: [patch]: Get rid of deprecated_print_address_numeric
  2008-05-21 15:52   ` Markus Deuling
@ 2008-05-21 18:36     ` Ulrich Weigand
  2008-05-23 16:46       ` Markus Deuling
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2008-05-21 18:36 UTC (permalink / raw)
  To: Markus Deuling; +Cc: GDB Patches

Markus Deuling wrote:

> thanks. I reworked that patch now and also integrated the other occurences of paddress
> where suitable. Re-tested on x86_64 without regression.
> 
> Is this Ok ?

This is OK (with ChangeLog, of course).

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: [patch]: Get rid of deprecated_print_address_numeric
  2008-05-21 18:36     ` Ulrich Weigand
@ 2008-05-23 16:46       ` Markus Deuling
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Deuling @ 2008-05-23 16:46 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: GDB Patches

Hi Uli,

Ulrich Weigand schrieb:
> Markus Deuling wrote:
> 
>> thanks. I reworked that patch now and also integrated the other occurences of paddress
>> where suitable. Re-tested on x86_64 without regression.
>>
>> Is this Ok ?
> 
> This is OK (with ChangeLog, of course).
> 
> Thanks,
> Ulrich
> 

thanks. Committed this one as well.


-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


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

end of thread, other threads:[~2008-05-23  4:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-19 15:18 [patch]: Get rid of deprecated_print_address_numeric Markus Deuling
2008-05-20 17:40 ` Ulrich Weigand
2008-05-21 15:52   ` Markus Deuling
2008-05-21 18:36     ` Ulrich Weigand
2008-05-23 16:46       ` Markus Deuling

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