public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/29155] New: After disabling "detach-on-fork" , syscalls are not catched in both parent and child
@ 2022-05-18 11:12 theojehl76 at gmail dot com
  2024-05-03 15:41 ` [Bug breakpoints/29155] " tromey at sourceware dot org
  2024-05-04  4:22 ` sam at gentoo dot org
  0 siblings, 2 replies; 3+ messages in thread
From: theojehl76 at gmail dot com @ 2022-05-18 11:12 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29155
           Summary: After disabling "detach-on-fork" , syscalls are not
                    catched in both parent and child
           Product: gdb
           Version: 12.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: theojehl76 at gmail dot com
  Target Milestone: ---

When "detach-on-fork" is set to off, GDB is not able to catch syscalls anymore,
this behavior started from GDB 10, GDB 9.2 is still able to track syscalls with
"detach-on-fork" disabled

example:

#include<stdio.h>
#include<stdlib.h>
#include<sys/mman.h>
#include<unistd.h>
#include<sys/ptrace.h>
int main(){
        pid_t pid = fork();

        if(pid == 0){
                write(1, "child", 5);
                while(1);
        }
        if(pid > 0){
                write(1, "parent", 6);
        }
        return 0;
}


Expected behavior:

(gdb) set detach-on-fork off
(gdb) catch syscall write
Catchpoint 1 (syscall 'write' [64])
(gdb) r
Starting program
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 2167]
child
Catchpoint 1 (call to syscall write), 0x0000fffff7ee7c50 in __GI___libc_write
(fd=1, buf=0xaaaaaaaa0858, nbytes=6) at ../sysdeps/unix/sysv/linux/write.c:26
26      ../sysdeps/unix/sysv/linux/write.c: No such file or directory.



Actual behavior:

(gdb) set detach-on-fork off
(gdb) catch syscall write
Catchpoint 1 (syscall 'write' [64])
(gdb) r
Starting program
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
[New inferior 2 (process 2184)]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
parent[Inferior 1 (process 2182) exited normally]


This was tested on Linux running on X86_64 and AARCH64 with the same results

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

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

* [Bug breakpoints/29155] After disabling "detach-on-fork" , syscalls are not catched in both parent and child
  2022-05-18 11:12 [Bug breakpoints/29155] New: After disabling "detach-on-fork" , syscalls are not catched in both parent and child theojehl76 at gmail dot com
@ 2024-05-03 15:41 ` tromey at sourceware dot org
  2024-05-04  4:22 ` sam at gentoo dot org
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2024-05-03 15:41 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-05-03
                 CC|                            |tromey at sourceware dot org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
We were discussing this on irc.
For me this sometimes works in the parent process, but
also sometimes fails.

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

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

* [Bug breakpoints/29155] After disabling "detach-on-fork" , syscalls are not catched in both parent and child
  2022-05-18 11:12 [Bug breakpoints/29155] New: After disabling "detach-on-fork" , syscalls are not catched in both parent and child theojehl76 at gmail dot com
  2024-05-03 15:41 ` [Bug breakpoints/29155] " tromey at sourceware dot org
@ 2024-05-04  4:22 ` sam at gentoo dot org
  1 sibling, 0 replies; 3+ messages in thread
From: sam at gentoo dot org @ 2024-05-04  4:22 UTC (permalink / raw)
  To: gdb-prs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

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

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

end of thread, other threads:[~2024-05-04  4:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 11:12 [Bug breakpoints/29155] New: After disabling "detach-on-fork" , syscalls are not catched in both parent and child theojehl76 at gmail dot com
2024-05-03 15:41 ` [Bug breakpoints/29155] " tromey at sourceware dot org
2024-05-04  4:22 ` sam at gentoo dot org

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).