public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/16494] New: Call-style dprintf does not work with disconnected-dprintf
@ 2014-01-22 11:51 marc.khouzam at ericsson dot com
  2014-03-04 16:32 ` [Bug breakpoints/16494] " teawater at gmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: marc.khouzam at ericsson dot com @ 2014-01-22 11:51 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 16494
           Summary: Call-style dprintf does not work with
                    disconnected-dprintf
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: marc.khouzam at ericsson dot com

The main use case for any dprintf for us is that they should print to the same
output location as a compiled printf.  This can be achieved by using
'dprintf-style call'; that style seems to work properly both for a local GDB
session and for gdbserver.  However, for disconnected-dprintf, I believe we
must use the 'dprintf-style agent'; the problem is that the dprintf-agent
prints to the gdbserver console, instead of the inferior output stream.

Right now, when I use the 'call-style' with disconnected dprintf, the inferior
dies with "Trace/BPT trap" or gets a segmentation fault, when GDB disconnects.

To reproduce:
1- in one shell, start gdbserver like this:
      gdbserver.7.7 --multi :9999

2- in another shell start a long running process, e.g.,
     ~/testing/loopfirst

3- in a third shell, run the gdb session:
> gdb.7.7 ~/testing/loopfirst
GNU gdb (GDB) 7.7.50.20140110-cvs
(gdb) l
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;
(gdb)  set target-async on
(gdb) set pagination off
(gdb) set non-stop on
(gdb) set disconnected-dprintf on
(gdb) set dprintf-style call
(gdb)  tar ext :9999
Remote debugging using :9999
(gdb) attach 4955&
Attaching to program: /home/lmckhou/testing/loopfirst, process 4955
[New Thread 4955.4955]
(gdb) Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...(no debugging
symbols found)...done.
Loaded symbols for /lib/x86_64-linux-gnu/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols
found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
dprintf 8,"hello\n"
Dprintf 1 at 0x400570: file loopfirst.cc, line 8.

====> at this time in shell #2, I see "hello" being printed along with the rest
of the inferior output.  This is great.

(gdb) q
A debugging session is active.

        Inferior 1 [process 4955] will be detached.

Quit anyway? (y or n) y
Detaching from program: /home/lmckhou/testing/loopfirst, process 4955

===> At this point, in shell #2 I get a segmentation fault in loopfirst.

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


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

* [Bug breakpoints/16494] Call-style dprintf does not work with disconnected-dprintf
  2014-01-22 11:51 [Bug breakpoints/16494] New: Call-style dprintf does not work with disconnected-dprintf marc.khouzam at ericsson dot com
@ 2014-03-04 16:32 ` teawater at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: teawater at gmail dot com @ 2014-03-04 16:32 UTC (permalink / raw)
  To: gdb-prs

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

teawater <teawater at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #1 from teawater <teawater at gmail dot com> ---
Patches for this issue:
https://sourceware.org/ml/gdb-patches/2014-03/msg00072.html
https://sourceware.org/ml/gdb-patches/2014-03/msg00073.html
https://sourceware.org/ml/gdb-patches/2014-03/msg00074.html
https://sourceware.org/ml/gdb-patches/2014-03/msg00075.html
https://sourceware.org/ml/gdb-patches/2014-03/msg00076.html

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


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

end of thread, other threads:[~2014-03-04 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-22 11:51 [Bug breakpoints/16494] New: Call-style dprintf does not work with disconnected-dprintf marc.khouzam at ericsson dot com
2014-03-04 16:32 ` [Bug breakpoints/16494] " teawater at gmail 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).