From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9120 invoked by alias); 10 Sep 2006 17:20:49 -0000 Received: (qmail 9111 invoked by uid 22791); 10 Sep 2006 17:20:49 -0000 X-Spam-Check-By: sourceware.org Received: from ip-160-218-140-228.eurotel.cz (HELO host0.dyn.jankratochvil.net) (160.218.140.228) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 10 Sep 2006 17:20:43 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.13.8/8.13.8) with ESMTP id k8AHKcOP003946 for ; Sun, 10 Sep 2006 19:20:38 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.13.8/8.13.8/Submit) id k8AHKbsu003945 for gdb-patches@sourceware.org; Sun, 10 Sep 2006 19:20:37 +0200 Date: Sun, 10 Sep 2006 17:20:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] printf "%p" gdb internal error fix Message-ID: <20060910172037.GA3886@host0.dyn.jankratochvil.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="u3/rZRmxL6MmkK24" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00046.txt.bz2 --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 469 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 . 2006-09-10 Jan Kratochvil * printcmd.c (printf_command): Handle forgotten "%p". 2006-09-10 Jan Kratochvil * gdb.base/display.exp: New test of `printf' "%p" formatting. Regards, Jan --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-printf-p.patch" Content-length: 1376 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 # --u3/rZRmxL6MmkK24--