This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/23077] New: Ptrace error: "Couldn't get registers: Device busy" on FreeBSD


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

            Bug ID: 23077
           Summary: Ptrace error: "Couldn't get registers: Device busy" on
                    FreeBSD
           Product: gdb
           Version: 8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: rajendra.sy at gmail dot com
  Target Milestone: ---

GDB tries to read registers before PT_LWPINFO info fetch on freebsd platform.

Here is the log
$ /usr/local/bin/gdb
GNU gdb (GDB) 8.1 [GDB v8.1 for FreeBSD]
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd10.3".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) attach 3842
Attaching to process 3842
Couldn't get registers: Device busy.
(gdb) Reading symbols from
/.amd/svl-engdatahome5-003cf1/vol/home5_003cf1/homes5/syrajendra/Rajendra/projects/compiler/test/lldb/test-prgms/step/bin/test-infinite-fbsd-amd64...done.
Reading symbols from /lib/libm.so.5...(no debugging symbols found)...done.
Reading symbols from /lib/libthr.so.3...(no debugging symbols found)...done.
Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done.
Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols
found)...done.
[Switching to LWP 101369 of process 3842]
0x0000000800d48b9a in _nanosleep () from /lib/libc.so.7

My analysis:
In gdb/top.c after every command is executed there is function call
"check_frame_language_change" which tries to read registers of inferior.
But on freebsd platform when the code flow reaches this location the
ptrace(PT_LWPINFO) is not been called hence ptid_t.lwp() returns zero.

I think we should skip this check for "attach <pid>" command?

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]