aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-05-02Automatic date update in version.inGDB Administrator1-1/+1
2023-05-01Document DAP 'launch' parameterTom Tromey1-0/+19
The Debugger Adapter Protocol defines a "launch" request but leaves the parameters up to the implementation: Since launching is debugger/runtime specific, the arguments for this request are not part of this specification. This patch adds some documentation for the parameter GDB currently defines. Note that I plan to add more parameters here, and perhaps there will be other extensions in time as well. Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-05-01gdb: remove ui_interp_infoSimon Marchi2-72/+30
I don't think that having struct ui_interp_info separated from struct ui is very useful. As of today, it looks like an unnecessary indirection layer. Move the contents of ui_interp_info directly into struct ui, and update all users. Change-Id: I817ba6e047dbcc4ba15b666af184b40bfed7e521
2023-05-01gdb: store interps in an intrusive_listSimon Marchi2-17/+9
Use intrusive_list, instead of hand-made linked list. Change-Id: Idc857b40dfa3e3c35671045898331cca2c928097
2023-05-01gdb: move struct ui and related things to ui.{c,h}Simon Marchi34-428/+512
I'd like to move some things so they become methods on struct ui. But first, I think that struct ui and the related things are big enough to deserve their own file, instead of being scattered through top.{c,h} and event-top.c. Change-Id: I15594269ace61fd76ef80a7b58f51ff3ab6979bc
2023-05-01Turn set_inferior_args_vector into method of inferiorTom Tromey4-11/+13
This patch turns set_inferior_args_vector into an overload of inferior::set_args. Regression tested on x86-64 Fedora 36.
2023-05-01Remove evaluate_typeTom Tromey8-17/+11
Like evaluate_expression, evaluate_type is also just a simple wrapper. Removing it makes the code a little nicer.
2023-05-01Remove evaluate_expressionTom Tromey18-52/+34
evaluate_expression is just a little wrapper for a method on expression. Removing it also removes a lot of ugly (IMO) calls to get().
2023-05-01Remove op_nameTom Tromey2-28/+17
op_name is only needed in a single place, so remove it and inline it there.
2023-05-01Fix crash in Rust expression parserTom Tromey2-2/+3
A user found that an array expression with just a single value (like "[23]") caused the Rust expression parser to crash. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30410
2023-05-01Replace field_is_static with a methodTom Tromey24-57/+55
This changes field_is_static to be a method on struct field, and updates all the callers. Most of this patch was written by script. Regression tested on x86-64 Fedora 36.
2023-05-01Automatic date update in version.inGDB Administrator1-1/+1
2023-04-30[gdb/tui] Fix TUI resizing for TERM=ansiTom de Vries5-10/+129
With TERM=ansi, when resizing a TUI window from LINES/COLUMNS 31/118 (maximized) to 20/78 (de-maximized), I get a garbled screen (that ^L doesn't fix) and a message: ... @@ resize done 0, size = 77x20 ... with the resulting width being 77 instead of the expected 78. [ The discrepancy also manifests in CLI, filed as PR30346. ] The discrepancy comes from tui_resize_all, where we ask readline for the screen size: ... rl_get_screen_size (&screenheight, &screenwidth); ... As it happens, when TERM is set to ansi, readline decides that the terminal cannot auto-wrap lines, and reserves one column to deal with that, and as a result reports back one less than the actual screen width: ... $ echo $COLUMNS 78 $ TERM=xterm gdb -ex "show width" -ex q Number of characters gdb thinks are in a line is 78. $ TERM=ansi gdb -ex "show width" -ex q Number of characters gdb thinks are in a line is 77. ... In tui_resize_all, we need the actual screen width, and using a screenwidth of one less than the actual value garbles the screen. This is currently not causing trouble in testing because we have a workaround in place in proc Term::resize. If we disable the workaround: ... - stty columns [expr {$_cols + 1}] < $::gdb_tty_name + stty columns $_cols < $::gdb_tty_name ... and dump the screen we get the same type of screen garbling: ... 0 +---------------------------------------+| 1 || 2 || 3 || ... Another way to reproduce the problem is using command "maint info screen". After starting gdb with TERM=ansi, entering TUI, and issuing the command, we get: ... Number of characters curses thinks are in a line is 78. ... and after maximizing and demaximizing the window we get: ... Number of characters curses thinks are in a line is 77. ... If we use TERM=xterm, we do get the expected 78. Fix this by: - detecting when readline will report back less than the actual screen width, - accordingly setting a new variable readline_hidden_cols, - using readline_hidden_cols in tui_resize_all to fix the resize problem, and - removing the workaround in Term::resize. The test-case gdb.tui/empty.exp serves as regression test. I've applied the same fix in tui_async_resize_screen, the new test-case gdb.tui/resize-2.exp serves as a regression test for that change. Without that fix, we have: ... FAIL: gdb.tui/resize-2.exp: again: gdb width 80 ... Tested on x86_64-linux. PR tui/30337 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30337
2023-04-30Automatic date update in version.inGDB Administrator1-1/+1
2023-04-29[gdb/testsuite] Fix gdb.base/readline.exp with stub-termcapTom de Vries1-22/+35
When doing a build which uses stub-termcap, we run into: ... (gdb) set width 7 <b) FAIL: gdb.base/readline.exp: set width 7 (timeout) ... Since readline can't detect very basic terminal support, it falls back on horizontal scrolling. Fix this by detecting the horizontal scrolling case, and skipping the subsequent test. Tested on x86_64-linux. PR testsuite/30400 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30400
2023-04-29gdb: Fix building with latest libc++Manoj Gupta15-15/+18
Latest libc++[1] causes transitive include to <locale> when <mutex> or <thread> header is included. This causes gdb to not build[2] since <locale> defines isupper/islower etc. functions that are explicitly macroed-out in safe-ctype.h to prevent their use. Use the suggestion from libc++ to include <locale> internally when building in C++ mode to avoid build errors. Use safe-gdb-ctype.h as the include instead of "safe-ctype.h" to keep this isolated to gdb since rest of binutils does not seem to use much C++. [1]: https://reviews.llvm.org/D144331 [2]: https://issuetracker.google.com/issues/277967395
2023-04-29[gdb/testsuite] Fix gdb.ada/excep_handle.exp for updated gdb_testTom de Vries1-12/+12
Test-case gdb.ada/excep_handle.exp fails since commit e2f620135d9 ("gdb/testsuite: change newline patterns used in gdb_test"): ... (gdb) continue^M Continuing.^M ^M Catchpoint 2, exception at 0x00000000004020b6 in foo () at foo.adb:26^M 26 when Constraint_Error =>^M (gdb) FAIL: gdb.ada/excep_handle.exp: continuing to first Constraint_Error \ exception handlers ... The output is supposed to be matched by: ... gdb_test "continue" \ "Continuing\.$eol$catchpoint_constraint_error_msg$eol.*" \ "continuing to first Constraint_Error exception handlers" ... but the $eol bit no longer matches due to the stricter matching introduced in aforementioned commit. Fix this by dropping the "$eol.*" bit. Tested on x86_64-linux. PR testsuite/30399 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30399
2023-04-29[gdb/build] Fix build without ncurses in maintenance_info_screenTom de Vries1-0/+4
With a build without ncurses we run into: ... src/gdb/utils.c: In function ‘void maintenance_info_screen(const char*, int)’: src/gdb/utils.c:1310:7: error: ‘COLS’ was not declared in this scope COLS); ^~~~ src/gdb/utils.c:1331:8: error: ‘LINES’ was not declared in this scope LINES); ^~~~~ ... Fix this by using HAVE_LIBCURSES. Tested on x86_64-linux. PR build/30391 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30391
2023-04-29[gdb/testsuite] Fix gdb.tui/main.exp without TUITom de Vries1-0/+2
With a build with --disable-tui, we get: ... (gdb) PASS: gdb.tui/main.exp: set interactive-mode off maint set tui-left-margin-verbose on^M Undefined maintenance set command: "tui-left-margin-verbose on". \ Try "help maintenance set".^M (gdb) FAIL: gdb.tui/main.exp: maint set tui-left-margin-verbose on ... Fix this by adding the missing "require allow_tui_tests". Tested on x86_64-linux.
2023-04-29Automatic date update in version.inGDB Administrator1-1/+1
2023-04-29gdb/mi: check thread exists when creating thread-specific b/pAndrew Burgess4-14/+67
I noticed the following behaviour: $ gdb -q -i=mi /tmp/hello.x =thread-group-added,id="i1" =cmd-param-changed,param="print pretty",value="on" ~"Reading symbols from /tmp/hello.x...\n" (gdb) -break-insert -p 99 main ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000401198",func="main",file="/tmp/hello.c",fullname="/tmp/hello.c",line="18",thread-groups=["i1"],thread="99",times="0",original-location="main"} (gdb) info breakpoints &"info breakpoints\n" ~"Num Type Disp Enb Address What\n" ~"1 breakpoint keep y 0x0000000000401198 in main at /tmp/hello.c:18\n" &"../../src/gdb/thread.c:1434: internal-error: print_thread_id: Assertion `thr != nullptr' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable." &"\n" &"----- Backtrace -----\n" &"Backtrace unavailable\n" &"---------------------\n" &"\nThis is a bug, please report it." &" For instructions, see:\n" &"<https://www.gnu.org/software/gdb/bugs/>.\n\n" Aborted (core dumped) What we see here is that when using the MI a user can create thread-specific breakpoints for non-existent threads. Then if we try to use the CLI 'info breakpoints' command GDB throws an assertion. The assert is a result of the print_thread_id call when trying to build the 'stop only in thread xx.yy' line; print_thread_id requires a valid thread_info pointer, which we can't have for a non-existent thread. In contrast, when using the CLI we see this behaviour: $ gdb -q /tmp/hello.x Reading symbols from /tmp/hello.x... (gdb) break main thread 99 Unknown thread 99. (gdb) The CLI doesn't allow a breakpoint to be created for a non-existent thread. So the 'info breakpoints' command is always fine. Interestingly, the MI -break-info command doesn't crash, this is because the MI uses global thread-ids, and so never calls print_thread_id. However, GDB does support using CLI and MI in parallel, so we need to solve this problem. One option would be to change the CLI behaviour to allow printing breakpoints for non-existent threads. This would preserve the current MI behaviour. The other option is to pull the MI into line with the CLI and prevent breakpoints being created for non-existent threads. This is good for consistency, but is a breaking change for the MI. In the end I figured that it was probably better to retain the consistent CLI behaviour, and just made the MI reject requests to place a breakpoint on a non-existent thread. The only test we had that depended on the old behaviour was gdb.mi/mi-thread-specific-bp.exp, which was added by me in commit: commit 2fd9a436c8d24eb0af85ccb3a2fbdf9a9c679a6c Date: Fri Feb 17 10:48:06 2023 +0000 gdb: don't duplicate 'thread' field in MI breakpoint output I certainly didn't intend for this test to rely on this feature of the MI, so I propose to update this test to only create breakpoints for threads that exist. Actually, I've added a new test that checks the MI rejects creating a breakpoint for a non-existent thread, and I've also extended the test to run with the separate MI/CLI UIs, and then tested 'info breakpoints' to ensure this command doesn't crash. I've extended the documentation of the `-p` flag to explain the constraints better. I have also added a NEWS entry just in case someone runs into this issue, at least then they'll know this change in behaviour was intentional. One thing that I did wonder about while writing this patch, is whether we should treat requests like this, on both the MI and CLI, as another form of pending breakpoint, something like: (gdb) break foo thread 9 Thread 9 does not exist. Make breakpoint pending on future thread creation? (y or [n]) y Breakpoint 1 (foo thread 9) pending. (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y <PENDING> foo thread 9 Don't know if folk think that would be a useful idea or not? Either way, I think that would be a separate patch from this one. Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-04-28gdb: make deprecated_show_value_hack staticAndrew Burgess2-7/+2
The deprecated_show_value_hack function is now only used inside cli-setshow.c, so lets make the function static to discourage its use anywhere else. There should be no user visible changes after this commit Reviewed-By: Tom Tromey <tom@tromey.com>
2023-04-28gdb: make set/show inferior-tty work with $_gdb_setting_strAndrew Burgess3-13/+40
Like the previous two commits, this commit fixes set/show inferior-tty to work with $_gdb_setting_str. Instead of using a scratch variable which is then pushed into the current inferior from a set callback, move to the API that allows for getters and setters, and store the value directly within the current inferior. Update an existing test to check the inferior-tty setting. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-04-28gdb: make set/show cwd work with $_gdb_setting_strAndrew Burgess2-10/+14
The previous commit fixed set/show args when used with $_gdb_setting_str, this commit fixes set/show cwd. Instead of using a scratch variable which is then pushed into the current inferior from a set callback, move to the API that allows for getters and setters, and store the value directly within the current inferior. Update the existing test to check the cwd setting.
2023-04-28gdb: make set/show args work with $_gdb_setting_strAndrew Burgess3-21/+142
I noticed that $_gdb_setting_str was not working with 'args', e.g.: $ gdb -q --args /tmp/hello.x arg1 arg2 arg3 Reading symbols from /tmp/hello.x... (gdb) show args Argument list to give program being debugged when it is started is "arg1 arg2 arg3". (gdb) print $_gdb_setting_str("args") $1 = "" This is because the 'args' setting is implemented using a scratch variable ('inferior_args_scratch') which is updated when the user does 'set args ...'. There is then a function 'set_args_command' which is responsible for copying the scratch area into the current inferior. However, when the user sets the arguments via the command line the scratch variable is not updated, instead the arguments are pushed straight into the current inferior. There is a second problem, when the current inferior changes the scratch area is not updated, which means that the value returned will only ever reflect the last call to 'set args ...' regardless of which inferior is currently selected. Luckily, the fix is pretty easy, set/show variables have an alternative API which requires we provide some getter and setter functions. With this done the scratch variable can be removed and the value returned will now always reflect the current inferior. While working on set/show args I also rewrote show_args_command to remove the use of deprecated_show_value_hack. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-04-28gdb: cleanup command creation in infcmd.cAndrew Burgess1-38/+31
In infcmd.c, in order to add command completion to some of the 'set' commands, we are currently creating the command, then looking up the command by calling lookup_cmd. This is no longer necessary, we already return the relevant cmd_list_element object when the set/show command is created, and we can use that to set the command completion callback. I don't know if there's actually any tests for completion of these commands, but I manually checked, and each command still appears to offer the expected filename completion. There should be no user visible changes after this commit. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-04-28gdb/record-full: disable range stepping when resuming threadsSimon Marchi1-0/+7
I see these failures, when running with the native-gdbserver of native-extended-gdbserver boards: Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.reverse/finish-reverse-next.exp ... FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 1 LEP from function body FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 2 at b = 5, from function body FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 1 GEP call from function body FAIL: gdb.reverse/finish-reverse-next.exp: reverse next 2 at b = 50 from function body Let's use this simpler program to illustrate the problem: int main() { int a = 362; a = a * 17; return a; } It compiles down to: int a = 362; 401689: c7 45 fc 6a 01 00 00 movl $0x16a,-0x4(%rbp) a = a * 17; 401690: 8b 55 fc mov -0x4(%rbp),%edx 401693: 89 d0 mov %edx,%eax 401695: c1 e0 04 shl $0x4,%eax 401698: 01 d0 add %edx,%eax 40169a: 89 45 fc mov %eax,-0x4(%rbp) return a; 40169d: 8b 45 fc mov -0x4(%rbp),%eax When single stepping these lines, debugging locally, while recording, these are the recorded instructions (basically one for each instruction shown above): (gdb) maintenance print record-instruction 0 4 bytes of memory at address 0x00007fffffffdc5c changed from: 6a 01 00 00 Register rip changed: (void (*)()) 0x40169a <main+21> (gdb) maintenance print record-instruction -1 Register rax changed: 5792 Register eflags changed: [ PF AF IF ] Register rip changed: (void (*)()) 0x401698 <main+19> (gdb) maintenance print record-instruction -2 Register rax changed: 362 Register eflags changed: [ PF ZF IF ] Register rip changed: (void (*)()) 0x401695 <main+16> (gdb) maintenance print record-instruction -3 Register rax changed: 4200069 Register rip changed: (void (*)()) 0x401693 <main+14> (gdb) maintenance print record-instruction -4 Register rdx changed: 140737488346696 Register rip changed: (void (*)()) 0x401690 <main+11> (gdb) maintenance print record-instruction -5 4 bytes of memory at address 0x00007fffffffdc5c changed from: 00 00 00 00 Register rip changed: (void (*)()) 0x401689 <main+4> (gdb) maintenance print record-instruction -6 Not enough recorded history But when debugging remotely: (gdb) maintenance print record-instruction 0 Register rdx changed: 140737488346728 Register rip changed: (void (*)()) 0x401690 <main+11> (gdb) maintenance print record-instruction -1 4 bytes of memory at address 0x00007fffffffdc7c changed from: 00 00 00 00 Register rip changed: (void (*)()) 0x401689 <main+4> (gdb) maintenance print record-instruction -2 Not enough recorded history In this list, we only have entries for the beginning of each line. This is because of the remote target's support for range stepping. The record-full layer can only record instructions when the underlying process target reports a stop. With range stepping, the remote target single-steps multiple instructions at a time, so the record-full target doesn't get to see and record them all. Fix this by making the record-full layer disable range-stepping before handing the resume request to the beneath layer, forcing the remote target to report stops for each instruction. Change-Id: Ia95ea62720bbcd0b6536a904360ffbf839eb823d
2023-04-28Allow strings with printf/evalKeith Seitz3-2/+43
PR 13098 explains that if a user attempts to use a string with either `printf' (or `eval'), gdb returns an error (inferior not running): (gdb) printf "%s\n", "hello" evaluation of this expression requires the target program to be active However, the parser can certainly handle this case: (gdb) p "hello" $1 = "hello" This discrepancy occurs because printf_c_string does not handle this specific case. The passed-in value that we are attempting to print as a string is TYPE_CODE_ARRAY but it's lval type is not_lval. printf_c_string will only attempt to print a string from the value's contents when !TYPE_CODE_PTR, lval is lval_internalvar, and the value's type is considered a string type: if (value->type ()->code () != TYPE_CODE_PTR && value->lval () == lval_internalvar && c_is_string_type_p (value->type ())) { ... } Otherwise, it attempts to read the value of the string from the target's memory (which is what actually generates the "evaluation of this ..." error message).
2023-04-28Move find_minimal_symbol_address to minsyms.cTom Tromey2-80/+78
I found find_minimal_symbol_address in parse.c, but it seems to me that it belongs in minsyms.c. Reviewed-By: Andrew Burgess <aburgess@redhat.com>
2023-04-28Do not change type in get_discrete_low_boundTom Tromey1-4/+0
get_discrete_low_bound has this code: /* Set unsigned indicator if warranted. */ if (low >= 0) type->set_is_unsigned (true); It's bad to modify a type in a getter like this, so this patch removes this code. FWIW I looked and this code has been there since at least 1999 (it was in the initial sourceware import). Types in general would benefit from const-ification, which would probably reveal more code like this, but I haven't attempted that. Regression tested on x86-64 Fedora 36. Reviewed-by: Kevin Buettner <kevinb@redhat.com>
2023-04-28Remove @var from @defun in Python documentationTom Tromey1-25/+25
Eli pointed out that @var isn't needed in @defun in Texinfo. This patch removes the cases I found in python.texi. I also renamed some variables in one spot, because "-" isn't valid in a Python variable name.
2023-04-28gdb/testsuite: additional test fixes after gdb_test changesAndrew Burgess8-123/+102
After this commit: commit e2f620135d92f7cd670af4e524fffec7ac307666 Date: Thu Mar 30 13:26:25 2023 +0100 gdb/testsuite: change newline patterns used in gdb_test There were some regressions in gdb.trace/*.exp tests when run with the native-gdbserver board. This commit fixes these regressions. All the problems are caused by unnecessary trailing newline characters included in the patterns passed to gdb_test. After the above commit the testsuite is stricter when matching trailing newlines, and so the additional trailing newline characters are now causing the test to fail. Fix by removing all the excess trailing newline characters. In some cases this cleanup means we should use gdb_test_no_output, I've done that where appropriate. In a couple of other places I've made use of multi_line to better build the expected output pattern.
2023-04-28ld: Use run_cc_link_tests for PR ld/26391 testsH.J. Lu1-11/+4
Use run_cc_link_tests for PR ld/26391 tests to compile PR ld/26391 tests in C. PR ld/30002 * testsuite/ld-elf/elf.exp: Use run_cc_link_tests for PR ld/26391 tests.
2023-04-28Fix a typo in gdb.texinfo.Eli Zaretskii1-1/+1
2023-04-28RISC-V: Enable x0 base relaxation for relax_pc even if --no-relax-gp.Nelson Chu1-2/+6
Let --no-relax-gp only disable the gp relaxation for lui and pcrel relaxations, since x0 base and gp relaxations are different optimizations in fact, but just use the same function to handle. bfd/ * elfnn-riscv.c (_bfd_riscv_relax_pc): Like _bfd_riscv_relax_lui, set gp to zero when --no-relax-gp, then we should still keep the x0 base relaxation. (_bfd_riscv_relax_section): Enable _bfd_riscv_relax_pc when --no-relax-gp, we will disable the gp relaxation in the _bfd_riscv_relax_pc.
2023-04-28RISC-V: Relax R_RISCV_[PCREL_]LO12_I/S to R_RISCV_GPREL_I/S for undefined weak.Nelson Chu1-49/+6
bfd/ *elfnn-riscv.c (_bfd_riscv_relax_lui): For undefined weak symbol, just relax the R_RISCV_LO12_I/S to R_RISCV_GPREL_I/S, and then don't update the rs1 to zero until relocate_section. (_bfd_riscv_relax_pc): Likewise, but for R_RISCV_PCREL_LO12_I/S.
2023-04-28x86: limit data passed to i386_dis_printf()Jan Beulich1-22/+21
The function doesn't use "ins" for other than retrieving "info". Remove a thus pointless level of indirection.
2023-04-28x86: limit data passed to prefix_name()Jan Beulich1-8/+13
Make apparent that neither what "ins" points to nor, in particular, that "ins->info->private_data" is actually used in the function.
2023-04-28x86/Intel: reduce ELF/PE conditional scope in x86_cons()Jan Beulich1-6/+4
All the Intel syntax related state adjustments apply independent of target or object format.
2023-04-28gas: move shift count checkJan Beulich1-14/+14
... out of mainline code, grouping together the two case labels. This then also make more obvious that the comment there applies to both forms of shifts.
2023-04-28x86: rework AMX control insn disassemblyJan Beulich1-107/+50
Consistently do 64-bit first, VEX.L second, VEX.W third, ModR/M fourth, and only then prefix, resulting in fewer table entries. Note that in the course of the re-work - TILEZERO has a previously missing decode step through rm_table[] added, - a wrong M_0 suffix for TILEZERO is also corrected to be M_1 (now an infix).
2023-04-28x86: rework AMX multiplication insn disassemblyJan Beulich2-111/+43
Consistently do 64-bit first, ModR/M second, VEX.L third, VEX.W fourth, and prefix last, resulting in fewer table entries. Note that in the course of the re-work wrong M_0 suffixes are also corrected to be M_1 (partly infixes now). Since it ended up confusing while testing the change, also adjust the test name in x86-64-amx-bad.d (to be distinct from x86-64-amx.d's).
2023-04-28Re: Keeping track of rs6000-coff archive element pointersAlan Modra4-16/+33
Commit de7b90610e9e left a hole in the element checking, explained by the comment added to _bfd_xcoff_openr_next_archived_file. While fixing this, tidy some types used to hold unsigned values so that casts are not needed to avoid signed/unsigned comparison warnings. Also tidy a few things in xcoff.h. bfd/ * coff-rs6000.c (_bfd_xcoff_openr_next_archived_file): Check that we aren't pointing back at the last element. Make filestart a ufile_ptr. Update for xcoff_artdata change. (_bfd_strntol, _bfd_strntoll): Return unsigned values. (_bfd_xcoff_slurp_armap): Make off a ufile_ptr. (add_ranges): Update for xcoff_artdata change. * libbfd-in.h (struct artdata): Make first_file_filepos a ufile_ptr. * libbfd.h: Regenerate. include/ * coff/xcoff.h (struct xcoff_artdata): Replace min_elt with ar_hdr_size. (xcoff_big_format_p): In the !SMALL_ARCHIVE case return true for anything but a small archive.
2023-04-28Remove deprecated bfd_readAlan Modra3-64/+0
20+ years is long enough to warn. * bfd-in.h (bfd_read, bfd_write): Don't define (_bfd_warn_deprecated): Don't declare. * bfd-in2.h: Regenerate. * libbfd.c (_bfd_warn_deprecated): Delete.
2023-04-28Make bfd_byte an int8_t, flagword a uint32_tAlan Modra2-12/+12
* bfd-in.h (bfd_byte): Typedef as int8_t. (flagword): Typedef as uint32_t. (bfd_vma, bfd_signed_vma, bfd_size_type, symvalue): Use stdint types in !BFD64 case. * bfd-in2.h: Regenerate.
2023-04-28Automatic date update in version.inGDB Administrator1-1/+1
2023-04-27gas: bpf: fix tests for pseudo-c syntaxJose E. Marchesi36-392/+489
This patch fixes the GAS BPF testsuite so the tests for pseudo-c syntax are actually executed. 2023-04-27 Jose E. Marchesi <jose.marchesi@oracle.com> * testsuite/gas/bpf/mem.dump: New file. * testsuite/gas/bpf/mem-pseudoc.d: Likewise. * testsuite/gas/bpf/mem.d: #dump mem.dump. * testsuite/gas/bpf/lddw.dump: New file. * testsuite/gas/bpf/lddw-pseudoc.d: Likewise. * testsuite/gas/bpf/lddw.d: #dump lddw.dump. * testsuite/gas/bpf/jump.dump: New file. * testsuite/gas/bpf/jump-pseudoc.d: Likewise * testsuite/gas/bpf/jump.d: #dump jump.dump. * testsuite/gas/bpf/jump32.dump: New file. * testsuite/gas/bpf/jump32-pseudoc.d: Likewise. * testsuite/gas/bpf/jump32.d: #dump jump32.dump. * testsuite/gas/bpf/lddw-be.dump: New file. * testsuite/gas/bpf/lddw-be-pseudoc.d: Likewise. * testsuite/gas/bpf/lddw-be.d: #dump lddw-be.dump. * testsuite/gas/bpf/indcall-1.dump: New file. * testsuite/gas/bpf/indcall-1-pseudoc.d: Likewise. * testsuite/gas/bpf/indcall-1.d: #dump indcall-1.dump. * testsuite/gas/bpf/indcall-1-pseudoc.s (main): Fix lddw instruction. * testsuite/gas/bpf/atomic.dump: New file. * testsuite/gas/bpf/atomic-pseudoc.d: Likewise. * testsuite/gas/bpf/atomic.d: #dump atomic.dump. * testsuite/gas/bpf/alu32.dump: New file. * testsuite/gas/bpf/alu32-pseudoc.d: Likewise. * testsuite/gas/bpf/alu32.d: #dump alu32.dump. * testsuite/gas/bpf/alu.dump: New file. * testsuite/gas/bpf/alu-pseudoc.d: Likewise. * testsuite/gas/bpf/alu.d: #dump alu.dump. * testsuite/gas/bpf/alu-be.dump: New file. * testsuite/gas/bpf/alu-be-pseudoc.d: Likewise. * testsuite/gas/bpf/alu-be.d: #dump alu-be.dump. * testsuite/gas/bpf/alu32-be-pseudoc.d: New file. * testsuite/gas/bpf/alu32-be-dump: Likewise. * testsuite/gas/bpf/alu32-be.d: #dump alu32-be-dump. * testsuite/gas/bpf/bpf.exp: Run *-pseudoc tests.
2023-04-27Avoid some compiler warnings in gdb.adaTom Tromey2-4/+4
Running gdb.ada/verylong.exp shows a warning from the Ada compiler: prog.adb:16:11: warning: file name does not match unit name, should be "main.adb" [enabled by default] This patch fixes the problem, and another similar one in unchecked_union.exp.
2023-04-27Fix PR30358, performance with --sort-sectionMichael Matz1-31/+61
since af31506c we only use the binary tree when section sorting is required. While its unbalanced and hence can degrade to a linear list it should otherwise have been equivalent to the old code relying on insertion sort. Unfortunately it was not. The old code directly used lang_add_section to populate the sorted list, the new code first populates the tree and only then does lang_add_section on the sorted result. In the testcase we have very many linkonce section groups, and hence lang_add_section won't actually insert anything for most of them. That limited the to-be-sorted list length previously. The tree-sorting code OTOH first created a tree of all candidates sections, including those that wouldn't be inserted by lang_add_section, hence increasing the size of the sorting problem. In the testcase the chain length went from about 1500 to 106000, and in the degenerated case (as in the testcase) that goes in quadratically. This splits out most of the early-out code from lang_add_section to its own function and uses the latter to avoid inserting into the tree. This refactoring slightly changes the order of early-out tests (the ones based on section flags is now done last, and only in lang_add_section). The new function is not a pure predicate: it can give warnings and it might change output_section, like the old early-out code did. I have also added a skip-warning case in the first discard case, whose non-existence seemed to have been an oversight. PR 30358 * ldlang.c (wont_add_section_p): Split out from ... (lang_add_section): ... here. (output_section_callback_sort): Use wont_add_section_p to not always add sections to the sort tree.
2023-04-27gdb/doc: extend the documentation of the jump commandAndrew Burgess1-0/+8
This commit addresses PR gdb/7946. While checking for bugs relating to the jump command I noticed a long standing bug that points out a deficiency with GDB's documentation of the jump command. The bug points out that 'jump 0x...' is not always the same as 'set $pc = 0x...' and then 'continue'. Writing directly to the $pc register does not update any auxiliary state, e.g. $npc on SPARC, while using 'jump' does. It felt like this would be an easy issue to address by adding a paragraph to the docs, so I took a stab at writing something suitable. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7946 Approved-By: Eli Zaretskii <eliz@gnu.org>