aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-03-22windows-nat: Remove SO_NAME_MAX_PATH_SIZE limitPedro Alves1-6/+16
There is no need to limit shared library path sizes to SO_NAME_MAX_PATH_SIZE nowadays. windows_solib::name and windows_solib::original_name are std::strings nowadays, and so are solib::so_name and solib::so_original_name in the core solib code. This commit reworks the code to remove that limit. This also fixes a leak where we were not releasing 'rname' in the realpath branch if the 'rname' string was larger than SO_NAME_MAX_PATH_SIZE. Note: I tested the cygwin_conv_path with a manual hack to force that path, and then stepping through the code. You only get to that path if Windows doesn't report an absolute path for ntdll.dll, and on my machine (running Windows 10), it always does. Approved-By: John Baldwin <jhb@FreeBSD.org> Change-Id: I79e9862d5a7646eebfef7ab5b05b96318a7ca0c5
2024-03-22Simplify windows-nat.c:windows_make_so #ifdeferyPedro Alves1-7/+6
There are two separate #ifndef __CYGWIN__/#else/#endif sections in the windows_make_so function with 3 lines of shared code separating them. I find this makes the code harder to understand than necessary. AFAICS, there is no reason those three shared lines need to be after the first #ifdef block. There is no early return, nor are 'load_addr' nor 'name' modified. This commit moves that shared code to the top of the function, and then combines the two #ifndef sections. Approved-By: John Baldwin <jhb@FreeBSD.org> Change-Id: If2678b52836b1c3134a5e9f9fdaee74448d8b7bc
2024-03-22Remove SO_NAME_MAX_PATH_SIZE limit from core solib codePedro Alves1-2/+0
solib_map_sections errors out if the library file name is longer than SO_NAME_MAX_PATH_SIZE. solib::so_name and solib::so_original_name used to be arrays of SO_NAME_MAX_PATH_SIZE size, so that check made sense then. However, since commit 98107b0b17ac ("gdb: make so_list::{so_original_name,so_name} std::strings") those fields are of std::string type, so there's really no need for the limit. This commit simply removes the length limit check. Approved-By: John Baldwin <jhb@FreeBSD.org> Change-Id: I2ec676b231cd18ae900c61c5caea461f47e989e6
2024-03-22Use std::string for disassembler optionsTom Tromey11-35/+30
I noticed that the disassembler_options code uses manual memory management. It seemed simpler to replace this with std::string. Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-22Remove some unnecessary castsTom Tromey1-6/+6
I found a few unnecessary casts when calling set_gdbarch_disassembler_options_implicit. Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-22Constify get_disassembler_optionsTom Tromey3-3/+3
This changes get_disassembler_options to return a const char *. Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-22Revert "Pass GUILE down to subdirectories"Tom Tromey3-12/+4
This reverts commit b7e5a29602143b53267efcd9c8d5ecc78cd5a62f. This patch caused problems for some users when building gdb, because it would cause 'guild' to be invoked with the wrong versin of guile. On the whole it seems simpler to just back this out. I'm checking this in to the binutils-gdb repository in the interest of fixing the build for Andrew. No one has responded to the identical patch sent to gcc-patches, but I will ping it there. * Makefile.in: Rebuild. * Makefile.tpl (BASE_EXPORTS): Remove GUILE. (GUILE): Remove. * Makefile.def (flags_to_pass): Remove GUILE.
2024-03-22gdb: LoongArch: Clean up loongarch_iterate_over_regset_sections()Tiezhu Yang1-5/+6
Define a new variable gpsize as gprsize * LOONGARCH_LINUX_NUM_GREGSET to replace the related code in the first cb(), and also make use of tabs and spaces in indentation to force the proper alignment of code, then remove the empty line at the end of the function. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2024-03-22Teach GDB to generate sparse core files (PR corefiles/31494)Pedro Alves4-108/+323
This commit teaches GDB's gcore command to generate sparse core files (if supported by the filesystem). To create a sparse file, all you have to do is skip writing zeros to the file, instead lseek'ing-ahead over them. The sparse logic is applied when writing the memory sections, as that's where the bulk of the data and the zeros are. The commit also tweaks gdb.base/bigcore.exp to make it exercise gdb-generated cores in addition to kernel-generated cores. We couldn't do that before, because GDB's gcore on that test's program would generate a multi-GB non-sparse core (16GB on my system). After this commit, gdb.base/bigcore.exp generates, when testing with GDB's gcore, a much smaller core file, roughly in line with what the kernel produces: real sizes: $ du --hu testsuite/outputs/gdb.base/bigcore/bigcore.corefile.* 2.2M testsuite/outputs/gdb.base/bigcore/bigcore.corefile.gdb 2.0M testsuite/outputs/gdb.base/bigcore/bigcore.corefile.kernel apparent sizes: $ du --hu --apparent-size testsuite/outputs/gdb.base/bigcore/bigcore.corefile.* 16G testsuite/outputs/gdb.base/bigcore/bigcore.corefile.gdb 16G testsuite/outputs/gdb.base/bigcore/bigcore.corefile.kernel Time to generate the core also goes down significantly. On my machine, I get: when writing to an SSD, from 21.0s, down to 8.0s when writing to an HDD, from 31.0s, down to 8.5s The changes to gdb.base/bigcore.exp are smaller than they look at first sight. It's basically mostly refactoring -- moving most of the code to a new procedure which takes as argument who should dump the core, and then calling the procedure twice. I purposely did not modernize any of the refactored code in this patch. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31494 Reviewed-By: Lancelot Six <lancelot.six@amd.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org> Reviewed-By: John Baldwin <jhb@FreeBSD.org> Change-Id: I2554a6a4a72d8c199ce31f176e0ead0c0c76cff1
2024-03-22x86: fix Solaris testsuite failuresJan Beulich2-7/+4
For one 0afc614c9938 ("x86: Warn .insn instruction with length > 15 bytes") introduced a .insn use involving a slash; such tests need to have --divide passed to gas. And then 5bc71c2a6b8e ("x86-64: Add R_X86_64_CODE_6_GOTTPOFF") broke BFD_RELOC_X86_64_GOTTPOFF conversion to R_X86_64_CODE_4_GOTTPOFF, by adding respective code in a section guarded by generate_relax_relocations (the case of that not being required there was limited to 32-bit object files). Re-arrange that block of code to check generate_relax_relocations later.
2024-03-22Automatic date update in version.inGDB Administrator1-1/+1
2024-03-21gdbserver: Clear X86_XSTATE_MPX bits in xcr0 on x32H.J. Lu1-0/+4
Since MPX isn't available for x32, we should clear X86_XSTATE_MPX bits on x32. PR server/31511 * linux-x86-low.cc (x86_linux_read_description): Clear X86_XSTATE_MPX bits in xcr0 on x32. Reviewed-by: Felix Willgerodt <felix.willgerodt@intel.com>
2024-03-21Implement Ada 2022 delta aggregatesTom Tromey8-5/+197
Ada 2022 includes a "delta aggregates" feature that can sometimes simplify aggregate creation. This patch implements this feature for GDB.
2024-03-21Require trivial destructor in allocate_on_obstackTom Tromey7-8/+12
This patch makes allocate_on_obstack a little bit safer, by enforcing the rule that objects allocated on an obstack must have a trivial destructor. The static assert is done in a method -- doing it inside the class itself won't work because the class is incomplete at that point.
2024-03-21Don't use virtual destructor in addrmapTom Tromey1-2/+3
The addrmap polymorphism is sort of "phony" in that there isn't really code in the tree that can be presented with either type. I haven't tried to fix this (though perhaps I may); but meanwhile it's handy for the next patch if addrmap_fixed has a trivial destructor. This patch achieves this by making the addrmap destructor non-virtual, and also making it protected so that objects of any of these types cannot be destroyed when only the base class is known.
2024-03-21Use addrmap_fixed in a few spotsTom Tromey3-7/+7
There are a few spots in the tree that use 'addrmap' where only an addrmap_fixed will ever really be seen. This patch changes this code to use the more specific type.
2024-03-21sim/erc32: Rename EVENT_MAX -> MAX_EVENTSOrgad Shaneh2-4/+4
EVENT_MAX is defined as 0x7FFFFFFF (INT_MAX) in winuser.h, so when building on Windows, the value is overridden and compilation fails because the array size of evbuf is too large. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28476 Approved-By: Tom Tromey <tom@tromey.com>
2024-03-21gdb: syscalls: Add some tips for LoongArch xml filesTiezhu Yang2-2/+45
In commit a08dc2aa004b (gdb: syscalls: Add loongarch-linux.xml.in), it needs special handling when generating xml file. This should at least be mentioned in the file comment rather than git log to help the next person who regenerates this file understand what needs to be done, suggested by Pedro Alves, thank you. At the beginning, I only added the tips in loongarch-linux.xml.in, after executing the command "make" to generate loongarch-linux.xml from loongarch-linux.xml.in, it generates the same tips in the file loongarch-linux.xml automatically, so update loongarch-linux.xml.in and loongarch-linux.xml together. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-by: Pedro Alves <pedro@palves.net>
2024-03-21gdb: LoongArch: Silence warning about core file of lsx and lasxHui Li1-2/+4
In loongarch_iterate_over_regset_sections(), the second and third arguments of the iterate_over_regset_sections_cb callback function should be the regset size which is regsize * regnum. Otherwise when execute: make check-gdb TESTS="gdb.base/corefile.exp" there exists the following failed log: (gdb) core-file /home/fedora/community/gdb/build/gdb/testsuite/outputs/gdb.base/corefile/corefile.core [New LWP 531099] warning: Unexpected size of section `.reg-loongarch-lsx/531099' in core file. warning: Unexpected size of section `.reg-loongarch-lasx/531099' in core file. Core was generated by `/home/fedora/community/gdb/build/gdb/testsuite/outputs/gdb.base/corefile/corefile'. Program terminated with signal SIGABRT, Aborted. warning: Unexpected size of section `.reg-loongarch-lsx/531099' in core file. warning: Unexpected size of section `.reg-loongarch-lasx/531099' in core file. #0 0x00007ffff3081600 in __pthread_kill_implementation.constprop.0 () from /lib64/libc.so.6 (gdb) FAIL: gdb.base/corefile.exp: core-file warning-free Signed-off-by: Hui Li <lihui@loongson.cn> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2024-03-21New Romanian translation for gas sub-directoryNick Clifton1-0/+23890
2024-03-21Automatic date update in version.inGDB Administrator1-1/+1
2024-03-20.pre-commit-config.yaml: bump black hook to 24.3.0Simon Marchi2-1/+5
Running `pre-commit autoupdate` showed that there is a new version of the black hook for v24.3.0. Update it. ChangeLog: * .pre-commit-config.yaml: Bump black hook to 24.3.0 Change-Id: I5ec7d2edf99cd15f6525281a43aed9ff481ee9ee
2024-03-20[gdb/testsuite] Fix gdb.server/server-connect.exp for missing ipv6Tom de Vries2-0/+6
On a system without ipv6 support enabled, when running test-case gdb.server/server-connect.exp, it takes about 4 minutes, and I get: ... builtin_spawn gdbserver --once ::1:2347 server-connect^M Can't open socket: Address family not supported by protocol.^M Exiting^M PASS: gdb.server/server-connect.exp: tcp6: start gdbserver target remote tcp6:::1:2347^M A program is being debugged already. Kill it? (y or n) y^M could not connect: Address family not supported by protocol.^M (gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1 ... Fix this by: - recognizing the error message in gdbserver_start, and returning an empty list to signal unsupported, and - handling the unsupported response in the test-case. This brings testing time down to 2 seconds, and gets me: ... UNSUPPORTED: gdb.server/server-connect.exp: tcp6: start gdbserver UNSUPPORTED: gdb.server/server-connect.exp: tcp6-with-brackets: start gdbserver UNSUPPORTED: gdb.server/server-connect.exp: udp6: start gdbserver UNSUPPORTED: gdb.server/server-connect.exp: udp6-with-brackets: start gdbserver ... Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR testsuite/31502 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31502
2024-03-20[gdb/testsuite] Handle core without build-id in gdb.base/corefile-buildid.expTom de Vries1-1/+13
On aarch64-linux (debian 12), when running test-case gdb.base/corefile-buildid.exp, I get: ... expecting exec file "debugdir-exec/.build-id/ec/f10ec5d39648774f8c35d3cf757c8db52f5163" info files^M Local core dump file:^M `build-exec/corefile-buildid.core', file type elf64-littleaarch64.^M 0x0000aaaac1d70000 - 0x0000aaaac1d71000 is load1^M ... 0x0000ffffffa8b000 - 0x0000ffffffaac000 is load16^M (gdb) FAIL: gdb.base/corefile-buildid.exp: exec: info files ... The problem is that the test-case expect the build-id to be available in the core file, while it isn't. Fix this by detecting that the build-id isn't available in the core file using eu-readelf, as in gdb.base/coredump-filter-build-id.exp. Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2024-03-20[gdb/testsuite] Add PR gdb/26967 KFAIL in two more test-casesTom de Vries4-14/+62
On aarch64-linux (debian 12), when running test-case gdb.base/longjmp-until-in-main.exp, I run into: ... (gdb) until 33^M warning: Breakpoint address adjusted from 0x70f727c678928489 to 0xfff727c678928489.^M Warning:^M Cannot insert breakpoint 0.^M Cannot access memory at address 0xfff727c678928489^M ^M 0x0000fffff7e3a580 in siglongjmp () from /lib/aarch64-linux-gnu/libc.so.6^M (gdb) FAIL: gdb.base/longjmp-until-in-main.exp: until $line, in main ... This is PR gdb/26967: no longjmp probe is available: ... (gdb) info probes stap libc ^longjmp$^M No probes matched.^M ... and glibc applies pointer mangling which makes it fairly difficult for gdb to get the longjmp target. There's a KFAIL for this in test-case gdb.base/longjmp.exp, added in commit b5e7cd5cd3d ("[gdb/testsuite] Add KFAILs in gdb.base/longjmp.exp"). Factor out new proc have_longjmp_probe, and use it to add similar KFAIL in this and one more test-case. Tested on aarch64-linux. Approved-By: Tom Tromey <tom@tromey.com>
2024-03-20Fix casting in-memory values of primitive types to const referenceHannes Domani4-1/+12
It's currently not possible to cast an in-memory value of a primitive type to const reference: ``` (gdb) p Q.id $1 = 42 (gdb) p (int&)Q.id $2 = (int &) @0x22fd0c: 42 (gdb) p (const int&)Q.id Attempt to take address of value not located in memory. ``` And if in a function call an argument needs the same kind of casting, it also doesn't work: ``` (gdb) l f3 39 int f3(const int &i) 40 { 41 return i; 42 } (gdb) p f3(Q.id) Attempt to take address of value not located in memory. ``` It's because when the constness of the type changes in a call to value_cast, a new not_lval value is allocated, which doesn't exist in the target memory. Fixed by ignoring const/volatile/restrict qualifications in value_cast when comparing cast type to original type, so the new value will point to the same location as the original value: ``` (gdb) p (int&)i $2 = (int &) @0x39f72c: 1 (gdb) p (const int&)i $3 = (const int &) @0x39f72c: 1 (gdb) p f3(Q.id) $4 = 42 ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19423 Approved-By: Tom Tromey <tom@tromey.com>
2024-03-20Fix reinterpret_cast for classes with multiple inheritanceHannes Domani3-2/+27
Currently a reinterpret_cast may change the pointer value if multiple inheritance is involved: ``` (gdb) p r $1 = (Right *) 0x22f75c (gdb) p reinterpret_cast<LeftRight*>(r) $2 = (LeftRight *) 0x22f758 ``` It's because value_cast is called in this case, which automatically does up- and downcasting. Fixed by simply using the target pointer type in a copy of the original value: ``` (gdb) p r $1 = (Right *) 0x3bf87c (gdb) p reinterpret_cast<LeftRight*>(r) $2 = (LeftRight *) 0x3bf87c ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18861 Approved-By: Tom Tromey <tom@tromey.com>
2024-03-20Add .pre-commit-config.yamlSimon Marchi2-0/+12
Add a pre-commit [1] config file, with a single hook to run black on the gdb directory whenever a Python file is modified. We can always add more hooks if we find some that are useful. Using pre-commit to run hooks is opt-in, as in it's not mandatory at all for development, but it can be useful to run some checks that are easy to forget (like running black). The hooks run locally on the developer's machine when doing `git commit` (although they can also be configured to run at other stages of the git workflow). Follow these instructions to install the hooks in your local development git repository: - Install pre-commit the way you prefer. It can be using your OS package manager if it has a recent enough version, or using `pip install pre-commit`. - Go to the binutils-gdb repository and run `pre-commit install`. This installs a git hook at `.git/hooks/pre-commit`. Now, whenever you modify and try to commit a Python file, pre-commit will run black on it. For instance, if I try to insert something misformatted, I get this when doing `git commit`: $ git commit black....................................................................Failed - hook id: black - files were modified by this hook reformatted gdb/python/lib/gdb/dap/breakpoint.py All done! ✨ 🍰 ✨ 1 file reformatted. At this point, black has already reformatted the files in place, so the changes that fix the formatting are ready to add and commit. black is only ran on files modified in the commit. The hook defines a black version, which is downloaded at `pre-commit install` time. pre-commit manages its own env at `$HOME/.cache/pre-commit/<some-hash>`, so it won't use the version of black you have installed already. This may help ensure that contributors use the right black version. The procedure when there is a new version of black (or a new version of any hook we might be using in the future) is: - Modify .pre-commit-config.yaml to change the version number, push to the upstream repo. - Have contributors run `pre-commit autoupdate` to make their local pre-commit installation update the hooks. It is possible to have pre-commit skip some hooks if needed [2]. I will add these instructions to the wiki if this patch gets merged, so they are easy to find. We could perhaps think of having a gdb/CONTRIBUTING document of some sort checked in the repo with that kind of information. I have not used pre-commit in a real project before, but have heard good things from it. If we want to give it a try before pushing it to the repo, some volunteers can copy the .pre-commit-config.yaml file locally and try it for some time. However, pushing the file upstream is not going to impact anybody who doesn't care about it, so I'd say it's relatively low-risk to push it right now. [1] https://pre-commit.com [2] https://pre-commit.com/#temporarily-disabling-hooks Change-Id: Id00cda882f5140914a670c87e574fa7f2f972099 Acked-By: Tom Tromey <tromey@adacore.com> Acked-By: Guinevere Larsen <blarsen@redhat.com> Acked-By: Andrew Burgess <aburgess@redhat.com>
2024-03-20Fix comparison of array typesHannes Domani2-0/+14
Currently it's not possible to call functions if an argument is a pointer to an array: ``` (gdb) l f 1 int f (int (*x)[2]) 2 { 3 return x[0][1]; 4 } 5 6 int main() 7 { 8 int a[2][2] = {{0, 1}, {2, 3}}; 9 return f (a); 10 } (gdb) p f(a) Cannot resolve function f to any overloaded instance ``` This happens because types_equal doesn't handle array types, so the function is never even considered as a possibility. With array type handling added, by comparing element types and array bounds, the same works: ``` (gdb) p f(a) $1 = 1 ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=15398 Co-Authored-By: Keith Seitz <keiths@redhat.com> Reviewed-By: Guinevere Larsen <blarsen@redhat.com> Approved-By: Tom Tromey <tom@tromey.com>
2024-03-20gdb: LoongArch: Set the correct XML syscall filenameTiezhu Yang2-0/+8
Now, there exists syscalls/loongarch-linux.xml, let us set the correct XML syscall filename for LoongArch, otherwise GDB won't be able to find the correct XML file to open and get the syscalls definitions. It should install the package expat-devel (a library for XML parsing) and configure --with-expat (done by default if libexpat is installed and found at configure time) for compiling gdb in this case. Without this patch: (gdb) catch syscall warning: There is no XML file to open. warning: GDB will not be able to display syscall names nor to verify if any provided syscall numbers are valid. Catchpoint 1 (any syscall) Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-20gdb: syscalls: Add loongarch case in update-linux-from-src.shTiezhu Yang1-0/+4
It shows that "Don't know how to generate loongarch-linux.xml.in" when using the script update-linux-from-src.sh to regenerate the syscall group info against Linux kernel, just add loongarch case. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-20gdb: syscalls: Generate loongarch-linux.xmlTiezhu Yang1-0/+327
Make use of the command "make" to generate loongarch-linux.xml from loongarch-linux.xml.in. Like this: $ git clone https://sourceware.org/git/binutils-gdb.git gdb.git $ cd gdb.git/gdb/syscalls/ $ make Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-20gdb: syscalls: Add loongarch-linux.xml.inTiezhu Yang1-0/+331
There is no syscall.tbl for LoongArch because it uses generic syscalls, so it can not generate loongarch-linux.xml.in automatically through the script update-linux-from-src.sh, make use of the script update-linux.sh to generate loongarch-linux.xml.in. Like this: $ git clone https://sourceware.org/git/binutils-gdb.git gdb.git $ cd gdb.git/gdb/syscalls/ $ touch loongarch-linux.xml.in $ ./update-linux.sh loongarch-linux.xml.in Note that the system header file /usr/include/asm-generic/unistd.h may be different with the latest upstream Linux kernel uapi header file include/uapi/asm-generic/unistd.h, it is better to copy the upstream header file into the system header file when generating loongarch-linux.xml.in. There exist some __NR3264_ prefixed syscall numbers, replace them with digital numbers according to /usr/include/asm-generic/unistd.h and sort them by syscall number manually, maybe we can modify the script to do it automatically in the future. <syscall name="fcntl" number="__NR3264_fcntl"/> <syscall name="statfs" number="__NR3264_statfs"/> <syscall name="fstatfs" number="__NR3264_fstatfs"/> <syscall name="truncate" number="__NR3264_truncate"/> <syscall name="ftruncate" number="__NR3264_ftruncate"/> <syscall name="lseek" number="__NR3264_lseek"/> <syscall name="sendfile" number="__NR3264_sendfile"/> <syscall name="mmap" number="__NR3264_mmap"/> <syscall name="fadvise64" number="__NR3264_fadvise64"/> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-20gdb: syscalls: Update .xml files for some archsTiezhu Yang11-0/+123
Make use of the command "make" to regenerate .xml files from .xml.in files. Like this: $ git clone https://sourceware.org/git/binutils-gdb.git gdb.git $ cd gdb.git/gdb/syscalls/ $ make Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-20gdb: syscalls: Update .xml.in files for some archsTiezhu Yang11-0/+123
Make use of the script update-linux-from-src.sh to regenerate the Linux syscall group info against Linux git commit d206a76d7d27 which will be released in v6.8. Like this: $ git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux.git $ git clone https://sourceware.org/git/binutils-gdb.git gdb.git $ cd gdb.git/gdb/syscalls/ $ ./update-linux-from-src.sh ~/linux.git/ Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-20gdb: syscalls: Update linux-defaults.xml.inTiezhu Yang1-0/+3
Make use of the script update-linux-defaults.sh to regenerate the Linux syscall group info against strace git commit 8c480270653d which will be released in v6.8. Like this: $ git clone https://github.com/strace/strace.git strace.git $ git clone https://sourceware.org/git/binutils-gdb.git gdb.git $ cd gdb.git/gdb/syscalls/ $ ./update-linux-defaults.sh ~/strace.git/ Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-03-20[gdb/symtab] Workaround PR gas/31115Tom de Vries3-0/+24
On arm-linux, with gas 2.40, I run into: ... (gdb) x /i main+8^M 0x4e1 <main+7>: vrhadd.u16 d14, d14, d31^M (gdb) FAIL: gdb.arch/pr25124.exp: disassemble thumb instruction (1st try) ... This is a regression due to PR gas/31115, which makes gas produce a low_pc with the thumb bit set (0x4d8 & 0x1): ... <1><24>: Abbrev Number: 2 (DW_TAG_subprogram) <25> DW_AT_name : main <29> DW_AT_external : 1 <29> DW_AT_type : <0x2f> <2a> DW_AT_low_pc : 0x4d9 <2e> DW_AT_high_pc : 12 ... The regression was introduced in 2.39, and is also present in 2.40 and 2.41, and hasn't been fixed yet. Work around this in read_func_scope, by using gdbarch_addr_bits_remove on low_pc and high_pc. Tested on arm-linux and x86_64-linux. PR tdep/31453 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31453
2024-03-20Automatic date update in version.inGDB Administrator1-1/+1
2024-03-19Speed up lookup of "type_specific_data"Tom Tromey13-20/+200
I noticed that "info locals" on a certain large Ada program was very slow. I tracked this down to ada_get_tsd_type expanding nearly every CU in the program. This patch fixes the problem by changing this code to use the more efficient lookup_transparent_type which, unlike the Ada-specific lookup functions, does not try to find all matching instances. Note that I first tried fixing this by changing ada_find_any_type, but this did not work -- I may revisit this approach at some later date. Also note that the copyright dates on the test files are set that way because I copied them from another test. New in v2: the new test failed on the Linaro regression tester. Looking at the logs, it seems that gdb was picking up a 'value' from libgnat: $1 = {<text variable, no debug info>} 0xf7e227a4 <ada.calendar.formatting.value> This version renames the local variable in an attempt to work around this. v3: In v2, while trying to reproduce the problem locally, I accidentally forgot to commit one of the changes.
2024-03-19Fix two serious flake8 reportsTom Tromey1-15/+10
flake8 points out that some code in frame_filters.py is referring to undefined variables. In the first hunk, I've changed the code to match what other 'complete' methods do in this file. In the second hunk, I've simply removed the try/except -- if get_filter_priority fails, it will raise GdbError, which is already handled properly by gdb.
2024-03-19gdb/python: test exception case for gdb.solib_nameAndrew Burgess1-0/+15
The gdb.solib_name() and Progspace.solib_name() functions can throw an exception if the address argument is not a valid address, but this is not currently tested. This commit adds a couple of tests to check that exceptions are thrown correctly. An early version of this commit updated the documentation, but it was pointed out that lots of functions throw an exception if passed an argument of the wrong type, and we don't document all of these, it's kind-of assumed that passing an object of the incorrect type might result in an exception, so this updated version leaves the docs alone, but I do think adding the extra tests has value. There's no changes to GDB itself in this commit. Approved-By: Tom Tromey <tom@tromey.com>
2024-03-19gas, aarch64: Add faminmax extensionSaurabh Jha28-2486/+3747
2024-03-19Remove redunant test of ELF size in core note decoder.Nick Clifton1-7/+0
PR 31469
2024-03-19gdbsupport: rename include guard in gdb-checked-static-cast.hAndrew Burgess1-3/+3
I noticed in passing that the include guard in the file gdbsupport/gdb-checked-static-cast.h was wrong, it includes the word DYNAMIC when STATIC would be better, fixed in this commit. There should be no user visible changes after this commit.
2024-03-19gdb: use static_cast in gdb::checked_static_castAndrew Burgess1-8/+4
This commit: commit 6fe4779ac4b1874c995345e3eabd89cb1a05fbdf Date: Sat Feb 24 11:00:20 2024 +0100 [gdb/build] Fix static cast of virtual base addressed an issue where GDB would not compile in production mode due to a use of gdb::checked_static_cast. The problem was that we were asking GDB to cast from a virtual base class to a sub-class, this works fine when using dynamic_cast, but does not work with static_cast. The gdb::checked_static_cast actually uses dynamic_cast under the hood in development mode in order to ensure that the cast is valid, while in a production build we use static_cast as this is more efficient. What this meant however, was that when gdb::checked_static_cast was used to cast from a virtual base class, the dynamic_cast of a non-production build worked fine, while the production build's static_cast caused a build failure. However, the gdb::checked_static_cast function already contains some static_assert calls that are intended to catch any issues with invalid type casting, the goal of these asserts was to prevent issues like this: the build only failing in production mode. Clearly the current asserts are not enough. I don't think there is a std::is_virtual_base type trait check, so what I propose instead is that in non-production mode we also make use of static_cast. This will ensure that any errors that crop up in production mode should also be revealed in non-production mode, and should catch issues like this in the future. There should be no user visible changes after this commit. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31399 Co-Authored-By: Simon Marchi <simon.marchi@polymtl.ca>
2024-03-19Fix seg-fault in the DWARF reader code when accessing an abbreviatuin table ↵Nick Clifton1-8/+17
with a corrupt entry offset. PR 31456
2024-03-19ld: Support LD_UNDER_TEST environment variableH.J. Lu1-4/+26
Support LD_UNDER_TEST environment variable to test a different linker. Issue an error if LD_UNDER_TEST isn't an absolute full path. * testsuite/config/default.exp: If LD_UNDER_TEST environment variable exists, set ld and LD to it and set up tmpdir/ld/ld. Issue an error if LD_UNDER_TEST isn't an absolute full path.
2024-03-19Fix free of unallocated memory in the BFD library's compression code.Nick Clifton1-0/+4
PR 31455
2024-03-19Fix typo in previous patch to ld.texiNick Clifton1-1/+1
2024-03-19gdb/python: Fix segfault when iterating over empty linetableToby Lloyd Davies3-1/+97
symtab-> linetable () is set to null in buildsym_compunit::end_compunit_symtab_with_blockvector () if the symtab has no linetable. Attempting to iterate over this linetable using the Python API caused GDB to segfault. Approved-By: Tom Tromey <tom@tromey.com>