Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] printf "%p" gdb internal error fix
@ 2006-09-10 17:20 Jan Kratochvil
  2006-09-10 19:31 ` Mark Kettenis
  0 siblings, 1 reply; 17+ messages in thread
From: Jan Kratochvil @ 2006-09-10 17:20 UTC (permalink / raw)
  To: gdb-patches

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

Hi,

(gdb) printf "%p\n", (void *) 7
internal error in printf_command

Before 6.5 and after patching the regression:
	(gdb) printf "%p\n", (void *) 7
	0x7

Bugreport by the courtesy of Akira TAGOH <tagoh(at)redhat.com>.

2006-09-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
	* printcmd.c (printf_command): Handle forgotten "%p".

2006-09-10  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.base/display.exp: New test of `printf' "%p" formatting.



Regards,
Jan

[-- Attachment #2: gdb-printf-p.patch --]
[-- Type: text/plain, Size: 1376 bytes --]

Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.98
diff -u -p -r1.98 printcmd.c
--- printcmd.c	17 Jul 2006 22:15:55 -0000	1.98
+++ printcmd.c	10 Sep 2006 17:14:48 -0000
@@ -2077,6 +2077,12 @@ printf_command (char *arg, int from_tty)
 	      printf_filtered (current_substring, val);
 	      break;
 	    }
+	  case ptr_arg:
+	    {
+	      void *val = (void *) value_as_long (val_args[i]);
+	      printf_filtered (current_substring, val);
+	      break;
+	    }
 	  default:
 	    internal_error (__FILE__, __LINE__,
 			    _("failed internal consitency check"));
Index: testsuite/gdb.base/display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/display.exp,v
retrieving revision 1.8
diff -u -p -r1.8 display.exp
--- testsuite/gdb.base/display.exp	10 Aug 2006 05:27:20 -0000	1.8
+++ testsuite/gdb.base/display.exp	10 Sep 2006 17:14:48 -0000
@@ -179,6 +179,8 @@ gdb_test "printf \"\\\\!\\a\\f\\r\\t\\v\
 gdb_test "printf \"\"" ".*" "re-set term"
 gdb_test "printf \"\\w\"" ".*Unrecognized escape character.*"
 gdb_test "printf \"%d\" j" ".*Invalid argument syntax.*"
+# 0 or hex vs. dec printing may be platform dependent:
+gdb_test "printf \"<%p>\\n\", (void *)7" ".*7>.*"
 
 # play with "print", too
 #

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

end of thread, other threads:[~2007-09-15 22:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-10 17:20 [patch] printf "%p" gdb internal error fix Jan Kratochvil
2006-09-10 19:31 ` Mark Kettenis
2006-09-10 22:00   ` Daniel Jacobowitz
2007-09-04 14:19   ` Daniel Jacobowitz
2007-09-04 20:43     ` Eli Zaretskii
2007-09-04 20:53       ` Daniel Jacobowitz
2007-09-15  9:00         ` Eli Zaretskii
2007-09-15 13:52           ` Daniel Jacobowitz
2007-09-15 14:55             ` Andreas Schwab
2007-09-15 15:16               ` Eli Zaretskii
2007-09-15 15:18             ` Eli Zaretskii
2007-09-15 16:12               ` Daniel Jacobowitz
2007-09-15 18:12                 ` Eli Zaretskii
2007-09-15 18:40                   ` Daniel Jacobowitz
2007-09-15 21:59                     ` Eli Zaretskii
2007-09-15 22:17                       ` Daniel Jacobowitz
2007-09-15 16:21               ` Joseph S. Myers

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