public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/15185] New: Dprintf should parse its string for validity right away
@ 2013-02-24 13:44 marc.khouzam at ericsson dot com
  2013-07-07  6:32 ` [Bug breakpoints/15185] " teawater at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-02-24 13:44 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15185

             Bug #: 15185
           Summary: Dprintf should parse its string for validity right
                    away
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: marc.khouzam@ericsson.com
    Classification: Unclassified


No evaluation of the dprintf string is done by GDB.  This can be quite poor for
the user since it is only at run-time that an error will be given.

I think that a checking the expression early would much more user-friendly.


> gdb.7.6 ~/loopfirst
GNU gdb (GDB) 7.5.50.20130223-cvs
(gdb) dprintf 8,"hello$d",i
Dprintf 1 at 0x804855f: file loopfirst.cc, line 8.
(gdb) r
Starting program: /home/lmckhou/loopfirst 
warning: Cannot call inferior functions, you have broken Linux kernel i386 NX
(non-executable pages) support!
hellofriend
Wrong number of arguments for specified format-string
(gdb) bt
#0  main () at loopfirst.cc:8

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug breakpoints/15185] Dprintf should parse its string for validity right away
  2013-02-24 13:44 [Bug breakpoints/15185] New: Dprintf should parse its string for validity right away marc.khouzam at ericsson dot com
@ 2013-07-07  6:32 ` teawater at gmail dot com
  2013-07-08 15:47 ` marc.khouzam at ericsson dot com
  2015-02-06  7:51 ` marc.khouzam at ericsson dot com
  2 siblings, 0 replies; 4+ messages in thread
From: teawater at gmail dot com @ 2013-07-07  6:32 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15185

teawater <teawater at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |teawater at gmail dot com

--- Comment #1 from teawater <teawater at gmail dot com> ---
Could you post the src of loopfirst?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug breakpoints/15185] Dprintf should parse its string for validity right away
  2013-02-24 13:44 [Bug breakpoints/15185] New: Dprintf should parse its string for validity right away marc.khouzam at ericsson dot com
  2013-07-07  6:32 ` [Bug breakpoints/15185] " teawater at gmail dot com
@ 2013-07-08 15:47 ` marc.khouzam at ericsson dot com
  2015-02-06  7:51 ` marc.khouzam at ericsson dot com
  2 siblings, 0 replies; 4+ messages in thread
From: marc.khouzam at ericsson dot com @ 2013-07-08 15:47 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15185

--- Comment #2 from Marc Khouzam <marc.khouzam at ericsson dot com> ---
GNU gdb (GDB) 7.6.50.20130627-cvs
Reading symbols from /home/lmckhou/loopfirst...done.
(gdb) l
warning: Source file is more recent than executable.
1       #include <unistd.h>
2       #include <stdio.h>
3
4       int main() {
5           int max = 900;
6           for (int i=0;i<max;i++) {
7               printf("i is %d\n",i);
8               sleep(1);
9           }
10          return 0;
11      }

(gdb) dprintf 7,"hello$d",i    <------------ Notice teh $d instead of %d

Dprintf 1 at 0x40055c: file loopfirst.cc, line 7.
(gdb) info b
Num     Type           Disp Enb Address            What
1       dprintf        keep y   0x000000000040055c in main() at loopfirst.cc:7
        printf "hello$d",i
(gdb) r
Starting program: /home/lmckhou/loopfirst 
Wrong number of arguments for specified format-string

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug breakpoints/15185] Dprintf should parse its string for validity right away
  2013-02-24 13:44 [Bug breakpoints/15185] New: Dprintf should parse its string for validity right away marc.khouzam at ericsson dot com
  2013-07-07  6:32 ` [Bug breakpoints/15185] " teawater at gmail dot com
  2013-07-08 15:47 ` marc.khouzam at ericsson dot com
@ 2015-02-06  7:51 ` marc.khouzam at ericsson dot com
  2 siblings, 0 replies; 4+ messages in thread
From: marc.khouzam at ericsson dot com @ 2015-02-06  7:51 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15185

--- Comment #3 from Marc Khouzam <marc.khouzam at ericsson dot com> ---
Although it may seem like GDB cannot parse the string in advance because it
only knows the validity of a string at runtime, gdb seems to be able to do some
checking when we set conditions.  I was hoping we could do something similar?  

(gdb) b 9 if ii<0
No symbol "ii" in current context.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2015-02-05 18:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-24 13:44 [Bug breakpoints/15185] New: Dprintf should parse its string for validity right away marc.khouzam at ericsson dot com
2013-07-07  6:32 ` [Bug breakpoints/15185] " teawater at gmail dot com
2013-07-08 15:47 ` marc.khouzam at ericsson dot com
2015-02-06  7:51 ` marc.khouzam at ericsson dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).