aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-05-03Fix gdb.threads/access-mem-running-thread-exit.exp w/ native-extended-gdbserverPedro Alves1-1/+29
When testing gdb.threads/access-mem-running-thread-exit.exp with --target_board=native-extended-gdbserver, we get: Running gdb.threads/access-mem-running-thread-exit.exp ... FAIL: gdb.threads/access-mem-running-thread-exit.exp: non-stop: second inferior: runto: run to main WARNING: Timed out waiting for EOF in server after monitor exit === gdb Summary === # of expected passes 3 # of unexpected failures 1 # of unsupported tests 1 The problem is that the testcase spawns a second inferior with -no-connection, and then runto_main does "run", which fails like so: (gdb) run Don't know how to run. Try "help target". (gdb) FAIL: gdb.threads/access-mem-running-thread-exit.exp: non-stop: second inferior: runto: run to main That "run" above failed because native-extended-gdbserver forces "set auto-connect-native-target off", to prevent testcases from mistakenly running programs with the native target, which would exactly be the case here. Fix this by letting the second inferior share the first inferior's connection everywhere except on targets that do reload on run (e.g., --target_board=native-gdbserver). Change-Id: Ib57105a238cbc69c57220e71261219fa55d329ed
2022-05-03gdb: add some additional thread status debug outputAndrew Burgess3-11/+37
While working on this patch: https://sourceware.org/pipermail/gdb-patches/2022-January/185109.html I found it really useful to print the executing/resumed status of all threads (or all threads in a particular inferior) at various places (e.g. when a new inferior is started, when GDB attaches, etc). This debug was originally part of the above patch, but I wanted to rewrite this as a separate patch and move the code into a new function in infrun.h, which is what this patch does. Unless 'set debug infrun on' is in effect, then there should be no user visible changes after this commit.
2022-05-03Add a linker warning when creating potentially dangerous executable ↵Nick Clifton21-124/+413
segments. Add tests, options to disabke and configure switches to choose defaults.
2022-05-03Fix potential arithmetic overflow in the linker's plugin handling code.Nick Clifton2-1/+11
PR 29101 * libdep_plugin.c (get_libdeps): Check for overflow when computing amount of memory to allocate.
2022-05-03objdump: fix styled printing of addressesAndrew Burgess1-4/+5
Previous work to add styled disassembler output missed a case in objdump_print_addr, which is fixed in this commit.
2022-05-03gdb/testsuite: small cleanup in mi-break-qualified.expAndrew Burgess1-1/+1
It is not necessary to pass an empty string to mi_gdb_start, passing the empty string is equivalent to passing no arguments, which is what we do everywhere else (that we don't need to specify an actual argument). The only place we use 'mi_gdb_start ""' is in gdb.mi/mi-break-qualified.exp, so in this commit I just replace that with a call to 'mi_gdb_start' - just for consistency. There should be no change in what is tested after this commit.
2022-05-03gdb/testsuite: change mi_gdb_start to take a list of flagsAndrew Burgess2-9/+17
After this previous commit I was thinking about the API of mi_gdb_start. I felt that the idea of passing flags as separate arguments and using 'args' to gather these into a list, though clever, was not an intuitive API. In this commit I modify mi_gdb_start so that it expects a single argument, which should be a list of flags. Thus, where we previously would have said: mi_gdb_start separate-mi-tty separate-inferior-tty We would now say: mi_gdb_start { separate-mi-tty separate-inferior-tty } However, it turns out we never actually call mi_gdb_start passing two arguments in this way at all. We do in some places do this: mi_gdb_start separate-inferior-tty But that's fine, a single string like this works equally well as a single item list, so this will not need updating. There is also one place where we do this: eval mi_gdb_start $start_ops where $start_ops is a list that might contains 0, 1, or 2 items. The eval here is used to expand the $start_ops list so mi_gdb_start sees the list contents as separate arguments. In this case we just need to drop the use of eval. I think that the new API is more intuitive, but others might disagree, in which case I can drop this change. There should be no change in what is tested after this commit.
2022-05-03gdb/testsuite: fix mi-exec-run.exp with native-extended-gdbserver boardAndrew Burgess1-1/+1
When running with the native-extended-gdbserver board, I currently see one failure in gdb.mi/mi-exec-run.exp: FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: force-fail=0: breakpoint hit reported on console (timeout) In this test the MI interface should be started in a separate tty, which means we should have a CLI tty and an MI tty, however, this is not happening. Instead GDB is just started in MI mode and there is no CLI tty. The test script tries to switch between the CLI an MI terminals and look for some expected output on each, however, as there is no CLI terminal the expected output never arrives, and the test times out. It turns out that this is not a GDB problem, rather, this is an issue with argument passing within the test script. The proc default_mi_gdb_start expects to take a set of flags (strings) as arguments, each of flag is expected to be a separate argument. The default_mi_gdb_start proc collects all its arguments into a list using the special 'args' parameter name, and then iterates over this list to see which flags were passed. In mi_gdb_start, which forwards to default_mi_gdb_start, the arguments are also gathered into the 'args' parameter list, but are then expanded back to be separate arguments using the eval trick, i.e.: proc mi_gdb_start { args } { return [eval default_mi_gdb_start $args] } This ensures that when we arrive in default_mi_gdb_start each flag is a separate argument, rather than appearing as a single list containing all arguments. When using the native-extended-gdbserver board however, the file boards/native-extended-gdbserver.exp is loaded, and this file replaces the default mi_gdb_start with its own version. This new mi_gdb_start also gathers the arguments into an 'args' list, but forgets to expand the arguments out using the eval trick. As a result, when using the native-extended-gdbserver board, by the time we get to default_mi_gdb_start, we end up with the args list containing a single item, which is a list containing all the arguments the user passed. What this means is that if the user passes two arguments, then, in default_mi_gdb_start, instead of seeing two separate arguments, we see a single argument made by concatenating the two arguments together. The only place this is a problem is in the test mi-exec-run.exp, which (as far as I can see) is the only test where we might try to pass both arguments at the same time. Currently we think we passed both arguments to mi_gdb_start, but mi_gdb_start behaves as if no arguments were passed. This commit fixes the problem by making use of the eval trick within the native-extended-gdbserver version of mi_gdb_start. After this, the FAIL listed at the top of this message is resolved.
2022-05-03gdb: fix failures in gdb.mi/mi-exec-run.exp with native-extended-gdbserverAndrew Burgess1-1/+18
When running the gdb.mi/mi-exec-run.exp test using the native-extended-gdbserver I see failures like this: FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=main: mi=main: force-fail=1: run failure detected FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=main: mi=separate: force-fail=1: run failure detected FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: force-fail=1: run failure detected There's a race condition here, so you might see a slightly different set of failures, but I always see some from the 'run failure detected' test. NOTE: I also see an additional test failure: FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=separate: mi=separate: force-fail=0: breakpoint hit reported on console (timeout) but that is a completely different issue, and is not being addressed in this commit. The problem for the 'run failure detected' test is that we end up in gdb_expect looking for output from two spawn-ids, one from gdbserver, and one from gdb. We're looking for one output pattern from each spawn-id, and for the test to pass we need to see both patterns. Now, if gdb exits then this is a test failure (this would indicate gdb crashing, which is bad), so we have an eof pattern associated with the gdb spawn-id. However, in this particular test we expect gdbserver to fail to execute the binary (the test binary is set non-executable), and so we get an error message from gdbserver (which matches the pattern), and then gdbserver exits, this is expected. The problem is that after spotting the pattern from gdbserver, we often see the eof from gdbserver before we see the pattern from gdb. If this happens then we drop out of the gdb_expect without ever seeing the pattern from gdb, and fail the test. In this commit, I place the spawn-id of gdbserver into a global variable, and then use this global variable as the -i option within the gdb_expect. Now, once we have seen the expected pattern on the gdbserver spawn-id, the global variable is cleared. After this the gdb_expect no longer checks the gdbserver spawn-id for additional output, and so never sees the eof event. This leaves the gdb_expect running, which allows the pattern from gdb to be seen, and for the test to pass. I now see no failures relating to 'run failure detected'.
2022-05-03Automatic date update in version.inGDB Administrator1-1/+1
2022-05-02[gdb/testsuite] Fix gdb.cp/align.exp with gcc 12.1 / 11.3Tom de Vries1-11/+14
Starting with gcc 12.1 / gcc 11.3, for test-case gdb.cp/align.exp we run into: ... align.cc:29:23: error: invalid application of 'alignof' to a void type^M 29 | unsigned a_void = alignof (void);^M | ^~~~~~~~~~~~~~^M ... Fix this by using __alignof__ instead. Tested on x86_64-linux, with gcc 7.5.0, gcc 12.1 and clang 12.0.1.
2022-05-02gdb/debuginfod: Whitespace-only URL should disable debuginfodAaron Merey2-7/+17
Currently debuginfod is disabled when the string of server URLs is unset or set to be the empty string (via the $DEBUGINFOD_URLS environment variable or the 'set debuginfod urls' gdb command). Extend this functionality so that a whitespace-only URL also disables debuginfod. Modify a testcase to verify that a whitespace-only URL disables debuginfod.
2022-05-02gdb: remove type_wanted parameter from a few functionsSimon Marchi2-18/+11
The type_wanted value, passed down to the create_sals_from_location callback, is never used. Remove it. Change-Id: Ic363ee13f6af593a3e875ff7fe46de130cdc190c
2022-05-02gnulib: update to bd11400942d6Simon Marchi9-10/+26
Update the gnulib import to fixes these issues: - GDB build with clang + glibc < 2.33. https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=d6a07b4dc21b3118727743142c678858df442853 https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00072.html With glibc < 2.33, gnulib (since relatively recently) enables a replacement for free (see gnulib/import/m4/free.m4). In that path, clang shows this error: make[2]: Entering directory '/home/smarchi/build/binutils-gdb-clang/gdbsupport' CXX agent.o In file included from /home/smarchi/src/binutils-gdb/gdbsupport/agent.cc:20: In file included from /home/smarchi/src/binutils-gdb/gdbsupport/common-defs.h:95: ../gnulib/import/string.h:636:19: error: exception specification in declaration does not match previous declaration _GL_EXTERN_C void free (void *) throw (); ^ ../gnulib/import/stdlib.h:737:17: note: expanded from macro 'free' # define free rpl_free ^ ../gnulib/import/stdlib.h:739:1: note: previous declaration is here _GL_FUNCDECL_RPL (free, void, (void *ptr)); ^ ../gnulib/import/sys/select.h:251:23: note: expanded from macro '_GL_FUNCDECL_RPL' _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) ^ <scratch space>:139:1: note: expanded from here rpl_free ^ The gnulib commit mentioned fixes the exception specification of `free`. - GDB build on RHEL 7: CC libgnu_a-openat-proc.o In file included from /usr/include/string.h:633, from ./string.h:41, from ../../../binutils-gdb/gnulib/import/openat-proc.c:30: ./string.h:1105:1: error: expected identifier or '(' before '__extension__' 1105 | _GL_FUNCDECL_SYS (strndup, char *, | ^~~~~~~~~~~~~~~~ https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=84863a1c4dc8cca8fb0f6f670f67779cdd2d543b https://lists.gnu.org/archive/html/bug-gnulib/2022-04/msg00075.html Change-Id: Ibd51302feece6f385d0c53e0d08921b5d95e2776
2022-05-02Fix Ada catchpoint regressionTom Tromey1-1/+1
The breakpoint C++-ification series introduced a regression for Ada catchpoints. Specifically, commit 2b5ab5b8 ("Convert base breakpoints to vtable ops") caused these to start failing. I didn't notice this because testing Ada using a Linux distro compiler requires installing the GNAT debuginfo, which I hadn't done. This patch fixes the problem. I'm checking it in.
2022-05-02Automatic date update in version.inGDB Administrator1-1/+1
2022-05-01[gdb/testsuite] Fix gdb.multi/attach-no-multi-process.exp with check-readmoreTom de Vries1-3/+6
When running test-case gdb.multi/attach-no-multi-process.exp with check-readmore, I get: ... (gdb) attach 13411^M Attaching to Remote target^M No unwaited-for children left.^M (gdb) Reading symbols from attach-no-multi-process...^M Reading symbols from /lib64/libm.so.6...^M (No debugging symbols found in /lib64/libm.so.6)^M Reading symbols from /lib64/libc.so.6...^M (No debugging symbols found in /lib64/libc.so.6)^M Reading symbols from /lib64/ld-linux-x86-64.so.2...^M (No debugging symbols found in /lib64/ld-linux-x86-64.so.2)^M 0x00007f5df1fffc8a in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6^M FAIL: gdb.multi/attach-no-multi-process.exp: target_non_stop=off: \ attach to the program via remote (timeout) ... The problem is that the attach output is matched using gdb_test, which uses the '$gdb_prompt $' regexp, and this does not handle the case that '(gdb) ' is not the last available output. Fix this by using a gdb_test_multiple instead with a '$gdb_prompt ' regexp, so without the '$' anchor. Tested on x86_64-linux with native, check-read1 and check-readmore.
2022-05-01Automatic date update in version.inGDB Administrator1-1/+1
2022-04-30opcodes: don't assume ELF in riscv, csky, rl78, mep disassemblersThomas Hebb5-28/+30
Currently, the get_disassembler() implementations for riscv, csky, and rl78--and mep_print_insn() for mep--access ELF variants of union fields without first checking that the bfd actually represents an ELF. This causes undefined behavior and crashes when disassembling non-ELF files (the "binary" BFD, for example). Fix that.
2022-04-30Automatic date update in version.inGDB Administrator1-1/+1
2022-04-29Remove create_breakpoints_sal_defaultTom Tromey1-37/+12
create_breakpoints_sal_default is just a simple wrapper, so remove it.
2022-04-29Remove allocate_bp_locationTom Tromey1-15/+5
allocate_bp_location is just a small wrapper for a method call, so inline it everywhere.
2022-04-29Constify breakpoint_opsTom Tromey2-5/+5
Now that all breakpoint_ops are statically initialized, they can all be made const.
2022-04-29Remove breakpoint ops initializationTom Tromey2-41/+31
initialize_breakpoint_ops does not do much any more, so remove it in favor of statically-initialize objects.
2022-04-29Remove vtable_breakpoint_opsTom Tromey4-67/+34
There's no need to have vtable_breakpoint_ops any more, so remove it in favor of base_breakpoint_ops.
2022-04-29Remove most fields from breakpoint_opsTom Tromey3-304/+30
At this point, all implementations of breakpoints use the vtable. So, we can now remove most function pointers from breakpoint_ops and switch to using methods directly in the callers. Only the two "static virtual" methods remain in breakpoint_ops.
2022-04-29Remove breakpoint_ops from init_catchpointTom Tromey8-17/+11
init_catchpoint is only ever passed a single breakpoint_ops pointer, so remove the parameter.
2022-04-29Remove breakpoint_ops from init_ada_exception_breakpointTom Tromey3-4/+2
init_ada_exception_breakpoint is only ever passed a single breakpoint_ops structure, so remove the parameter.
2022-04-29Merge probe and ordinary tracepointsTom Tromey1-10/+3
Right now, probe tracepoints are handled by a separate ops object. However, they differ only in a small way from ordinary tracepoints, and furthermore can be distinguished by their event location. This patch merges the two cases, just as was done for breakpoints.
2022-04-29Merge probe and ordinary breakpointsTom Tromey1-32/+26
Right now, probe breakpoints are handled by a separate ops object. However, they differ only in a small way from ordinary breakpoints, and furthermore can be distinguished by their "probe" object. This patch merges the two cases. This avoids having to introduce a new bp_ constant (which can be quite subtle to do correctly) and a new subclass.
2022-04-29Remove bkpt_base_breakpoint_opsTom Tromey1-11/+0
An earlier patch removed the last use of bkpt_base_breakpoint_ops, so remove the object entirely.
2022-04-29Convert static marker tracepoints to vtable opsTom Tromey1-10/+18
This converts static marker tracepoints to use vtable_breakpoint_ops.
2022-04-29Add bp_static_marker_tracepointTom Tromey3-10/+27
Because the actual construction of a breakpoint is buried deep in create_breakpoint, at present it's necessary to have a new bp_ enumerator constant any time a new subclass is needed. Static marker tracepoints are one such case, so this patch introduces bp_static_marker_tracepoint and updates various spots to recognize it.
2022-04-29Convert ranged breakpoints to vtable opsTom Tromey1-66/+60
This converts ranged breakpoints to use vtable_breakpoint_ops. This requires introducing a new ranged_breakpoint type, but this is relatively simple because ranged breakpoints can only be created by break_range_command.
2022-04-29Convert dprintf to vtable opsTom Tromey3-36/+30
This converts dprintf to use vtable_breakpoint_ops.
2022-04-29Convert Ada catchpoints to vtable opsTom Tromey1-91/+65
This converts Ada catchpoints to use vtable_breakpoint_ops.
2022-04-29Convert ordinary breakpoints to vtable opsTom Tromey5-59/+45
This converts "ordinary" breakpoint to use vtable_breakpoint_ops. Recall that an ordinary breakpoint is both the kind normally created by users, and also a base class used by other classes.
2022-04-29Change inheritance of dprintfTom Tromey1-5/+2
The dprintf breakpoint ops is mostly a copy of bpkt_breakpoint_ops, except it's written out explicitly -- and, importantly, there's nothing that bpkt_breakpoint_ops overrides that dprintf does not. This changes dprintf to simply inherit directly, and updates struct dprintf_breakpoint to reflect the change as well.
2022-04-29Convert momentary breakpoints to vtable opsTom Tromey1-26/+19
This converts momentary breakpoints to use vtable_breakpoint_ops.
2022-04-29Convert internal breakpoints to vtable opsTom Tromey1-36/+25
This converts internal breakpoints to use vtable_breakpoint_ops.
2022-04-29Convert break-catch-throw to vtable opsTom Tromey1-85/+53
This converts break-catch-throw.c to use vtable_breakpoint_ops.
2022-04-29Convert base breakpoints to vtable opsTom Tromey3-32/+36
This converts base breakpoints to use vtable_breakpoint_ops.
2022-04-29Add some new subclasses of breakpointTom Tromey2-13/+77
This adds a few new subclasses of breakpoint. The inheritance hierarchy is chosen to reflect what's already present in initialize_breakpoint_ops -- it mirrors the way that the _ops structures are filled in. This patch also changes new_breakpoint_from_type to create the correct sublcass based on bptype. This is important due to the somewhat inverted way in which create_breakpoint works; and in particular later patches will change some of these entries.
2022-04-29Convert tracepoints to vtable opsTom Tromey3-65/+56
This converts tracepoints to use vtable_breakpoint_ops.
2022-04-29Convert watchpoints to vtable opsTom Tromey2-164/+132
This converts watchpoints and masked watchpoints. to use vtable_breakpoint_ops. For masked watchpoints, a new subclass must be introduced, and watch_command_1 is changed to create one.
2022-04-29Convert break-catch-load to vtable opsTom Tromey1-74/+52
This converts break-catch-load.c to use vtable_breakpoint_ops.
2022-04-29Convert break-catch-fork to vtable opsTom Tromey1-86/+56
This converts break-catch-fork.c to use vtable_breakpoint_ops.
2022-04-29Convert break-catch-exec to vtable opsTom Tromey1-57/+42
This converts break-catch-exec.c to use vtable_breakpoint_ops.
2022-04-29Convert break-catch-syscall to vtable opsTom Tromey1-93/+64
This converts break-catch-syscall.c to use vtable_breakpoint_ops.
2022-04-29Convert break-catch-sig to use vtable opsTom Tromey1-89/+61
This converts break-catch-sig.c to use vtable_breakpoint_ops.