aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-03-27[gdb/testsuite] Fix gnat_runtime_has_debug_info for remote hostTom de Vries1-0/+4
Fix gnat_runtime_has_debug_info for remote host by checking for allow_ada_tests. This fixes an error for test-case gdb.testsuite/gdb-caching-proc.exp and remote host. Tested on x86_64-linux.
2023-03-27fbsd-nat: Use correct constant for target_waitstatus::sig.John Baldwin1-1/+1
Use GDB_SIGNAL_TRAP instead of SIGTRAP. This is a no-op since the value of SIGTRAP on FreeBSD matches the value of GDB_SIGNAL_TRAP, but it is more correct. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-27fbsd-nat: Avoid a direct write to target_waitstatus::kind.John Baldwin1-1/+1
This is in #ifdef'd code for a workaround for FreeBSD versions older than 11.1 which is why it wasn't caught earlier. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-27fbsd-nat: Add missing spaces.John Baldwin1-11/+11
No functional change, just style fixes. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-27gprofng: 30089 [display text] Invalid number of threadsVladimir Mezentsev18-2339/+1229
The real problem is that libcollector doesn't interpose thread_create@GLIBC_2.34 We interpose a lot of libC functions (dlopen, fork, pthread_create, etc.). Some of these functions have versions. For example, dlopen@GLIBC_2.34, dlopen@GLIBC_2.17, dlopen@GLIBC_2.2.5, etc. We have to interpose each of the functions because we don't know which version of libC will be used during profiling. Historically, we have used three versions of scripts (mapfile.aarch64-Linux, mapfile.amd64-Linux, mapfile.intel-Linux). Three are not needed. One is enough The fixes below include: - merged all version symbols into one version script. - added new version symbols which are defined in latest versions of libC. - removed unused defines and duplicated code. - added the DCL_FUNC_VER macro to define the version symbols. Tested on x86_64 and aarch64 (OL8/OL9). No regression. gprofng/ChangeLog 2023-03-23 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/30089 * libcollector/Makefile.am: Use libgprofng.ver instead of mapfile.* * libcollector/configure.ac: Delete GPROFNG_VARIANT. * src/collector_module.h: Move the SYMVER_ATTRIBUTE macro to collector.h * libcollector/collector.h: Add macros (SYMVER_ATTRIBUTE, DCL_FUNC_VER). Remove unused defines. * libcollector/dispatcher.c: Interpose functions from libC. Clean up the old code. * libcollector/iotrace.c: Likewise. * libcollector/libcol_util.c: Likewise. * libcollector/linetrace.c: Likewise. * libcollector/mmaptrace.c: Likewise. * libcollector/synctrace.c: Likewise. * libcollector/libgprofng.ver: New file. * libcollector/Makefile.in: Rebuild. * libcollector/configure: Rebuild. * libcollector/mapfile.aarch64-Linux: Removed. * libcollector/mapfile.amd64-Linux: Removed. * libcollector/mapfile.intel-Linux: Removed. * libcollector/mapfile.sparc-Linux: Removed. * libcollector/mapfile.sparcv9-Linux: Removed.
2023-03-27linux-nat: introduce pending_status_strPedro Alves2-7/+23
I noticed that some debug log output printing an lwp's pending status wasn't considering lp->waitstatus. This fixes it, by introducing a new pending_status_str function. Also fix the comment in gdb/linux-nat.h describing lwp_info::waitstatus and details the description of lwp_info::status while at it. Change-Id: I66e5c7a363d30a925b093b195d72925ce5b6b980 Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-03-27displaced step: pass down target_waitstatus instead of gdb_signalPedro Alves9-26/+30
This commit tweaks displaced_step_finish & friends to pass down a target_waitstatus instead of a gdb_signal. This is needed because a patch later in the step-over-{thread-exit,clone] series will want to make displaced_step_buffers::finish handle TARGET_WAITKIND_THREAD_EXITED. It also helps with the TARGET_WAITKIND_THREAD_CLONED patch later in that same series. It's also a bit more logical this way, as we don't have to pass down signals when the thread didn't actually stop for a signal. So we can also think of it as a clean up. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27338 Change-Id: I4c5d338647b028071bc498c4e47063795a2db4c0 Approved-By: Andrew Burgess <aburgess@redhat.com>
2023-03-27[gdb/testsuite] Fix gdb.stabs/exclfwd.exp for remote hostTom de Vries1-0/+2
Fix test-case gdb.stabs/exclfwd.exp for remote host using include_file. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.stabs/weird.exp for remote hostTom de Vries1-4/+3
Fix test-case gdb.stabs/weird.exp for remote host by not using an absolute destfile argument to gdb_remote_download, which doesn't work well with remotedir.
2023-03-27[gdb/testsuite] Fix gdb.gdb/unittest.exp for remote hostTom de Vries1-31/+44
Fix test-case gdb.gdb/unittest.exp for remote host, by: - disabling the completion tests if readline is not used, and - not using with_gdb_cwd $dir for remote host (because it does not support changing to "."). Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Skip do_self_tests on remote hostTom de Vries1-1/+1
In do_self_tests we try to find out the location of the gdb to debug, which will then be copied and renamed to xgdb. In principle, the host board specifies the location of GDB, on host. With remote host, we could upload that gdb from host to build/target, but we would miss the data directory (which is listed as the reason to skip do_self_tests for remote target). We could fix that by instead taking the gdb from build instead, but that wouldn't work with installed testing. It seems easier to just skip this on remote host. It could be made to work for the "[is_remote host] && [is_remote target] && host == target" scenario (see board local-remote-host-native.exp), but that doesn't seem worth the effort. Tested on x86_64-linux.
2023-03-27Change symbol::line to unsigned intTom Tromey5-11/+58
A user here at AdaCore noticed that, when debugging a certain program, a stack frame reported line 34358, where it should have been line 99894. After debugging a bit, I discovered: (top) p (99894 & ~65536) $60 = 34358 That line, symbol::line is too narrow. This patch widens the member and changes all the uses that currently use the narrower type. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-03-27Fix 128-bit integer bug in AdaTom Tromey3-21/+63
While working on 128-bit integer support, I found one spot in Ada that needed a fix as well.
2023-03-27Use gdb_gmp for scalar arithmeticTom Tromey7-367/+247
This changes gdb to use scalar arithmetic for expression evaluation. I suspect this patch is not truly complete, as there may be code paths that still don't correctly handle 128-bit integers. However, many things do work now. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30190
2023-03-27Use value_true in value_equal and value_lessTom Tromey1-4/+2
Both value_equal and value_less use value_as_long to check a presumably boolean result of calling value_binop. However, value_binop in this case actually returns an int as wide as its arguments, and this approach can then fail for integers wider than LONGEST. Instead, rewrite this in a form that works for any size integer.
2023-03-27Simplify binop_promoteTom Tromey1-36/+19
binop_promote currently only handles integer sizes up to builtin_long_long. However, this may not handle 128-bit types. Simplify this code, unify the C and non-C (but not OpenCL, as I don't know how to test this) cases, and handle 128-bit integers as well. This still doesn't exactly follow C or C++ rules. This could be implemented, but if so, I think it makes more sense as a C-specific expression node.
2023-03-27Add value_as_mpz and value_from_mpzTom Tromey2-0/+113
This adds the two new functions, value_as_mpz and value_from_mpz, useful for manipulation values via gdb_mpz.
2023-03-27Add truncation mode to gdb_mpzTom Tromey2-46/+76
This renames gdb_mpz::safe_export to export_bits, and adds a new flag to export a truncated value. This is needed by value arithmetic.
2023-03-27Avoid a copy in gdb_mpz::safe_exportTom Tromey1-9/+9
Currently, gdb_mpz::safe_export will always make a copy of *this. However, this copy isn't always needed. This patch makes this code slightly more efficient, by avoiding the copy when possible.
2023-03-27Add many operators to gdb_mpzTom Tromey1-0/+138
This adds many operator overloads and other useful methods to gdb_mpz. This is preparation for using this class for scalar arithmetic in gdb expression evaluation.
2023-03-27Populate seen_names hash in cooked_index_shard::do_finalizeTom Tromey1-0/+1
Hannes pointed out that cooked_index_shard::do_finalize never populates the seen_names hash table. This patch adds the necessary store. This reduces memory use a little for "gdb gdb": (before) Space used: 28909568 (+0 for this command) (after) Space used: 28884992 (+0 for this command) What this means, btw, is that in gdb there are not many symbols that are both mentioned in many CUs and that also require name canonicalization. It's possible this would differ in other programs.
2023-03-27[gdb/testsuite] Fix gdb.asm/asm-source.exp for remote hostTom de Vries1-4/+8
Fix test-case gdb.asm/asm-source.exp for remote host using host_standard_output_file and gdb_remote_download. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/imported-unit-bp-c.exp for remote hostTom de Vries1-0/+5
Fix test-case gdb.dwarf2/imported-unit-bp-c.exp on remote by removing a downloaded source file. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Unsupport gdb.dwarf2/gdb-add-index-symlink.exp for remote hostTom de Vries1-0/+3
Declare test-case gdb.dwarf2/gdb-add-index-symlink.exp unsupported for remote host, because the current implementation of gdb_ensure_index doesn't support it. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/gdb-index-cxx.exp for remote hostTom de Vries2-1/+4
Fix test-case gdb.dwarf2/gdb-index-cxx.exp for remote host using host_standard_output_file. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/enqueued-cu-base-addr.exp for remote hostTom de Vries1-1/+1
Fix test-case gdb.dwarf2/enqueued-cu-base-addr.exp for remote host by using $testfile instead $binfile. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on remote hostTom de Vries2-11/+32
Fix test-case gdb.dwarf2/gdb-index.exp on remote host using gdb_remote_download and host_standard_output_file. Also declare the test-case unsupported with readnow. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix gdb.dwarf2/per-bfd-sharing.exp for remote hostTom de Vries6-21/+23
Fix test-case gdb.dwarf2/per-bfd-sharing.exp for remote host using gdb_remote_download. Likewise in a few other test-cases. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix quoting issue in gdb.base/index-cache.expTom de Vries2-2/+2
For test-case gdb.base/index-cache.exp and remote host, this: ... lassign [remote_exec host sh "-c \"rm $cache_dir/*.gdb-index\""] ret ... gives us: ... Executing on host: sh -c rm /tmp/tmp.m3L7m2AVkL/*.gdb-index (timeout = 300) builtin_spawn -ignore SIGHUP sh -c rm /tmp/tmp.m3L7m2AVkL/*.gdb-index^M rm: missing operand^M Try 'rm --help' for more information.^M FAIL: gdb.dwarf2/per-bfd-sharing.exp: couldn't remove files in temporary cache dir ... Fix this using quote_for_host. Likewise in gdb.dwarf2/per-bfd-sharing.exp. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix quoting issues in gdb.dwarf2 for remote hostTom de Vries3-13/+35
A few test-cases in gdb.dwarf2 use something like: ... additional_flags=\"-DFOO=BAR + 10\" ... which doesn't work on remote host. Fix this by introducing a new proc quote_for_host that also works for remote host, such that we have: ... additional_flags=[quote_for_host -DFOO=BAR + 10] ... Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Fix have_index for remote hostTom de Vries1-0/+4
Proc have_index is mostly used with $binfile, which gives problems for remote host. Fix this by using "file tail" on the proc argument. Tested on x86_64-linux.
2023-03-27[gdb/testsuite] Add missing include_file in gdb.dwarf/*.expTom de Vries3-0/+5
2023-03-27[gdb/testsuite] Add test-case gdb.dlang/dlang-start-2.expTom de Vries2-0/+119
For test-case gdb.dlang/dlang-start.exp, I run into: ... UNSUPPORTED: gdb.dlang/dlang-start.exp: require failed: can_compile d ... My distro has no support for gdc, but I'd like to have the test-case running and passing, so let's rewrite the test-case using dwarf assembly and add it alongside (rather than replacing it, because it's good to use actual compiler output if we have it available). My distro does have a package providing dmd, so let's mimic that debug info in the dwarf assembly. This gives us: ... (gdb) start ^M Temporary breakpoint 1 at 0x4004ab^M Starting program: dlang-start-2 ^M ^M Temporary breakpoint 1, 0x00000000004004ab in _Dmain ()^M ... The "_Dmain ()" should probably be "D main", I've filed PR30276 about that. Also add a "show language" to check that we automatically set the language correctly to D. Note that the dwarf assembly also describes main, otherwise the test-case doesn't function as regression test for commit 47fe57c9281 ("Fix "start" for D, Rust, etc"). Tested on x86_64-linux.
2023-03-27Tidy tc-ppc.c XCOFF auxent accessAlan Modra1-45/+48
It's better not to drill down into u.auxent but instead use a pointer to the combined_entry_type. That way the fix_scnlen field is available, and no one looking at the codes needs to wonder whether coffsymbol (symbol_get_bfdsym (sym))->native[i + 1] is the same auxent. * config/tc-ppc.c (ppc_frob_symbol): Tidy XCOFF auxent access. (ppc_adjust_symtab): Likewise.
2023-03-27Remove coff_pointerize_aux table_end paramAlan Modra1-9/+4
I'm fairly certain the table_end checks are redundant now. This patch reverts commit 334d4ced42d3. * coffgen.c (coff_pointerize_aux): Remove table_end parameter. (coff_get_normalized_symtab): Adjust to suit.
2023-03-27Use stdint types in coff internal_auxentAlan Modra16-167/+165
long is a poor choice of type to store 32-bit values read from objects files by H_GET_32. H_GET_32 doesn't sign extend so tests like that in gdb/coffread.c for "negative" values won't work if long is larger than 32 bits. If long is 32-bit then code needs to be careful to not accidentally index negative array elements. (I'd rather see a segfault on an unmapped 4G array index than silently reading bogus data.) long is also a poor choice for x_sect.s_scnlen, which might have 64-bit values. It's better to use unsigned exact width types to avoid surprises. I decided to change the field names too, which makes most of this patch simply renaming. Besides that there are a few places where casts are no longer needed, and where printf format strings or tests need adjusting. include/ * coff/internal.h (union internal_auxent): Use unsigned stdint types. Rename l fields to u32 and u64 as appropriate. bfd/ * coff-bfd.c, * coff-rs6000.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * coffswap.h, * peXXigen.c, * xcofflink.c: Adjust to suit internal_auxent changes. binutils/ * rdcoff.c: Adjust to suit internal_auxent changes. gas/ * config/obj-coff.h, * config/tc-ppc.c: Adjust to suit internal_auxent changes. gdb/ * coffread.c, * xcoffread.c: Adjust to suit internal_auxent changes. ld/ * pe-dll.c: Adjust to suit internal_auxent changes.
2023-03-27Set proper union selector tagAlan Modra1-9/+18
* coff-bfd.c (bfd_coff_get_auxent): After converting sym pointer to an index, reset the union tag.
2023-03-27coffgrok access of u.auxent.x_sym.x_tagndx.pAlan Modra3-60/+40
u.auxent.x_sym.x_tagndx is a union. The p field is only valid when fix_tag is set. This patch fixes code in coffgrok.c that accessed the field without first checking fix_tag, and removes a whole lot of code validating bogus pointers to prevent segfaults (which no longer happen, I checked the referenced PR 17512 testcases). The patch also documents this in the fix_tag comment, makes is_sym a bitfield, and sorts the selecter fields a little. bfd/ * coffcode.h (combined_entry_type): Make is_sym a bitfield. Sort and comment on union selectors. * libcoff.h: Regenerate. binutils/ * coffgrok.c (do_type): Make aux a combined_entry_type. Test fix_tag before accessing u.auxent.x_sym.x_tagndx.p. Remove now unnecessary pointer bounds checking.
2023-03-27Duplicate DW_AT_call_file leakAlan Modra1-2/+5
When given two or more DW_AT_call_file for a given function we currently leak the concat memory. * dwarf2.c (scan_unit_for_symbols): Don't leak on duplicate DW_AT_call_file.
2023-03-27XCOFF sanity checkAlan Modra1-1/+2
* coffcode.h (coff_pointerize_aux_hook): Sanity check x_csect.x_scnlen against raw_syment_count.
2023-03-27Add an option to the gold linker to put its version string into the .comment ↵Nick Clifton3-10/+40
section. PR 30187 * options.h (class General_options): Add enable-linker-version. * layout.cc (Layout::create_gold_note): If linker-version is enabled put the version string into the .comment section.
2023-03-27[gdb/testsuite] Handle missing gdc in gdb.dlang/dlang-start.expTom de Vries2-0/+17
On openSUSE Leap 15.4, I get: ... Running gdb.dlang/dlang-start.exp ... gdb compile failed, default_target_compile: Can't find gdc. UNTESTED: gdb.dlang/dlang-start.exp: failed to prepare ... Fix this by: - introducing a new proc can_compile, and - requiring "can_compile d" in the test-case, such that I have instead: ... Running gdb.dlang/dlang-start.exp ... UNSUPPORTED: gdb.dlang/dlang-start.exp: require failed: can_compile d ... Tested on x86_64-linux, on openSUSE Leap 15.4 and Fedora 37.
2023-03-27[gdb/testsuite] Remove superfluous pid in temp filesTom de Vries2-7/+7
While trying to use gdb_can_simple_compile with a d program, I ran into: ... /data/vries/gdb/f37/build/gdb/testsuite/temp/105856/can_compile_d-105856.d: \ error: module 'can_compile_d-105856' has non-identifier characters in \ filename, use module declaration instead ... The d compiler has a problem with the filename can_compile_d-105856.d, which contains the pid. The pid is added by gdb_simple_compile: ... set obj [standard_temp_file $name-[pid].$postfix] ... but it's unnecessary because standard_temp_file already uses the pid. Fix this by removing "[pid]" in all calls to standard_temp_file. Tested on x86_64-linux.
2023-03-27Automatic date update in version.inGDB Administrator1-1/+1
2023-03-26[gdb/testsuite] Introduce allow_dap_testsTom de Vries4-2/+19
Simon pointed out that with gdb.dap/*.exp and target board native-gdbserver, we run into problems. I see for each test-case: ... +++ run Traceback (most recent call last): File "startup.py", line 146, in exec_and_log output = gdb.execute(cmd, from_tty=True, to_string=True) gdb.error: Don't know how to run. Try "help target". ... Likewise with target board native-extended-gdbserver. Fix this by: - adding a new proc allow_dap_tests, - using it in all the gdb.dap tests, and - bailing out if GDBFLAGS/INTERNAL_GDBFLAGS contains "set auto-connect-native-target off". Tested on x86_64-linux. Reported-By: Simon Marchi <simon.marchi@efficios.com> Approved-By: Tom Tromey <tom@tromey.com>
2023-03-26Automatic date update in version.inGDB Administrator1-1/+1
2023-03-25Automatic date update in version.inGDB Administrator1-1/+1
2023-03-24Preserve name of range typesTom Tromey5-0/+104
The type-allocation patches introduced a small regression that was picked up by the AdaCore internal test suite. Previously, the name of a range type was preserved by resolve_dynamic_range, but now it is not. This patch changes this code to preserve the name. Reviewed-By: Bruno Larsen <blarsen@redhat.com>
2023-03-24Implement repl evaluation for DAPTom Tromey2-3/+26
The evaluate command supports a "context" parameter which tells the adapter the context in which an evaluation occurs. One of the supported values is "repl", which we took to mean evaluation of a gdb command. That is what this patch implements. Note that some gdb commands probably will not work correctly with the rest of the protocol. For example if the user types "continue", confusion may result. This patch requires the earlier patch to fix up scopes in DAP.
2023-03-24[gdb/symtab] Fix line number of static const class memberTom de Vries2-3/+4
Since commit 6d263fe46e0 ("Avoid bad breakpoints with --gc-sections"), there was a silent regression on openSUSE Leap 15.4 for test-case gdb.cp/m-static.exp, from: ... (gdb) info variable everywhere^M All variables matching regular expression "everywhere":^M ^M File /home/vries/tmp.local-remote-host-native/m-static.h:^M 8: const int gnu_obj_4::everywhere;^M (gdb) ... to: ... (gdb) info variable everywhere^M All variables matching regular expression "everywhere":^M ^M File /data/vries/gdb/src/gdb/testsuite/gdb.cp/m-static.h:^M 8: const int gnu_obj_4::everywhere;^M ^M File /data/vries/gdb/src/gdb/testsuite/gdb.cp/m-static1.cc:^M 8: const int gnu_obj_4::everywhere;^M (gdb) ... Another regression was found due to that commit, and it was fixed in commit 99d679e7b30 ("[gdb/symtab] Fix "file index out of range" complaint") by limiting the scope of the fix in the original commit. Fix this regression by yet further limiting the scope of that fix, making sure that this bit in dwarf_decode_lines is executed again for m-static1.cc: ... /* Make sure a symtab is created for every file, even files which contain only variables (i.e. no code with associated line numbers). */ ... Tested on x86_64-linux. PR symtab/30265 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30265