aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-02-09gdb: add program_space parameter to disable_breakpoints_in_shlibsSimon Marchi4-7/+9
Make the current_program_space reference bubble up one level. Change-Id: Ide917aa306bff1872d961244901d79f65d2da62e Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-09gdb: add inferior parameter to breakpoint_init_inferiorSimon Marchi5-26/+24
By inspection, I believe that breakpoint_init_inferior doesn't call anything that relies on the current program space or inferior. So, add an inferior parameter, to make the current inferior / program space references bubble up one level. Change-Id: Ib07b7a6d360e324f6ae1aa502dd314b8cce421b7 Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-09gdb: add program_space parameter to mark_breakpoints_outSimon Marchi4-8/+9
Make the current_program_space reference bubble up one level. Change-Id: Idc8ed78d23bf3bb2969f6963d8cc049f26901c29 Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-09Fix crash in aarch64-linux gdbserverPedro Alves1-6/+15
Since commit 393a6b5947d0 ("Thread options & clone events (Linux GDBserver)"), aarch64-linux gdbserver crashes when the inferior vforks. This happens in aarch64_get_debug_reg_state: struct process_info *proc = find_process_pid (pid); return &proc->priv->arch_private->debug_reg_state; Here, find_process_pid returns nullptr -- the new inferior hasn't yet been created in linux_process_target::handle_extended_wait. This patch fixes the problem by having linux_process_target::handle_extended_wait create the child process earlier, before the child LWP is created. This is what the function did before it was reorganized by the commit referred above. Change-Id: Ib8b3a2e6048c3ad2b91a92ea4430da507db03c50 Co-Authored-By: Tom Tromey <tromey@adacore.com>
2024-02-09x86/APX: with REX2 map 1 doesn't "chain" to maps 2 or 3Jan Beulich1-7/+5
Don't wander into three_byte_table[] when REX2 is present. While there also eliminate related confusion when accessing dis386_twobyte[]: There's nothing 3-byte-ish involved there. Dropping the odd variable gets things better in sync with 1-byte handling as well.
2024-02-09x86/APX: V{BROADCAST,EXTRACT,INSERT}{F,I}128 can also be expressedJan Beulich5-201/+303
Interestingly unlike VROUND{P,S}{S,D} and VPERM{F,I}128 they weren't even present in the x86-64-apx-egpr-inval testcase, hence why I overlooked that these can actually be encoded, (again) using suitable AVX512 counterparts. While there also "modernize" the adjacent AVX/AVX2 entries.
2024-02-09x86/APX: VROUND{P,S}{S,D} encodings require AVX512{F,VL}Jan Beulich2-6/+6
In eea4357967b6 ("x86/APX: VROUND{P,S}{S,D} can generally be encoded") I failed to add the AVX512* ISA dependency of the two new entries.
2024-02-09x86: change type of Dwarf2 register numbers in register tableJan Beulich2-10/+8
Already the %bnd<N> registers used numbers beyond 127, and eGPR ones are all out of reach for "signed char", at least when CHAR_BITS=8. Switch to "unsigned char", covering appropriately in places where the value returned for "none" actually matters (in tc_x86_parse_to_dw2regnum() this is actually achieved by altering how X_op is set).
2024-02-08gas: scfi: fix failing test on Solaris2Indu Bhagat1-2/+22
It has been observed that the run of scfi-unsupported-1 test with --x32 arg on a Solaris2 x86_64 system fails: Executing on host: sh -c {../as-new --x32 --scfi=experimental \ <...>/scfi-unsupported-1.s 2>&1} /dev/null dump.out (timeout = 300) Assembler messages: Fatal error: no compiled in support for 32bit x86_64 regexp_diff match failure regexp "^Fatal error: SCFI is not supported for this ABI$" line "Fatal error: no compiled in support for 32bit x86_64" FAIL: x86_64 scfi-unsupported-1 Fix the above by adding a check for --x32 support before running the test. While at it, also include a similar check for --32 support. gas/testsuite/ * gas/scfi/x86_64/scfi-x86-64.exp: Add gas_x32_check and gas_32_check. Conditionalize the execution of affected testcases.
2024-02-09PR 14962 testcase xcoff failureAlan Modra1-1/+7
Like https://sourceware.org/pipermail/binutils/2002-August/021279.html but for symbols defined in an xcoff object but then made absolute by a linker script. * xcofflink.c (xcoff_link_input_bfd): Set n_scnum correctly for symbols made absolute by a linker script.
2024-02-09Automatic date update in version.inGDB Administrator1-1/+1
2024-02-08gdb/testsuite: Fix testing of "info copying"Thiago Jung Bauermann1-7/+87
gdb.base/default.exp has an incomplete test for the "info copying" command, as poetically pointed out by the FIXME removed by this patch. The test omits the pattern argument to gdb_test, which causes it to just check for a GDB prompt at the end of the command output. The problem is that the command output is the whole GPLv3 license, which due to its size causes the test to fail sometimes, making the testcase to be out of sync with GDB's output and failing the tests that follow it. E.g., FAIL: gdb.base/default.exp: info copying (timeout) FAIL: gdb.base/default.exp: info display FAIL: gdb.base/default.exp: info frame "f" abbreviation PASS: gdb.base/default.exp: info frame FAIL: gdb.base/default.exp: info files FAIL: gdb.base/default.exp: info float FAIL: gdb.base/default.exp: info functions FAIL: gdb.base/default.exp: info locals FAIL: gdb.base/default.exp: info program FAIL: gdb.base/default.exp: info registers FAIL: gdb.base/default.exp: info stack "s" abbreviation Fix by by checking for a few excerpts at the beginning, middle and end of the license text. This makes the test consume the command's output in smallish chunks. Reviewed-by: Keith Seitz <keiths@redhat.com> Approved-By: Tom Tromey <tom@tromey.com>
2024-02-09PR31208, strip can break ELF alignment requirementsAlan Modra1-1/+1
In https://sourceware.org/pipermail/binutils/2007-August/053261.html (git commit 3dea8fca8b86) I disabled a then new linker feature that removed empty PT_LOAD headers in cases where a user specified program headers, and for objcopy. This can be a problem for objcopy/strip and since objcopy operates on sections, any part of a PT_LOAD loading file contents not covered by a section will be omitted anyway. PR 31208 * elf.c (_bfd_elf_map_sections_to_segments): Pass remove_empty_load as true to elf_modify_segment_map for objcopy/strip.
2024-02-08Update TUI register window when the inferior exitsTom Tromey4-24/+53
When the inferior exits, the TUI register window should clear. Fixing this was mostly a matter of sticking an assignment into tui_inferior_exit. However, some changes to the register window itself were also needed. While working on this, I realized that the TUI register window would not work correctly when moving between frames of different architectures. This patch attempts to fix this as well, though I have no way to test it. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28600 Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Rename show_registers -> set_register_groupTom Tromey2-4/+4
This renames a method on the TUI register window to reflect its real purpose. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Return void from tui_show_frame_infoTom Tromey2-11/+7
Nothing uses the tui_show_frame_info result any more, so change it to return void. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Remove redundant check from tui_refresh_frame_and_register_informationTom Tromey1-3/+2
tui_refresh_frame_and_register_information checks 'from_stack' in a block that's already guarded by a 'from_stack' check. This patch removes the redundant check. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Remove tui_refreshing_registersTom Tromey1-14/+2
The comment by tui_refreshing_registers mentions a hook that no longer exists. However, maybe the comment is wrong. The code paths touching tui_refreshing_registers can only be called in two places: 1. From the before_prompt observer. This is only called when a prompt is about to be displayed. 2. From the register_changed observer. This is only called when value_assign changes a register value. From this it seems clear that the recursion case here cannot in fact occur. This patch removes the variable. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Simplify tui_data_win::erase_data_contentTom Tromey2-13/+11
There's only a single call to tui_data_win::erase_data_content now, so remove the parameter and make it just render the "empty window" text. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Remove the TUI register window rerender overloadTom Tromey2-37/+28
After these restructurings, it should be clear that the rerender overload can be removed from the TUI register window. This is done by moving a bit more logic from show_registers into update_register_data. After this, update_register_data simply updates the internal state, and rerender will write to the screen. All the actual rendering work is done, ultimately, by display_registers_from. This split between updating the model and rendering makes it clear that the recursive case can't happen any longer. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Simplify update_register_dataTom Tromey1-36/+21
This changes update_register_data to always update the register data. The idea here is that this is really only called when either the desired register group changes, or when gdb transitions from not having a frame to having a frame. show_registers is also simplified slightly to account for this. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Move scrollok call in register windowTom Tromey1-4/+4
The register window calls scrollok each time a register is written to the window. However, we only need to call this once, at the start of display. (We could actually call it just once when the window is made, but that would involve making another method virtual or adding a new member -- both which I think are worse than this approach.) Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Change tui_register_info::visible to a methodTom Tromey2-20/+5
tui_register_info::visible is redundant with the fact that y==0 means that the register is not visible. This patch changes this member in favor of having a single indication of the register's visibility -- a method with the same name. This change makes it clear that delete_data_content_windows is not needed, so this is removed as well. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Rename tui_data_item_window -> tui_register_infoTom Tromey2-15/+12
tui_data_item_window used to hold a curses window, but we removed that ages ago. Now it just holds information about a single register. This patch renames the class to make it more clearly reflect its meaning. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Simplify tui_data_window::show_register_groupTom Tromey2-77/+57
This simplifies tui_data_window::show_register_group, renaming it as well. The old method had two loops to iterate over all the registers for the arch, but in the new scheme, the vector is set up when switching groups, and then updates simply iterate over the vector. tui_data_item_window is made self-updating, which also clarifies the code somewhat. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Minor C++ cleanups in tui-regs.cTom Tromey1-5/+3
This changes a couple of spots to use nullptr rather than 0, and changes an int to a bool. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Use pop_back in tui_register_formatTom Tromey1-1/+1
tui_register_format can use string::pop_back now. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Allow calling of C++ methods from pythonHannes Domani3-2/+40
Currently it's not possible to call C++ methods from python. Using this example: ``` class B { static int static_func (); int arg0_func (); int arg1_func (int arg1); int arg2_func (int arg1, int arg2); }; B *b_obj = new B; ``` Trying to call B::static_func gives this error: ``` (gdb) py b_obj = gdb.parse_and_eval('b_obj') (gdb) py print(b_obj['static_func']()) Traceback (most recent call last): File "<string>", line 1, in <module> RuntimeError: Value is not callable (not TYPE_CODE_FUNC). Error while executing Python code. ``` TYPE_CODE_METHOD was simply missing as a possible type in valpy_call, now the same is possible: ``` (gdb) py b_obj = gdb.parse_and_eval('b_obj') (gdb) py print(b_obj['static_func']()) 1111 ``` Note that it's necessary to explicitely add the this pointer as the first argument in a call of non-static methods: ``` (gdb) py print(b_obj['arg0_func']()) Traceback (most recent call last): File "<string>", line 1, in <module> gdb.error: Too few arguments in function call. Error while executing Python code. (gdb) py print(b_obj['arg0_func'](b_obj)) 198 ``` Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=13326 Approved-By: Tom Tromey <tom@tromey.com>
2024-02-08gdb: Fix building with clangJens Remus1-2/+2
This resolves the following clang++ error message: ../../gdb/symtab.c:4892:33: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses] if (preg.has_value () && !preg->exec (sym->natural_name (), 0, ^ ../../gdb/symtab.c:4892:33: note: add parentheses after the '!' to evaluate the comparison first if (preg.has_value () && !preg->exec (sym->natural_name (), 0, ^ ( ../../gdb/symtab.c:4892:33: note: add parentheses around left hand side expression to silence this warning if (preg.has_value () && !preg->exec (sym->natural_name (), 0, ^ ( Bug: https://sourceware.org/PR31328 Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-02-08x86-64: Add R_X86_64_CODE_6_GOTTPOFFH.J. Lu15-45/+371
For add %reg1, name@gottpoff(%rip), %reg2 and add name@gottpoff(%rip), %reg1, %reg2 add #define R_X86_64_CODE_6_GOTTPOFF 50 if the instruction starts at 6 bytes before the relocation offset. They are similar to R_X86_64_GOTTPOFF. Linker can covert GOTTPOFF to add $name@tpoff, %reg1, %reg2 Rewrite fx_tcbit, fx_tcbit2 and fx_tcbit3 usage to generate R_X86_64_GOTPCRELX, R_X86_64_REX_GOTPCRELX, R_X86_64_CODE_4_GOTPCRELX, R_X86_64_CODE_4_GOTTPOFF, R_X86_64_CODE_4_GOTPC32_TLSDESC and R_X86_64_CODE_6_GOTTPOFF. NB: There is no need to check BFD_RELOC_X86_64_CODE_4_GOTTPOFF in md_assemble since there is only BFD_RELOC_X86_64_GOTTPOFF at this stage, which will be converted to BFD_RELOC_X86_64_CODE_4_GOTTPOFF or BFD_RELOC_X86_64_CODE_6_GOTTPOFF in i386_validate_fix. 5 relocations: #define R_X86_64_CODE_5_GOTPCRELX 46 #define R_X86_64_CODE_5_GOTTPOFF 47 #define R_X86_64_CODE_5_GOTPC32_TLSDESC 48 #define R_X86_64_CODE_6_GOTPCRELX 49 #define R_X86_64_CODE_6_GOTPC32_TLSDESC 51 are added for completeness and they are unused. bfd/ * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. (R_X86_64_standard): Updated. (x86_64_reloc_map): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. (elf_x86_64_check_tls_transition): Handle R_X86_64_CODE_6_GOTTPOFF. (elf_x86_64_tls_transition): Likewise. (elf_x86_64_scan_relocs): Handle R_X86_64_CODE_6_GOTTPOFF. Issue an error for R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX and R_X86_64_CODE_6_GOTPC32_TLSDESC. (elf_x86_64_relocate_section): Handle R_X86_64_CODE_6_GOTTPOFF. * reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_CODE_5_GOTPCRELX, BFD_RELOC_X86_64_CODE_5_GOTTPOFF, BFD_RELOC_X86_64_CODE_5_GOTPC32_TLSDESC, BFD_RELOC_X86_64_CODE_6_GOTPCRELX, BFD_RELOC_X86_64_CODE_6_GOTTPOFF and BFD_RELOC_X86_64_CODE_6_GOTPC32_TLSDESC. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. elfcpp/ * x86_64.h (R_X86_64_CODE_5_GOTPCRELX): New. (R_X86_64_CODE_5_GOTTPOFF): Likewise. (R_X86_64_CODE_5_GOTPC32_TLSDESC): Likewise. (R_X86_64_CODE_6_GOTPCRELX): Likewise. (R_X86_64_CODE_6_GOTTPOFF): Likewise. (R_X86_64_CODE_6_GOTPC32_TLSDESC): Likewise. gas/ * config/tc-i386.c (tc_i386_fix_adjustable): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. (md_assemble): Don't check BFD_RELOC_X86_64_CODE_4_GOTTPOFF. Allow "add %reg1, foo@gottpoff(%rip), %reg2". (output_disp): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. Rewrite setting fx_tcbitX bits for BFD_RELOC_X86_64_GOTTPOFF, BFD_RELOC_X86_64_GOTPC32_TLSDESC and BFD_RELOC_32_PCREL. (md_apply_fix): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. (i386_validate_fix): Rewrite fx_tcbitX bit checking for BFD_RELOC_X86_64_GOTTPOFF, BFD_RELOC_X86_64_GOTPC32_TLSDESC and BFD_RELOC_32_PCREL. (tc_gen_reloc): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF. * testsuite/gas/i386/x86-64-gottpoff.d: Updated. * testsuite/gas/i386/x86-64-gottpoff.s: Add tests for "add %reg1, foo@gottpoff(%rip), %reg2" and "add foo@gottpoff(%rip), %reg, %reg2". gold/ * x86_64.cc (Target_x86_64::optimize_tls_reloc): Handle R_X86_64_CODE_6_GOTTPOFF. (Target_x86_64::Scan::get_reference_flags): Likewise. (Target_x86_64::Scan::local): Likewise. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. (Target_x86_64::Relocate::relocate_tls): Likewise. (Target_x86_64::Relocate::tls_ie_to_le): Handle. R_X86_64_CODE_6_GOTTPOFF. * testsuite/x86_64_ie_to_le.s: Add tests for "add %reg1, foo@gottpoff(%rip), %reg2" and "add foo@gottpoff(%rip), %reg, %reg2". * testsuite/x86_64_ie_to_le.sh: Updated. include/ * elf/x86-64.h (elf_x86_64_reloc_type): Add R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC. ld/ * testsuite/ld-x86-64/tlsbindesc.s: Add R_X86_64_CODE_6_GOTTPOFF tests. * testsuite/ld-x86-64/tlsbindesc.d: Updated. * testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
2024-02-08PR 31283 windmc: Parse input correctly on big endian hostsRichard W.M. Jones4-4/+259
On big endian hosts (eg. s390x) the windmc tool fails to parse even trivial files: $ cat test.mc ; $ ./binutils/windmc ./test.mc In test.mc at line 1: parser: syntax error. In test.mc at line 1: fatal: syntax error. The tool starts by reading the input as Windows CP1252 and then converting it internally into an array of UTF-16LE, which it then processes as an array of unsigned short (typedef unichar). There are lots of ways this is wrong, but in the specific case of big endian machines the little endian pairs of bytes are byte-swapped. For example, the ';' character in the input above is first converted to UTF16-LE byte sequence { 0x3b, 0x00 }, which is then cast to unsigned short. On a big endian machine the first unichar appears to be 0x3b00. The lexer is unable to recognize this as the comment character ((unichar)';') and so parsing fails. The simple fix is to convert the input to UTF-16BE on big endian machines (and do the reverse conversion when writing the output). Fixes: https://sourceware.org/bugzilla/show_bug.cgi?id=31283 Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2024-02-08Automatic date update in version.inGDB Administrator1-1/+1
2024-02-07Raise exception if ambiguous name is used in gdb.parameterHannes Domani5-4/+58
Currently gdb.parameter doesn't raise an exception if an ambiguous name is used, it instead returns the value of the last partly matching parameter: ``` (gdb) show print sym Ambiguous show print command "sym": symbol, symbol-filename, symbol-loading. (gdb) show print symbol-loading Printing of symbol loading messages is "full". (gdb) py print(gdb.parameter("print sym")) full ``` It's because lookup_cmd_composition_1 tries to detect ambigous names by checking the return value of find_cmd for CMD_LIST_AMBIGUOUS, which never happens, since only lookup_cmd_1 returns CMD_LIST_AMBIGUOUS. Instead the nfound argument contains the number of found matches. By using it instead, and by setting *CMD to the special value CMD_LIST_AMBIGUOUS in this case, gdbpy_parameter can now show the appropriate error message: ``` (gdb) py print(gdb.parameter("print sym")) Traceback (most recent call last): File "<string>", line 1, in <module> RuntimeError: Parameter `print sym' is ambiguous. Error while executing Python code. (gdb) py print(gdb.parameter("print symbol")) True (gdb) py print(gdb.parameter("print symbol-")) Traceback (most recent call last): File "<string>", line 1, in <module> RuntimeError: Parameter `print symbol-' is ambiguous. Error while executing Python code. (gdb) py print(gdb.parameter("print symbol-load")) full ``` Since the document command also uses lookup_cmd_composition, it needed to check for CMD_LIST_AMBIGUOUS as well, so it now also shows an "Ambiguous command" error message in this case. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=14639 Approved-By: Tom Tromey <tom@tromey.com>
2024-02-07Fix raw-frame-arguments in combination with frame-filtersHannes Domani6-10/+83
Currently, if frame-filters are active, raw-values is used instead of raw-frame-arguments to decide if a pretty-printer should be invoked for frame arguments in a backtrace. In this example, "super struct" is the output of the pretty-printer: (gdb) disable frame-filter global BasicFrameFilter (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 If no frame-filter is active, then the raw-values print option does not affect the backtrace output: (gdb) set print raw-values on (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values off Instead, the raw-frame-arguments option disables the pretty-printer in the backtrace: (gdb) bt -raw-frame-arguments on #0 foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 But if a frame-filter is active, the same rules don't apply. The option raw-frame-arguments is ignored, but raw-values decides if the pretty-printer is used: (gdb) enable frame-filter global BasicFrameFilter (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values on (gdb) bt #0 foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values off (gdb) bt -raw-frame-arguments on #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 So this adds the PRINT_RAW_FRAME_ARGUMENTS flag to frame_filter_flag, which is then used in the frame-filter to override the raw flag in enumerate_args. Then the output is the same if a frame-filter is active, the pretty-printer for backtraces is only disabled with the raw-frame-arguments option: (gdb) enable frame-filter global BasicFrameFilter (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values on (gdb) bt #0 foo (x=42, ss=super struct = {...}) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 (gdb) set print raw-values off (gdb) bt -raw-frame-arguments on #0 foo (x=42, ss=...) at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:47 #1 0x004016aa in main () at C:/src/repos/gdb-testsuite/gdb/testsuite/gdb.python/py-frame-args.c:57 Co-Authored-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Tom Tromey <tom@tromey.com>
2024-02-07Remove use of scoped_restore_tmpl from scoped_restore_warning_hookCiaran Woodward2-2/+15
The warning_hook_handler function pointer takes va_list as an argument, which on some platforms (mingw64) includes some attributes. Attributes get ignored in template arguments. This led to the compiler warning: error: ignoring attributes on template argument 'warning_hook_handler' {aka 'void (*)(const char*, char*)'} [-Werror=ignored-attributes] 387 | scoped_restore_tmpl<warning_hook_handler> m_save; | ^ By manually implementing the save/restore behaviour, rather than using the helper template, this warning is fixed. Approved-By: Tom Tromey <tom@tromey.com>
2024-02-07asan: NULL dereference in _bfd_mips_final_write_processingAlan Modra1-20/+19
Fuzzed object files can easily have unexpected section names. We don't want to segfault on objcopy of any file accepted by the mips object_p functions. For objcopy, an assertion that "sec" is non-NULL followed by deferencing "sec" is wrong. So too is asserting that the section name string starts with a particular prefix, and then blithely accessing past the assumed prefix. * elfxx-mips.c (_bfd_mips_final_write_processing): Replace assertions with conditionals. Don't bother testing for name non-NULL.
2024-02-07memory leak in objdump disassemble_sectionAlan Modra1-3/+2
* objdump.c (disassemble_section): Free rel_ppstart on error path.
2024-02-06gas: x86: ginsn: handle sub-QWORD ALU with imm and MOV ops correctlyIndu Bhagat5-96/+149
PR gas/31326 SCFI must handle non QWORD ALU with imm and MOV ops correctly As per the x86 ISA manual: - 32-bit operands generate a 32-bit result, zero-extended to a 64-bit result in the destination general-purpose register. - 8-bit and 16-bit operands generate an 8-bit or 16-bit result. The upper 56 bits or 48 bits (respectively) of the destination general-purpose register are not modified by the operation. Unlike previously thought, sub-QWORD ALU/imm and MOV ops do have implications on SCFI. SCFI/ginsn machinery does not track operation size in the ginsn representation. But given that these sub-QWORD ops update only a portion of a 64-bit destination register, for SCFI purposes, this needs to be deemed as an untraceable update (when the destination is REG_SP / REG_FP). Although in most cases, sub-QWORD ops are not expected for stack management, but the SCFI machinery must behave correctly, when such ops are indeed present. As mentioned earlier, ginsn representation does not carry operation size information. To resolve the issue raised in PR gas/31326, an option is to force the generation of GINSN_TYPE_OTHER for all cases when there is a 8/16/32 bit op. But this may dilute the utility of ginsn for other use-cases, when they pop up in future. The current approach is less disruptive than above in that it generates GINSN_TYPE_OTHER for all cases only when: - there is a 8/16/32 bit op, and - the 64-bit op is otherwise traceable. In other words this means: - For add/sub ops where dest is reg and src is reg/mem: these always make dest reg untraceable; So, the current handling is unchanged. We simply skip detecting 8/16/32-bit ops. - An x86 pop instruction is translated to a load ginsn followed by a stack increment add op. A load op always makes dest reg untraceable. Hence, if the pop instruction is sub-QWORD, we continue to (skip detecting 8/16/32-bit op, and) generate the load instruction as usual. This means that if input asm does have save and restore of unequal sized registers, gas/SCFI will not detect nor warn. - For ALU imm or MOV reg,reg, however, a GINSN_TYPE_OTHER is generated when a 8/16/32-bit op is seen. gas/ PR gas/31326 * config/tc-i386.c (x86_ginsn_addsub_reg_mem): Add a code comment. (x86_ginsn_addsub_mem_reg): Likewise. (x86_ginsn_alu_imm): Detect sub-QWORD opsize and exit early. (x86_ginsn_move): Likewise. (x86_ginsn_new): Add comment for 8-bit add/sub opcodes (in opcode_space SPACE_BASE) about skipped handling. gas/testsuite/: PR gas/31326 * gas/scfi/x86_64/ginsn-add-1.l: Update. * gas/scfi/x86_64/ginsn-add-1.s: Add some sub-QWORD add ops. * gas/scfi/x86_64/ginsn-dw2-regnum-1.l: Update. * gas/scfi/x86_64/ginsn-dw2-regnum-1.s: Use mov ops instead of add to invoke and test the ginsn_dw2_regnum code path.
2024-02-07Automatic date update in version.inGDB Administrator1-1/+1
2024-02-06gdb: remove core_bfd macroSimon Marchi18-181/+213
The core_bfd macro hides a use of current_program_space. Remove it, so that we have the opportunity to get the program space from the context, if possible. I guess that the macro was introduced at some point to replace a global variable of the same name without changing all the uses. Change-Id: I971a65b29b5e5a5941f3cb7ea234547daa787268 Approved-By: Tom Tromey <tom@tromey.com>
2024-02-06x86: Warn .insn instruction with length > 15 bytesH.J. Lu3-2/+19
Change .insn instruction with length > 15 bytes from error to warning. PR gas/31323 * config/tc-i386.c (output_insn): Issue a warning when .insn instruction length exceeds the limit of 15 bytes. * testsuite/gas/i386/oversized64.s: Add a test for .insn * testsuite/gas/i386/oversized64.l: Updated.
2024-02-06gdb: LoongArch: Implement the get_syscall_number gdbarch methodTiezhu Yang1-0/+28
In the current code, the feature 'catch syscall' is not supported on LoongArch, implement the "get_syscall_number" gdbarch method to get the system call number from the register a7. Without this patch: (gdb) catch syscall The feature 'catch syscall' is not supported on this architecture yet. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2024-02-06gdb: LoongArch: Add LBT extension supportFeiyang Chen10-0/+283
Loongson Binary Translation (LBT) is used to accelerate binary translation, which contains 4 scratch registers (scr0 to scr3), x86/ARM eflags (eflags) and x87 fpu stack pointer (ftop). This patch support gdb to fetch/store these registers. Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> # Framework Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> # Detail Optimizes Signed-off-by: Hui Li <lihui@loongson.cn> # Error Fixes Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2024-02-06gdb: LoongArch: Add vector extensions supportHui Li12-0/+641
Add LoongArch's vector extensions support, which including 128bit LSX (i.e., Loongson SIMD eXtension) and 256bit LASX (i.e., Loongson Advanced SIMD eXtension). This patch support gdb to fetch/store vector registers. Signed-off-by: Hui Li <lihui@loongson.cn> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
2024-02-06Link x86-64 mark-plt-1.so with --no-as-neededAlan Modra1-1/+1
Fixes FAIL: Build mark-plt-1.so where gcc is built with default --as-needed. * testsuite/ld-x86-64/x86-64.exp (Build mark-plt-1.so): Pass --no-as-needed.
2024-02-06Automatic date update in version.inGDB Administrator1-1/+1
2024-02-05gdb: rename target_so_ops to solib_opsSimon Marchi24-245/+243
I don't like the name `target_so_ops`, because: - The name `target` is so overloaded, and in this case it's not even related to target_ops or anything else called "target". - We do have an implementation that actually fetches solibs from the target (solib_target_so_op in solib-target.c), so it's confusing for the "base class" to be called target_something as well. Rename to solib_ops. Change-Id: I46a983d44e81400470e22deb09aaf26ad8a3587f Approved-By: Tom Tromey <tom@tromey.com>
2024-02-05gdb: rename struct shobj -> struct solibSimon Marchi26-129/+129
`struct so_list` was recently renamed to `struct shobj` (in 3fe0dfd1604f ("gdb: rename struct so_list to shobj")). In hindsight, `solib` would have been a better name. We have solib.c, the implementations in solib-*.c, many functions with solib in their name, the solib_loaded / solib_unloaded observables, etc. Rename shobj to solib. Change-Id: I0af1c7a9b29bdda027e9af633f6d37e1cfcacd5d Approved-By: Tom Tromey <tom@tromey.com>
2024-02-05Remove remnants of partial DIEs from DWARF readerTom Tromey3-17/+5
When rewriting the DWARF scanner, I forgot to remove dwarf2_cu::load_all_dies and dwarf2_cu::partial_dies. This patch corrects the oversight and fixes up a couple other spots that mention partial DIEs, which no longer exist. Approved-By: Tom de Vries <tdevries@suse.de>
2024-02-05Avoid an allocation in attr_to_dynamic_propTom Tromey1-9/+8
I noticed that attr_to_dynamic_prop allocates a dwarf_block, when no allocation is required. This patch stack-allocates the object instead. Reviewed-By: Tom de Vries <tdevries@suse.de>