Age | Commit message (Collapse) | Author | Files | Lines |
|
This commit makes use of the new script to regenerate the Linux
syscall group info against strace git hash
e88e5e9ae6da68f22d15f9be3193b1412ac9aa02.
Like so:
$ cd gdb/syscalls/
$ ./update-linux-defaults.sh ~/strace.git/
Generating linux-defaults.xml.in
$ make
for f in aarch64-linux.xml amd64-linux.xml arm-linux.xml bfin-linux.xml \
i386-linux.xml mips-n32-linux.xml mips-n64-linux.xml \
mips-o32-linux.xml ppc64-linux.xml ppc-linux.xml s390-linux.xml \
s390x-linux.xml sparc64-linux.xml sparc-linux.xml; do \
xsltproc --output $f apply-defaults.xsl $f.in; \
done
The result is that a lot more syscalls end up assigned to groups.
Some lose their group info, but that just mirrors what strace does.
The gdb/syscalls/linux-defaults.xml.in file shows a large diff because
the new version is ASCII sorted, while the current version was
somewhat (but not consistently) sorted by "family" of syscalls.
If I sort the old file and diff against the new, the difference is
like this:
<syscall name="accept4" groups="network"/>
<syscall name="accept" groups="network"/>
<syscall name="access" groups="file"/>
<syscall name="acct" groups="file"/>
- <syscall name="arch_prctl" groups="process"/>
<syscall name="bind" groups="network"/>
+ <syscall name="bpf" groups="descriptor"/>
<syscall name="break" groups="memory"/>
<syscall name="brk" groups="memory"/>
+ <syscall name="bsd43_fstatfs" groups="descriptor"/>
+ <syscall name="bsd43_fstat" groups="descriptor"/>
+ <syscall name="bsd43_killpg" groups="process"/>
+ <syscall name="bsd43_kill" groups="process"/>
+ <syscall name="bsd43_lstat" groups="file"/>
+ <syscall name="bsd43_madvise" groups="memory"/>
+ <syscall name="bsd43_mincore" groups="memory"/>
+ <syscall name="bsd43_mmap" groups="descriptor,memory"/>
+ <syscall name="bsd43_mprotect" groups="memory"/>
+ <syscall name="bsd43_mremap" groups="memory"/>
+ <syscall name="bsd43_munmap" groups="memory"/>
+ <syscall name="bsd43_oldfstat" groups="descriptor"/>
+ <syscall name="bsd43_oldstat" groups="file"/>
+ <syscall name="bsd43_quotactl" groups="file"/>
+ <syscall name="bsd43_sbreak" groups="memory"/>
+ <syscall name="bsd43_sbrk" groups="memory"/>
+ <syscall name="bsd43_statfs" groups="file"/>
+ <syscall name="bsd43_stat" groups="file"/>
+ <syscall name="cacheflush" groups="memory"/>
<syscall name="chdir" groups="file"/>
<syscall name="chmod" groups="file"/>
<syscall name="chown32" groups="file"/>
<syscall name="chown" groups="file"/>
<syscall name="chroot" groups="file"/>
+ <syscall name="clone2" groups="process"/>
+ <syscall name="clone3" groups="process"/>
<syscall name="clone" groups="process"/>
<syscall name="close" groups="descriptor"/>
<syscall name="connect" groups="network"/>
+ <syscall name="copy_file_range" groups="descriptor"/>
<syscall name="creat" groups="descriptor,file"/>
<syscall name="dup2" groups="descriptor"/>
<syscall name="dup3" groups="descriptor"/>
@@ -28,14 +52,17 @@
<syscall name="epoll_create1" groups="descriptor"/>
<syscall name="epoll_create" groups="descriptor"/>
<syscall name="epoll_ctl" groups="descriptor"/>
+ <syscall name="epoll_pwait2" groups="descriptor"/>
<syscall name="epoll_pwait" groups="descriptor"/>
<syscall name="epoll_wait" groups="descriptor"/>
<syscall name="eventfd2" groups="descriptor"/>
<syscall name="eventfd" groups="descriptor"/>
+ <syscall name="execveat" groups="descriptor,file,process"/>
<syscall name="execve" groups="file,process"/>
<syscall name="execv" groups="file,process"/>
<syscall name="exit_group" groups="process"/>
<syscall name="exit" groups="process"/>
+ <syscall name="faccessat2" groups="descriptor,file"/>
<syscall name="faccessat" groups="descriptor,file"/>
<syscall name="fadvise64_64" groups="descriptor"/>
<syscall name="fadvise64" groups="descriptor"/>
@@ -57,7 +84,11 @@
<syscall name="flock" groups="descriptor"/>
<syscall name="fork" groups="process"/>
<syscall name="fremovexattr" groups="descriptor"/>
+ <syscall name="fsconfig" groups="descriptor,file"/>
<syscall name="fsetxattr" groups="descriptor"/>
+ <syscall name="fsmount" groups="descriptor"/>
+ <syscall name="fsopen" groups="descriptor"/>
+ <syscall name="fspick" groups="descriptor,file"/>
<syscall name="fstat64" groups="descriptor"/>
<syscall name="fstatat64" groups="descriptor,file"/>
<syscall name="fstatfs64" groups="descriptor"/>
@@ -72,16 +103,26 @@
<syscall name="getdents" groups="descriptor"/>
<syscall name="get_mempolicy" groups="memory"/>
<syscall name="getpeername" groups="network"/>
+ <syscall name="getpmsg" groups="network"/>
<syscall name="getsockname" groups="network"/>
<syscall name="getsockopt" groups="network"/>
<syscall name="getxattr" groups="file"/>
- <syscall name="inotify_add_watch" groups="descriptor"/>
+ <syscall name="inotify_add_watch" groups="descriptor,file"/>
<syscall name="inotify_init1" groups="descriptor"/>
<syscall name="inotify_init" groups="descriptor"/>
<syscall name="inotify_rm_watch" groups="descriptor"/>
<syscall name="ioctl" groups="descriptor"/>
+ <syscall name="io_destroy" groups="memory"/>
+ <syscall name="io_setup" groups="memory"/>
+ <syscall name="io_uring_enter" groups="descriptor,signal"/>
+ <syscall name="io_uring_register" groups="descriptor,memory"/>
+ <syscall name="io_uring_setup" groups="descriptor"/>
<syscall name="ipc" groups="ipc"/>
- <syscall name="kill" groups="signal"/>
+ <syscall name="kexec_file_load" groups="descriptor"/>
+ <syscall name="kill" groups="signal,process"/>
+ <syscall name="landlock_add_rule" groups="descriptor"/>
+ <syscall name="landlock_create_ruleset" groups="descriptor"/>
+ <syscall name="landlock_restrict_self" groups="descriptor"/>
<syscall name="lchown32" groups="file"/>
<syscall name="lchown" groups="file"/>
<syscall name="lgetxattr" groups="file"/>
@@ -98,19 +139,31 @@
<syscall name="lstat" groups="file"/>
<syscall name="madvise" groups="memory"/>
<syscall name="mbind" groups="memory"/>
+ <syscall name="memfd_create" groups="descriptor"/>
+ <syscall name="memfd_secret" groups="descriptor"/>
<syscall name="migrate_pages" groups="memory"/>
<syscall name="mincore" groups="memory"/>
<syscall name="mkdirat" groups="descriptor,file"/>
<syscall name="mkdir" groups="file"/>
<syscall name="mknodat" groups="descriptor,file"/>
<syscall name="mknod" groups="file"/>
+ <syscall name="mlock2" groups="memory"/>
<syscall name="mlockall" groups="memory"/>
<syscall name="mlock" groups="memory"/>
<syscall name="mmap2" groups="descriptor,memory"/>
<syscall name="mmap" groups="descriptor,memory"/>
+ <syscall name="mount_setattr" groups="descriptor,file"/>
<syscall name="mount" groups="file"/>
+ <syscall name="move_mount" groups="descriptor,file"/>
<syscall name="move_pages" groups="memory"/>
<syscall name="mprotect" groups="memory"/>
+ <syscall name="mq_getsetattr" groups="descriptor"/>
+ <syscall name="mq_notify" groups="descriptor"/>
+ <syscall name="mq_open" groups="descriptor"/>
+ <syscall name="mq_timedreceive" groups="descriptor"/>
+ <syscall name="mq_timedreceive_time64" groups="descriptor"/>
+ <syscall name="mq_timedsend" groups="descriptor"/>
+ <syscall name="mq_timedsend_time64" groups="descriptor"/>
<syscall name="mremap" groups="memory"/>
<syscall name="msgctl" groups="ipc"/>
<syscall name="msgget" groups="ipc"/>
@@ -126,45 +179,98 @@
<syscall name="oldfstat" groups="descriptor"/>
<syscall name="oldlstat" groups="file"/>
<syscall name="oldstat" groups="file"/>
+ <syscall name="oldumount" groups="file"/>
+ <syscall name="openat2" groups="descriptor,file"/>
<syscall name="openat" groups="descriptor,file"/>
<syscall name="open_by_handle_at" groups="descriptor"/>
<syscall name="open" groups="descriptor,file"/>
+ <syscall name="open_tree" groups="descriptor,file"/>
+ <syscall name="osf_fstatfs64" groups="descriptor"/>
+ <syscall name="osf_fstatfs" groups="descriptor"/>
+ <syscall name="osf_fstat" groups="descriptor"/>
+ <syscall name="osf_lstat" groups="file"/>
+ <syscall name="osf_mincore" groups="memory"/>
+ <syscall name="osf_mremap" groups="memory"/>
+ <syscall name="osf_old_fstat" groups="descriptor"/>
+ <syscall name="osf_old_killpg" groups="process"/>
+ <syscall name="osf_old_lstat" groups="file"/>
+ <syscall name="osf_old_stat" groups="file"/>
+ <syscall name="osf_sbrk" groups="memory"/>
+ <syscall name="osf_select" groups="descriptor"/>
+ <syscall name="osf_shmat" groups="ipc,memory"/>
+ <syscall name="osf_sigprocmask" groups="signal"/>
+ <syscall name="osf_statfs64" groups="file"/>
+ <syscall name="osf_statfs" groups="file"/>
+ <syscall name="osf_stat" groups="file"/>
+ <syscall name="osf_utimes" groups="file"/>
+ <syscall name="osf_wait4" groups="process"/>
<syscall name="pause" groups="signal"/>
<syscall name="perf_event_open" groups="descriptor"/>
+ <syscall name="pidfd_getfd" groups="descriptor"/>
+ <syscall name="pidfd_open" groups="descriptor"/>
+ <syscall name="pidfd_send_signal" groups="descriptor,signal,process"/>
<syscall name="pipe2" groups="descriptor"/>
<syscall name="pipe" groups="descriptor"/>
<syscall name="pivot_root" groups="file"/>
+ <syscall name="pkey_mprotect" groups="memory"/>
<syscall name="poll" groups="descriptor"/>
+ <syscall name="posix_fstatfs" groups="descriptor"/>
+ <syscall name="posix_fstat" groups="descriptor"/>
+ <syscall name="posix_kill" groups="process"/>
+ <syscall name="posix_lstat" groups="file"/>
+ <syscall name="posix_madvise" groups="memory"/>
+ <syscall name="posix_mmap" groups="descriptor,memory"/>
+ <syscall name="posix_munmap" groups="memory"/>
+ <syscall name="posix_sbreak" groups="memory"/>
+ <syscall name="posix_SGI_madvise" groups="memory"/>
+ <syscall name="posix_SGI_mmap" groups="descriptor,memory"/>
+ <syscall name="posix_SGI_mprotect" groups="memory"/>
+ <syscall name="posix_SGI_msync" groups="memory"/>
+ <syscall name="posix_SGI_munmap" groups="memory"/>
+ <syscall name="posix_statfs" groups="file"/>
+ <syscall name="posix_stat" groups="file"/>
<syscall name="ppoll" groups="descriptor"/>
+ <syscall name="ppoll_time64" groups="descriptor"/>
<syscall name="pread64" groups="descriptor"/>
<syscall name="pread" groups="descriptor"/>
+ <syscall name="preadv2" groups="descriptor"/>
<syscall name="preadv" groups="descriptor"/>
+ <syscall name="process_madvise" groups="descriptor"/>
+ <syscall name="process_mrelease" groups="descriptor"/>
<syscall name="pselect6" groups="descriptor"/>
+ <syscall name="pselect6_time64" groups="descriptor"/>
+ <syscall name="putpmsg" groups="network"/>
<syscall name="pwrite64" groups="descriptor"/>
<syscall name="pwrite" groups="descriptor"/>
+ <syscall name="pwritev2" groups="descriptor"/>
<syscall name="pwritev" groups="descriptor"/>
+ <syscall name="quotactl_fd" groups="descriptor"/>
<syscall name="quotactl" groups="file"/>
<syscall name="readahead" groups="descriptor"/>
<syscall name="readdir" groups="descriptor"/>
- <syscall name="read" groups="descriptor"/>
<syscall name="readlinkat" groups="descriptor,file"/>
<syscall name="readlink" groups="file"/>
+ <syscall name="read" groups="descriptor"/>
<syscall name="readv" groups="descriptor"/>
<syscall name="recvfrom" groups="network"/>
- <syscall name="recv" groups="network"/>
+ <syscall name="recvmmsg_time64" groups="network"/>
<syscall name="recvmmsg" groups="network"/>
<syscall name="recvmsg" groups="network"/>
+ <syscall name="recv" groups="network"/>
<syscall name="remap_file_pages" groups="memory"/>
<syscall name="removexattr" groups="file"/>
+ <syscall name="renameat2" groups="descriptor,file"/>
<syscall name="renameat" groups="descriptor,file"/>
<syscall name="rename" groups="file"/>
+ <syscall name="riscv_flush_icache" groups="memory"/>
<syscall name="rmdir" groups="file"/>
<syscall name="rt_sigaction" groups="signal"/>
<syscall name="rt_sigpending" groups="signal"/>
<syscall name="rt_sigprocmask" groups="signal"/>
- <syscall name="rt_sigqueueinfo" groups="signal"/>
+ <syscall name="rt_sigqueueinfo" groups="signal,process"/>
<syscall name="rt_sigreturn" groups="signal"/>
<syscall name="rt_sigsuspend" groups="signal"/>
+ <syscall name="rt_sigtimedwait_time64" groups="signal"/>
<syscall name="rt_sigtimedwait" groups="signal"/>
<syscall name="rt_tgsigqueueinfo" groups="process,signal"/>
<syscall name="select" groups="descriptor"/>
@@ -172,12 +278,14 @@
<syscall name="semget" groups="ipc"/>
<syscall name="semop" groups="ipc"/>
<syscall name="semtimedop" groups="ipc"/>
+ <syscall name="semtimedop_time64" groups="ipc"/>
<syscall name="sendfile64" groups="descriptor,network"/>
<syscall name="sendfile" groups="descriptor,network"/>
- <syscall name="send" groups="network"/>
<syscall name="sendmmsg" groups="network"/>
<syscall name="sendmsg" groups="network"/>
+ <syscall name="send" groups="network"/>
<syscall name="sendto" groups="network"/>
+ <syscall name="set_mempolicy_home_node" groups="memory"/>
<syscall name="set_mempolicy" groups="memory"/>
<syscall name="setns" groups="descriptor"/>
<syscall name="setsockopt" groups="network"/>
@@ -198,38 +306,78 @@
<syscall name="sigreturn" groups="signal"/>
<syscall name="sigsuspend" groups="signal"/>
<syscall name="socketcall" groups="descriptor"/>
- <syscall name="socket" groups="network"/>
<syscall name="socketpair" groups="network"/>
+ <syscall name="socket" groups="network"/>
<syscall name="splice" groups="descriptor"/>
<syscall name="ssetmask" groups="signal"/>
<syscall name="stat64" groups="file"/>
<syscall name="statfs64" groups="file"/>
<syscall name="statfs" groups="file"/>
<syscall name="stat" groups="file"/>
+ <syscall name="statx" groups="descriptor,file"/>
+ <syscall name="svr4_fstatfs" groups="descriptor"/>
+ <syscall name="svr4_fstat" groups="descriptor"/>
+ <syscall name="svr4_fstatvfs" groups="descriptor"/>
+ <syscall name="svr4_fxstat" groups="descriptor"/>
+ <syscall name="svr4_kill" groups="process"/>
+ <syscall name="svr4_lstat" groups="file"/>
+ <syscall name="svr4_lxstat" groups="file"/>
+ <syscall name="svr4_mincore" groups="memory"/>
+ <syscall name="svr4_mmap" groups="descriptor,memory"/>
+ <syscall name="svr4_mprotect" groups="memory"/>
+ <syscall name="svr4_munmap" groups="memory"/>
+ <syscall name="svr4_sbreak" groups="memory"/>
+ <syscall name="svr4_statfs" groups="file"/>
+ <syscall name="svr4_stat" groups="file"/>
+ <syscall name="svr4_statvfs" groups="file"/>
+ <syscall name="svr4_xstat" groups="file"/>
<syscall name="swapoff" groups="file"/>
<syscall name="swapon" groups="file"/>
<syscall name="symlinkat" groups="descriptor,file"/>
<syscall name="symlink" groups="file"/>
+ <syscall name="sync_file_range2" groups="descriptor"/>
<syscall name="sync_file_range" groups="descriptor"/>
<syscall name="syncfs" groups="descriptor"/>
+ <syscall name="sysv_brk" groups="memory"/>
+ <syscall name="sysv_fstatfs" groups="descriptor"/>
+ <syscall name="sysv_fstat" groups="descriptor"/>
+ <syscall name="sysv_fstatvfs" groups="descriptor"/>
+ <syscall name="sysv_fxstat" groups="descriptor"/>
+ <syscall name="sysv_kill" groups="process"/>
+ <syscall name="sysv_lstat" groups="file"/>
+ <syscall name="sysv_lxstat" groups="file"/>
+ <syscall name="sysv_madvise" groups="memory"/>
+ <syscall name="sysv_mmap64" groups="descriptor,memory"/>
+ <syscall name="sysv_mmap" groups="descriptor,memory"/>
+ <syscall name="sysv_mprotect" groups="memory"/>
+ <syscall name="sysv_msync" groups="memory"/>
+ <syscall name="sysv_munmap" groups="memory"/>
+ <syscall name="sysv_quotactl" groups="file"/>
+ <syscall name="sysv_statfs" groups="file"/>
+ <syscall name="sysv_stat" groups="file"/>
+ <syscall name="sysv_statvfs" groups="file"/>
+ <syscall name="sysv_xstat" groups="file"/>
<syscall name="tee" groups="descriptor"/>
- <syscall name="tgkill" groups="signal"/>
+ <syscall name="tgkill" groups="signal,process"/>
<syscall name="timerfd_create" groups="descriptor"/>
+ <syscall name="timerfd_gettime64" groups="descriptor"/>
<syscall name="timerfd_gettime" groups="descriptor"/>
- <syscall name="timerfd" groups="descriptor"/>
+ <syscall name="timerfd_settime64" groups="descriptor"/>
<syscall name="timerfd_settime" groups="descriptor"/>
- <syscall name="tkill" groups="signal"/>
+ <syscall name="timerfd" groups="descriptor"/>
+ <syscall name="tkill" groups="signal,process"/>
<syscall name="truncate64" groups="file"/>
<syscall name="truncate" groups="file"/>
<syscall name="umount2" groups="file"/>
<syscall name="umount" groups="file"/>
<syscall name="unlinkat" groups="descriptor,file"/>
<syscall name="unlink" groups="file"/>
- <syscall name="unshare" groups="process"/>
<syscall name="uselib" groups="file"/>
- <syscall name="utime" groups="file"/>
+ <syscall name="userfaultfd" groups="descriptor"/>
<syscall name="utimensat" groups="descriptor,file"/>
+ <syscall name="utimensat_time64" groups="descriptor,file"/>
<syscall name="utimes" groups="file"/>
+ <syscall name="utime" groups="file"/>
<syscall name="vfork" groups="process"/>
<syscall name="vmsplice" groups="descriptor"/>
<syscall name="wait4" groups="process"/>
Change-Id: I679d59d42fb2a914bf7a99e4c558e9696e5adff1
|
|
I noticed that "catch syscall group:process" doesn't catch clone3,
while it does catch clone.
The catch syscall group information is recorded in the
gdb/syscalls/linux-defaults.xml.in file, which says:
<!-- The group field information was based on strace. -->
So I looked at the strace sources, to confirm that clone3 is in fact
recorded in the "process" group there too, and to check what other
syscalls might be missing groups.
After some digging, I found that strace records the group info in C
arrays, with entries like:
...
[ 61] = { 4, TP, SEN(wait4), "wait4" },
[ 62] = { 2, TS|TP, SEN(kill), "kill" },
[ 63] = { 1, 0, SEN(uname), "uname" },
...
You can see the current master's table for Linux x86-64 here:
https://github.com/strace/strace/blob/e88e5e9ae6da68f22d15f9be3193b1412ac9aa02/src/linux/x86_64/syscallent.h
The column with TS|TP above is what defines each syscall's groups. So
I wrote a script that extracts this information and generates
linux-defaults.xml.in.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I679d59d42fb2a914bf7a99e4c558e9696e5adff1
|
|
In C++ it is possible to use an empty enum as a strong typedef. For
example, a user could write:
enum class my_type : unsigned char {};
Now my_type can be used like 'unsigned char' except the compiler will
not allow implicit conversion too and from the native 'unsigned char'
type.
This is used in the standard library for things like std::byte.
Currently, when GDB prints a value of type my_type, it looks like
this:
(gdb) print my_var
$1 = (unknown: 0x4)
Which isn't great. This gets worse when we consider something like:
std::vector<my_type> vec;
When using a pretty-printer, this could look like this:
std::vector of length 2, capacity 2 = {(unknown: 0x2), (unknown: 0x4)}
Clearly not great. This is described in PR gdb/30148.
The problem here is in dwarf2/read.c, we assume all enums are flag
enums unless we find an enumerator with a non-flag like value.
Clearly an empty enum contains no non-flag values, so we assume the
enum is a flag enum.
I propose adding an extra check here; that is, an empty enum should
never be a flag enum.
With this the above cases look more like:
(gdb) print my_var
$1 = 4
and:
std::vector of length 2, capacity 2 = {2, 4}
Which look much better.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30148
Reviewed-By: Tom Tromey <tom@tromey.com>
|
|
When looking at some failures of gdb.linespec/cp-completion-aliases.exp,
I noticed that when a completion test will fail, it always fails with a
timeout. This is because most completion tests use gdb_test_multiple
and only add a check for the correct output. This commit adds new
options for both, tab and command completion.
For command completion, the new option will check if the prompt was
printed, and fail in this case. This is enough to know that the test has
failed because the check comes after the PASS path. For tab completion,
we have to check if GDB outputted more than just the input line, because
sometimes GDB would have printed a partial line before finishing with
the correct completion.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Use nullptr instead of NULL and boolify two local variables in
execute_gdb_command.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
The function expand_symtab_containing_pc is unused; remove it.
Tested by rebuilding.
|
|
Replace a couple of uses of xmalloc and alloc with a gdb::byte_vector
local variable instead.
There should be no user visible changes after this commit.
Reviewed-By: Tom Tromey <tom@tromey.com>
|
|
I've long wanted to remove 'struct buffer', and thanks to Simon's
earlier patch, I was finally able to do so. My feeling has been that
gdb already has several decent structures available for growing
strings: std::string of course, but also obstack and even objalloc
from BFD and dyn-string from libiberty. The previous patches in this
series removed all the uses of struct buffer, so this one can remove
the code and the remaining #includes.
|
|
This changes top.c to use std::string rather than struct buffer. Like
the event-top.c change, this is not completely ideal in that it
requires a copy of the string.
|
|
This changes event-top.c to use std::string rather than struct buffer.
This isn't completely ideal, in that it requires a copy of the string
to be made.
|
|
This changes tracefile-tfile.c to use std::string rather than struct
buffer.
|
|
The new DWARF cooked indexer interacts poorly with the DWARF index
cache. In particular, the cache will require gdb to wait for the
cooked index to be finalized. As this happens in the foreground, it
means that users with this setting enabled will see a slowdown.
This patch changes gdb to write the cache entry a worker thread. (As
usual, in the absence of threads, this work is simply done immediately
in the main thread.)
Some care is taken to ensure that this can't crash, and that gdb will
not exit before the task is complete.
To avoid use-after-free problems, the DWARF per-BFD object explicitly
waits for the index cache task to complete.
To avoid gdb exiting early, an exit observer is used to wait for all
such pending tasks.
In normal use, neither of these waits will be very visible. For users
using "-batch" to pre-generate the index, though, it would be.
However I don't think there is much to be done about this, as it was
the status quo ante.
|
|
The DWARF index does not need access to the objfile or per-objfile
objects when writing -- it's entirely based on the objfile-independent
per-BFD data.
This patch implements this idea by changing the entire API to only be
passed the per-BFD object. This simplifies some lifetime reasoning
for the next patch.
This patch removes some code that ensures that the BFD came from a
file. It seems to me that checking for the existence of a build-id is
good enough for the index cache.
|
|
Change-Id: I535b597ab4482378910570d8dd69c090419941eb
|
|
In a recent commit I've added:
...
require {expr [have_compile_flag -fsplit-stack]}
...
but actually the expr bit is unnecessary, and we can just use:
...
require {have_compile_flag -fsplit-stack}
...
Reported-By: Tom Tromey <tom@tromey.com>
|
|
Fix accesses to limited-length values in `contents_copy_raw' and
`contents_copy_raw_bitwise' so that they observe the limit of the
original allocation.
Reported by Simon Marchi as a heap-buffer-overflow AddressSanitizer
issue triggered with gdb.ada/limited-length.exp.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
When we merged the GDB vector register support we did it a bit early,
just eating the risk in the very unlikely case that the vector register
names changed. They didn't, so we can now remove the caveat in the docs
that they might.
|
|
I noticed that the --disable-gdbmi option was broken for almost a year
(since 740b42ceb7c "gdb/python/mi: create MI commands using python").
The problem today is the python/py-cmd.c file. It is included in the
build if Python support is enabled, and it calls into some MI functions
(e.g. insert_mi_cmd_entry). If MI support is disabled, we get some
undefined symbols like:
mold: error: undefined symbol: insert_mi_cmd_entry(std::unique_ptr<mi_command, std::default_delete<mi_command> >)
>>> referenced by py-micmd.c
>>> python/py-micmd.o:(micmdpy_install_command(micmdpy_object*))
The python/py-cmd.c file should be included in the build if both Python
and MI support are enabled. It is not a case we support today, but it
could be done with a bit more configure code. However, I think we
should just remove the --disable-gdbmi option, and just include MI
support unconditionally.
Tom Tromey proposed a while ago to remove this option, but it ended
staying:
https://inbox.sourceware.org/gdb-patches/20180628172132.28843-1-tom@tromey.com/
However, there was no strong opposition to remove it. The argument was
just "bah, it doesn't hurt anybody".
But given today's case, I would rather remove complexity rather than add
some. I couldn't find anybody caring deeply for that option, and it's
not like MI adds any external dependency. It's just a bit more code.
Removing the option will not break anybody using --disable-gdbmi (it can
be found in many build scripts [1]), since we don't flag invalid
configure flags.
So, remove the option from configure.ac, and adjust Makefile.in
accordingly to always include the MI objects in the build.
[1] https://github.com/search?q=%22--disable-gdbmi%22&type=code
Change-Id: Ifcaa8c9fc4abc6fa686ed5fd984598644f745240
Approved-By: Tom Tromey <tom@tromey.com>
|
|
The gdb_assert proc under-quotes the expression that is passed in.
This leads to weird code in a couple of spots that tries to
compensate:
gdb_assert {{$all_regs eq $completed_regs}} ...
The fix is to add a bit of quoting when evaluating the expression.
|
|
Commit 18b4d0736bc5 ("gdb: initial support for ROCm platform (AMDGPU)
debugging") missed adding these header files to the HFILES_NO_SRCDIR
list in the Makefile. Fix that now.
Change-Id: Ifd387096aef3d147b51aefa2037da5bf6373ea64
|
|
Now that Tcl has the {*} operator, we can remove the use of eval from
gdb_breakpoint. Tested on x86-64 Fedora 36.
|
|
According to LoongArch ELF ABI specification [1], support the register
aliases in "info register" command.
Without this patch:
```
(gdb) info reg a0
Invalid register `a0'
```
With this patch:
```
(gdb) info reg a0
a0 0x1 1
```
[1] https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_register_convention
Signed-off-by: Hui Li <lihui@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
|
|
The "info register" command should only display general registers,
but it shows the information of all registers in the current code,
add loongarch_register_reggroup_p() so that we can get the expected
result.
Signed-off-by: Hui Li <lihui@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
|
|
Instead of only testing this on systems that have a SYS_time syscall,
test it everywhere using the time(2) C function, and in addition, run
the tests again using the SYS_time syscall.
The C variant ensures that if some platform uses some syscall we are
not aware of yet, we'll still exercise it, and likely fail, at which
point we should teach GDB about the syscall.
The explicit syscall variant is useful on platforms where the C
function does not call a syscall at all by default, e.g., on some
systems the C time function wraps an implementation provided by the
vDSO.
Approved-By: Tom de Vries <tdevries@suse.de>
Change-Id: Id4b755d76577d02c46b8acbfa249d9c31b587633
|
|
A while back I discovered that this does not issue an error:
(gdb) p $x = (void * ) 57
$3 = (void *) 0x39
(gdb) p $x + 7 = 3
$6 = (void *) 0x3
This patch fixes the bug.
Regression tested on x86-64 Fedora 36.
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19312
|
|
'gdb --configuration' does not mention if GDB was built with curses.
Since b5075fb68d4 (Rename to allow_tui_tests, 2023-01-08) it does show
--enable-tui (or --disable-tui), but one might want to know if GDB was
built with curses independently of the availability of the TUI.
Since configure.ac uses AC_SEARCH_LIBS to check for the curses library,
we do not get an automatically defined HAVE_LIBCURSES symbol in
config.in. We do have symbols defined by AC_CHECK_HEADERS
(HAVE_CURSES_H, etc.) but it would be cumbersome to use those in
print_gdb_configuration because we would have to check for all 6 symbols
corresponding the 6 headers listed. This would also increase the
maintenance burden if support for other variations of curses are added.
Instead, define 'HAVE_LIBCURSES' ourselves by adding an
'action-if-found' argument to AC_SEARCH_LIBS, and use it in
print_gdb_configuration.
While at it, remove the condition on 'ac_cv_search_waddstr' and set
'curses_found' directly in 'action-if-found'.
Change-Id: Id90e3d73990e169cee51bcc3e1d52072cfacd5b8
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
With test-cases gdb.arch/aarch64-mte-core.exp and gdb.arch/aarch64-pauth.exp I
run into compilation errors due to unsupported compilation flags.
Fix this by requiring the compilation flags, such that I have instead:
...
UNSUPPORTED: gdb.arch/aarch64-mte-core.exp: require failed: \
have_compile_flag -march=armv8.5-a+memtag
UNSUPPORTED: gdb.arch/aarch64-pauth.exp: require failed: \
have_compile_flag -mbranch-protection=pac-ret+leaf
...
Tested on aarch64-linux.
|
|
gdb.reverse/step-indirect-call-thunk.exp
On aarch64-linux, I run into:
...
Running gdb.reverse/step-indirect-call-thunk.exp ...
gdb compile failed, gcc: error: unrecognized command line option \
'-mindirect-branch=thunk'; did you mean '-findirect-inlining'?
gcc: error: unrecognized command line option '-mfunction-return=thunk'; \
did you mean '-Wfunction-elimination'?
UNTESTED: gdb.reverse/step-indirect-call-thunk.exp: failed to prepare
...
Fix this by requiring istarget "x86*", similar to what was added in
gdb.base/step-indirect-call-thunk.exp by commit 43127ae5714 ("Fix
gdb.base/step-indirect-call-thunk.exp"), such that we have instead:
...
UNSUPPORTED: gdb.reverse/step-indirect-call-thunk.exp: require failed: \
istarget "x86*
...
Tested on x86_64-linux and aarch64-linux.
|
|
On aarch64-linux, I run into:
...
gdb compile failed, cc1: error: '-fsplit-stack' is not supported by this \
compiler configuration
UNTESTED: gdb.base/morestack.exp: failed to prepare
...
Fix this by requiring -fsplit-stack, such that we have instead:
...
UNSUPPORTED: gdb.base/morestack.exp: require failed: \
expr [have_compile_flag -fsplit-stack]
...
Tested on x86_64-linux and aarch64-linux.
|
|
On aarch64-linux, I run into:
...
Running gdb.reverse/time-reverse.exp ...
gdb compile failed, gdb.reverse/time-reverse.c: In function 'main':
gdb.reverse/time-reverse.c:39:12: error: 'SYS_time' undeclared \
(first use in this function); did you mean 'SYS_times'?
syscall (SYS_time, &time_global);
^~~~~~~~
SYS_times
gdb.reverse/time-reverse.c:39:12: note: each undeclared identifier is \
reported only once for each function it appears in
UNTESTED: gdb.reverse/time-reverse.exp: failed to prepare
...
Fix this by adding a new proc have_syscall, and requiring syscall time, such
that we have instead:
...
UNSUPPORTED: gdb.reverse/time-reverse.exp: require failed: \
expr [have_syscall time]
...
Tested on x86_64-linux and aarch64-linux.
|
|
When running test-case gdb.dap/basic-dap.exp with a gdb without python
support, I run into:
...
builtin_spawn gdb -nw -nx -iex set height 0 -iex set width 0 \
-data-directory data-directory -iex set debug dap-log-file dap.log.1 -q \
-i=dap
>>> {"seq": 1, "type": "request", "command": "initialize"}
Interpreter `dap' unrecognized
ERROR: eof reading json header
...
Fix this by requiring python in the test-case.
Tested on x86_64-linux, both with a gdb without and with python.
|
|
metal/kernel mode addresses
At the moment GDB only handles pointer authentication (pauth) for userspace
addresses and if we're debugging a Linux-hosted program.
The Linux Kernel can be configured to use pauth instructions for some
additional security hardening, but GDB doesn't handle this well.
To overcome this limitation, GDB needs a couple things:
1 - The target needs to advertise pauth support.
2 - The hook to remove non-address bits from a pointer needs to be registered
in aarch64-tdep.c as opposed to aarch64-linux-tdep.c.
There is a patch for QEMU that addresses the first point, and it makes
QEMU's gdbstub expose a couple more pauth mask registers, so overall we will
have up to 4 pauth masks (2 masks or 4 masks):
pauth_dmask
pauth_cmask
pauth_dmask_high
pauth_cmask_high
pauth_dmask and pauth_cmask are the masks used to remove pauth signatures
from userspace addresses. pauth_dmask_high and pauth_cmask_high masks are used
to remove pauth signatures from kernel addresses.
The second point is easily addressed by moving code around.
When debugging a Linux Kernel built with pauth with an unpatched GDB, we get
the following backtrace:
#0 __fput (file=0xffff0000c17a6400) at /repos/linux/fs/file_table.c:296
#1 0xffff8000082bd1f0 in ____fput (work=<optimized out>) at /repos/linux/fs/file_table.c:348
#2 0x30008000080ade30 [PAC] in ?? ()
#3 0x30d48000080ade30 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
With a patched GDB, we get something a lot more meaningful:
#0 __fput (file=0xffff0000c1bcfa00) at /repos/linux/fs/file_table.c:296
#1 0xffff8000082bd1f0 in ____fput (work=<optimized out>) at /repos/linux/fs/file_table.c:348
#2 0xffff8000080ade30 [PAC] in task_work_run () at /repos/linux/kernel/task_work.c:179
#3 0xffff80000801db90 [PAC] in resume_user_mode_work (regs=0xffff80000a96beb0) at /repos/linux/include/linux/resume_user_mode.h:49
#4 do_notify_resume (regs=regs@entry=0xffff80000a96beb0, thread_flags=4) at /repos/linux/arch/arm64/kernel/signal.c:1127
#5 0xffff800008fb9974 [PAC] in prepare_exit_to_user_mode (regs=0xffff80000a96beb0) at /repos/linux/arch/arm64/kernel/entry-common.c:137
#6 exit_to_user_mode (regs=0xffff80000a96beb0) at /repos/linux/arch/arm64/kernel/entry-common.c:142
#7 el0_svc (regs=0xffff80000a96beb0) at /repos/linux/arch/arm64/kernel/entry-common.c:638
#8 0xffff800008fb9d34 [PAC] in el0t_64_sync_handler (regs=<optimized out>) at /repos/linux/arch/arm64/kernel/entry-common.c:655
#9 0xffff800008011548 [PAC] in el0t_64_sync () at /repos/linux/arch/arm64/kernel/entry.S:586
Backtrace stopped: Cannot access memory at address 0xffff80000a96c0c8
|
|
Commit 42c13555ff88 ("Change value::m_stack to bool") erroneously
changed a `0` to `false` in this call to read_value_memory. This
parameter is `LONGEST bit_offset`, it should stay `0`.
Change-Id: I128df6834cf8055ec6a7051e237e379978d3d651
|
|
I noticed two inconsistencies in the GDB/MI documentation, which this
commit addresses:
1. Each MI command is introduced like this:
@subheading The @code{-command-name} Command
Except for a few of the tracing command, which just use:
@subheading -command-name
In this commit I've updated all these trace commands to use the
more common format.
2. Each MI command starts with a @subheading, and then the details
of that command are split up using multiple @subsubheading
entries.
Except for a few commands which use @subheading for the top-level
command, and then continue to use @subheading for each part of
the command description.
In this commit I've updated these to use @subsubheading where
appropriate.
|
|
Currently we only trust epilogue unwind info only for gcc >= 4.5.0.
This has the effect that we don't trust epilogue unwind info for:
- unknown producers (CU without DW_AT_producer attribute)
- non-gcc producers (say, clang).
Instead, only distrust epilogue unwind info only for gcc < 4.5.0.
|
|
For a -g0 -fasynchronous-unwind-tables exec (without .debug_info but with
.eh_frame section), start using the dwarf2 unwinder instead of the
"amd64 epilogue override" unwinder, by returning true in
compunit_epilogue_unwind_valid for cust == nullptr.
This has effect both on the amd64 and i386 targets, but only add amd64
test-case gdb.base/unwind-on-each-insn-amd64-2.exp.
|
|
For amd64 the current frame-unwinders are:
...
$ gdb -q -batch -ex "set arch i386:x86-64" -ex "maint info frame-unwinders"
The target architecture is set to "i386:x86-64".
dummy DUMMY_FRAME
dwarf2 tailcall TAILCALL_FRAME
inline INLINE_FRAME
python NORMAL_FRAME
amd64 epilogue NORMAL_FRAME
dwarf2 NORMAL_FRAME
dwarf2 signal SIGTRAMP_FRAME
amd64 sigtramp SIGTRAMP_FRAME
amd64 prologue NORMAL_FRAME
...
For a -g0 -fasynchronous-unwind-tables exec (without .debug_info but with
.eh_frame section), we'd like to start using the dwarf2 unwinder instead of
the "amd64 epilogue" unwinder, by returning true in
compunit_epilogue_unwind_valid for cust == nullptr.
But we'd run into the following problem for a -g0
-fno-asynchronous-unwind-tables (without .debug_info and .eh_frame section)
exec:
- the "amd64 epilogue" unwinder would not run
(because compunit_epilogue_unwind_valid () == true)
- the dwarf2 unwinder would also not run
(because there's no .eh_frame info).
Fix this by:
- renaming the "amd64 epilogue" unwinder to "amd64 epilogue override", and
- adding a fallback "amd64 epilogue" after the dwarf unwinders,
while making sure that only one of the two is active. Likewise for i386. NFC.
For amd64, this results in this change:
...
$ gdb -q -batch -ex "set arch i386:x86-64" -ex "maint info frame-unwinders"
The target architecture is set to "i386:x86-64".
dummy DUMMY_FRAME
dwarf2 tailcall TAILCALL_FRAME
inline INLINE_FRAME
python NORMAL_FRAME
-amd64 epilogue NORMAL_FRAME
+amd64 epilogue override NORMAL_FRAME
dwarf2 NORMAL_FRAME
dwarf2 signal SIGTRAMP_FRAME
+amd64 epilogue NORMAL_FRAME
amd64 sigtramp SIGTRAMP_FRAME
amd64 prologue NORMAL_FRAME
...
And for i386:
...
$ gdb -q -batch -ex "set arch i386" -ex "maint info frame-unwinders"
The target architecture is set to "i386".
dummy DUMMY_FRAME
dwarf2 tailcall TAILCALL_FRAME
iline INLINE_FRAME
-i386 epilogue NORMAL_FRAME
+i386 epilogue override NORMAL_FRAME
dwarf2 NORMAL_FRAME
dwarf2 signal SIGTRAMP_FRAME
+i386 epilogue NORMAL_FRAME
i386 stack tramp NORMAL_FRAME
i386 sigtramp SIGTRAMP_FRAME
i386 prologue NORMAL_FRAME
...
|
|
The use of compunit_epilogue_unwind_valid in both amd64_stack_frame_destroyed_p
and i386_stack_frame_destroyed_p is problematic, in the sense that the
functions no longer match their documented behaviour.
Fix this by moving the use of compunit_epilogue_unwind_valid to
amd64_epilogue_frame_sniffer and i386_epilogue_frame_sniffer. No functional
changes.
|
|
Factor out compunit_epilogue_unwind_valid from both
amd64_stack_frame_destroyed_p and i386_stack_frame_destroyed_p. No functional
changes.
Also add a comment in the new function about the assumption that in absence of
producer information, epilogue unwind info is invalid.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
I came across:
...
gdb) PASS: gdb.python/py-record-btrace.exp: prepare record: stepi 100
python insn = r.instruction_history^M
warning: Non-contiguous trace at instruction 1 (offset = 0x3e10).^M
(gdb) FAIL: gdb.python/py-record-btrace.exp: prepare record: python insn = r.i\
nstruction_history
...
I'm assuming it's the same root cause as for the already present XFAIL.
Fix this by recognizing above warning in the xfail regexp.
Tested on x86_64-linux, although sofar I was not able to trigger the warning
again.
Approved-By: Markus T. Metzger <markus.t.metzger@intel.com>
|
|
Since commit 9af467b8240 ("[gdb/testsuite] Fix gdb.threads/schedlock.exp on
fast cpu"), the test-case fails for gcc 4.8.5.
The problem is that for gcc 4.8.5, the commit turned a two-line loop:
...
(gdb) next
78 while (*myp > 0)
(gdb) next
81 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++;
(gdb) next
78 while (*myp > 0)
...
into a three-line loop:
...
(gdb) next
83 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++;
(gdb) next
84 cnt++;
(gdb) next
85 }
(gdb) next
83 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++;
(gdb)
...
and the test-case doesn't expect this.
Fix this by reverting back to the original loop shape as much as possible by:
- removing the cnt++ line
- replacing "while (1)" with "while (one)", where one is a volatile variable
set to 1.
Tested on x86_64-linux, using compilers:
- gcc 4.8.5, 7.5.0, 12.2.1
- clang 4.0.1, 13.0.1
|
|
This converts contained_in to be a method of block.
|
|
This changes block to make the data members 'private'.
|
|
This removes allocate_block and allocate_global_block in favor of
simply calling 'new'.
|
|
This changes global_block to inherit from block, which is what was
always intended.
|
|
This changes block and global_block to add initializers, and then to
use 'new' for allocation.
|
|
mdebugread.c allocates blocks on the heap. However, this is a memory
leak if the corresponding objfile is ever destroyed.
This patch changes this code to use allocate_block instead, fixing a
FIXME from 2003.
I don't know how to test this patch.
|
|
This removes ALL_BLOCK_SYMBOLS in favor of foreach.
|
|
This removes ALL_BLOCK_SYMBOLS_WITH_NAME in favor of foreach.
|
|
This converts most existing explicit uses of block_iterator to use
foreach with the range iterator instead.
|