aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
10 daysMicroBlaze: Update software breakpoint machine code as per MicroBlaze ISAGopi Kumar Bulusu1-1/+1
This patch updates breakpoint instruction machine code to be inline with the specification in MicroBlaze ISA [1] * gdb/microblaze-tdep.h : Update MICROBLAZE_BREAKPOINT [1] https://docs.amd.com/r/en-US/ug984-vivado-microblaze-ref/brki Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com> Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com> Signed-off-by: Mahesh Bodapati <mbodapat@xilinx.com> Signed-off-by: Gopi Kumar Bulusu <gopi@sankhya.com>
10 daysChange type_stack::insert to take gdbarchTom Tromey3-7/+5
This changes type_stack::insert to take a gdbarch rather than an expr_builder. This is simpler and means that type_stack doesn't have to know anything about expression building; the parser-defs.h include can be removed. Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysMake type_stack popping a bit saferTom Tromey1-7/+30
This changes type_stack so that an element that has an argument can't be popped in isolation. The idea is to make type stack use a little safer, making it so that the stack can't end up in an invalid state. This also fixes up a few related comments. Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysMake type_stack pushing a bit saferTom Tromey4-46/+75
This changes type_stack to make pushing elements a bit safer: if an element requires an argument, these are now always pushed at the same time, rather than separately. This patch also adds a few comments to help document a bit better. Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysAutomatic date update in version.inGDB Administrator1-1/+1
10 daysreadelf: tidy dump_relr_relocationsAlan Modra1-5/+12
A comment in display_relocations said "RELRS has been freed by dump_relr_relocations". Except that hadn't happened on all return paths. Tidy that by freeing relrs allocated in dump_relr_relocations in that function, and relrs allocated in display_relocation in that function. * readelf.c (dump_relr_relocations): Only free relrs allocated in this function. (display_relocations): Free relrs here, on error return paths too.
10 daysFix gdb.Value.dynamic_type attributeHannes Domani3-0/+6
gdb currently crashes if you try to get the dynamic_type from a gdb.Value of a POD struct: (gdb) py print(gdb.parse_and_eval('pod').dynamic_type) Fatal signal: Segmentation fault It happens because value_rtti_type() returns NULL for them, and this is not handled correctly. Fixed by using val->type() as a fallback in this case. Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysUse gnulib c-ctype module in gdbTom Tromey112-401/+312
PR ada/33217 points out that gdb incorrectly calls the <ctype.h> functions. In particular, gdb feels free to pass a 'char' like: char *str = ...; ... isdigit (*str) This is incorrect as isdigit only accepts EOF and values that can be represented as 'unsigned char' -- that is, a cast is needed here to avoid undefined behavior when 'char' is signed and a character in the string might be sign-extended. (As an aside, I think this API seems obviously bad, but unfortunately this is what the standard says, and some systems check this.) Rather than adding casts everywhere, this changes all the code in gdb that uses any <ctype.h> API to instead call the corresponding c-ctype function. Now, c-ctype has some limitations compared to <ctype.h>. It works as if the C locale is in effect, so in theory some non-ASCII characters may be misclassified. This would only affect a subset of character sets, though, and in most places I think ASCII is sufficient -- for example the many places in gdb that check for whitespace. Furthermore, in practice most users are using UTF-8-based locales, where these functions aren't really informative for non-ASCII characters anyway; see the existing workarounds in gdb/c-support.h. Note that safe-ctype.h cannot be used because it causes conflicts with readline.h. And, we canot poison the <ctype.h> identifiers as this provokes errors from some libstdc++ headers. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33217 Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysUse c-ctype.h (not safe-ctype.h) in gdbTom Tromey23-140/+78
This changes gdb and related programs to use the gnulib c-ctype code rather than safe-ctype.h. The gdb-safe-ctype.h header is removed. This changes common-defs.h to include the c-ctype header, making it available everywhere in gdb. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33217 Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysImport the c-ctype module from gnulibTom Tromey8-20/+438
This arranges to import the c-ctype module from gnulib. c-ctype is similar ot safe-ctype, but doesn't poison the <ctype.h> APIs. This patch should not result in any functional changes, as nothing includes the new header yet. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33217 Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysgdb: fix build with newest clangGuinevere Larsen1-3/+4
The upstream build of GDB can fail on fedora rawhide, since the self check in regcache.c uses an unitialized variable to be compared, which now generates the following warning: binutils-gdb/gdb/regcache.c:1847:42: error: variable 'buf' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer] 1847 | SELF_CHECK (regcache->raw_compare (0, &buf, register_size (inf.arch (), 0))); This commit fixes that by initializing the variable to 0. Since the comment above that line would be changed, it was also reformatted so that it doesn't go beyond 80 columns. Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysRemove ada_binop_in_boundsTom Tromey2-17/+11
ada_binop_in_bounds can be merged with its sole caller. Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysRemove ada_ternop_sliceTom Tromey2-19/+13
ada_ternop_slice can be merged with its sole caller. Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysRemove ada_equal_binopTom Tromey2-17/+15
ada_equal_binop can be merged with its sole caller. Approved-By: Simon Marchi <simon.marchi@efficios.com>
10 daysRemove ada_unop_in_rangeTom Tromey2-15/+13
ada_unop_in_range can be merged with its sole caller. This change points out that one of the arguments was not needed. Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 daysUse ada_fvar_tracking in finish-var-size.expTom Tromey1-1/+1
commit a16f37e8 changed finish-var-size.exp to use have_fvar_tracking. However, in Ada tests, ada_fvar_tracking must be used instead.
11 daysCorrect -Ue output for nm, objdump and readelfAndrew C Aitchison3-6/+6
..., like PR33360 does for strings. Signed-off-by: Andrew C Aitchison <github@aitchison.me.uk>
11 daysnm: fix treating an ifunc symbol as a stab if '--ifunc-chars=--' is givenDmitry Klochkov2-3/+24
If an ifunc symbol is processed in print_symbol(), a 'type' field of a 'syminfo' structure is set to any character specified by a user with an '--ifunc-chars' option. But afterwards the 'type' field is used to check whether a symbol is a stab in print_symbol_info_{bsd,sysv}() functions in order to print additional stab related data. If the 'type' field equals '-', a symbol is treated as a stab. If '--ifunc-chars=--' is given, all ifunc symbols will be treated as stab symbols and uninitialized stab related fields of the 'syminfo' structure will be printed which can lead to segmentation fault. To fix this, check if a symbol is a stab before override the 'type' field. Also, add a test case for this fix. PR binutils/32556 * nm.c (extended_symbol_info): Add is_stab. (print_symbol): Check if a symbol is a stab. (print_symbol_info_bsd): Use info->is_stab. (print_symbol_info_sysv): Use info->is_stab. * testsuite/binutils-all/nm.exp: Test nm --ifunc-chars=--. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32556 Fixes: e6f6aa8d184 ("Add option to nm to change the characters displayed for ifunc symbols") Signed-off-by: Dmitry Klochkov <dmitry.klochkov@bell-sw.com>
11 daysPR 33406 SEGV in dump_dwarf_sectionAlan Modra1-4/+6
Trying to dump .sframe in a PE file results in a segfault accessing elf_section_data. * objdump (dump_sframe_section, dump_dwarf_section): Don't access elf_section_type without first checking the file is ELF.
11 daysobjcopy: when an invalid bfd target string is used as a target option, print ↵Nick Clifton1-3/+12
an error message that references the target string, not the file being copied
11 daysobjdump gcc_compiled and gcc2_compiledAlan Modra1-17/+4
* objdump.c (remove_useless_symbols): Deal with gcc_compiled and gcc2_compiled here.. (compare_symbols): ..rather than here.. (disassemble_section): ..and here.
11 daysRevert "objdump: Check the SEC_CODE bit for code"Alan Modra1-1/+0
PR 33389 This reverts commit 6b27a220321ecead5435b170f1db02f1876cee08.
11 daysChange dwarf_record_line_1 to be a methodTom Tromey1-22/+16
This changes dwarf_record_line_1 to be a method of lnp_state_machine, simplifying it a bit. Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 daysChange dwarf_finish_line to be a methodTom Tromey1-14/+10
This changes dwarf_finish_line to be a method of lnp_state_machine, simplifying it a bit. Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 daysAdd m_builder member to lnp_state_machineTom Tromey1-6/+8
I noticed that several spots in lnp_state_machine fetch the CU's builder. Since this can't change over the lifetime of the object, it seemed nicer to simply cache it. Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 daysChange dwarf_record_line_p to be a methodTom Tromey1-11/+8
This changes dwarf_record_line_p to be a method of lnp_state_machine. This simplifies it, as it can refer to members of the object. Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 daysBoolify line-program.cTom Tromey2-8/+8
This changes some code in line-program.c to use bool rather than int. Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 daysMove compute_include_file_name earlierTom Tromey1-75/+69
I noticed that the compute_include_file_name intro comment was slightly wrong, and while looking at this, I also noticed that it has a single caller. This patch hoists it slightly so that a forward declaration isn't needed. Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 daysMove lnp_state_machine to new fileTom Tromey5-753/+815
This patch moves lnp_state_machine and some supporting code to a new file, dwarf2/line-program.c. The main benefit of this is shrinking dwarf2/read.c a bit. Approved-By: Simon Marchi <simon.marchi@efficios.com>
11 daysAutomatic date update in version.inGDB Administrator1-1/+1
11 daysUse type-specific lookups in cp-support.cTom Tromey1-2/+4
cp-support.c has code to substitute types for typedef names when canonicalizing a C++ name. I believe this code can use type-specific search domains; and doing this greatly speeds up some cases. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33081
11 daysAvoid symbol lookup for field names in C parserTom Tromey1-103/+193
Currently, the C parser looks up any name it finds -- at lex time. However, in an expression like "obj->field", looking up the field name is wasteful, and can sometimes even yield pathological symtab expansion behavior. This patch arranges to avoid the name lookup in this case. (It would be nice to really clean up this area, but I'm not convinced it can readily be done in a yacc parser.) Some special code is required for the C++ construct where a qualified name is used, like "obj->type1::type2::field". Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33081
11 daysChange how C parser looks up type tag namesTom Tromey1-58/+79
In an earlier version of this series, Simon noticed that something like "ptype struct type" was much slower. The deep problem here is the hack in best_symbol -- in this particular case the C parser is including SEARCH_VAR_DOMAIN, which means that a type is not "best". Fixing best_symbol would be good to do, but it's difficult and I already had many struggles getting this series to this point. So, rather than fix that, I elected to modify the parser. The key insight here is that the name lookup in classify_name is useless when a tag name is expected. This patch adds a flag so that this lookup is not done. (Incidentally, this kind of thing is much more straightforward in a recursive descent parser, something like classify_name would only be applied post-lexing where appropriate.) This change speeds up the lookup by avoiding the best_symbol hack, instead searching only for a type. Acked-By: Simon Marchi <simon.marchi@efficios.com> Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
11 daysgdb: Add svr4-tls-tdep.o to list of objects of i*86 targetsSergio Durigan Junior1-1/+1
GDB currently fails to build from source on i386 if compiled with --enable-64-bit-bfd. This is happening because svr4-tls-tdep.o is missing from the gdb_target_obs variable, while amd64-linux-tdep.o is obviously there. Fix the problem by adding svr4-tls-tdep.o to the object list, but only when --enable-64-bit-bfd is provided. Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33399
12 daysChange return value of _bfd_mmap_temporaryTom Tromey3-21/+19
_bfd_mmap_temporary will return MAP_FAILED in some cases, but only one caller was prepared for this. This caused a couple of issues in gdb. This patch chnages _bfd_mmap_temporary to always return NULL on failure. It also changes the logic to fall back to bfd_malloc if mmap fails. I took the opportunity to change some "(void *) -1" to MAP_FAILED where appropriate. Tested by "make check" in binutils, and also by applying a hack from bug 33354 to gdb and testing something approximating the original report. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32542 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33354
12 daysRequire Tcl 8.6.2Tom Tromey2-53/+7
This changes the gdb test suite to require Tcl 8.6.2. This allows the removal of some more compatibility code. I wrote this as a separate patch so make it simpler to drop if some platform only provides Tcl 8.5. According to research in the bug, though, it seems like this isn't likely. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33205 Approved-By: Simon Marchi <simon.marchi@efficios.com>
12 daysRewrite tcl_version_at_leastTom Tromey1-15/+3
tcl_version_at_least can more easily be expressed using the built-in "package" command. Approved-By: Simon Marchi <simon.marchi@efficios.com>
12 daysRequire Tcl 8.5Tom Tromey1-17/+2
This patch changes the gdb test suite to require Tcl 8.5. It also removes the one pre-8.5 compatibility function. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33205 Approved-By: Simon Marchi <simon.marchi@efficios.com>
12 daysvms-alpha: sections array index sanity checksAlan Modra1-1/+7
Adds a couple of missing bound checks. * vms-alpha.c (alpha_vms_fix_sec_rel): Sanity check relocation section index. (alpha_vms_bfd_final_link): Assert that section index is sane.
12 daysvms-alpha: ehdr checksAlan Modra1-29/+28
I noticed that _bfd_vms_slurp_ehdr wrongly used buf_size (rather than rec_size) when sanity checking. * vms-alpha.c (_bfd_vms_slurp_ehdr): Don't allow access to uninitialised buffer memory. Tidy code generally, using remaining record length for sanity checks.
12 daysPR 33385 vms archivesAlan Modra3-0/+14
Commit 5c4ce239a3ab "Tidy bfdio to consistenly use containing archive" broke vms archive handling, which has some horrible hacks involving use of a special iovec for archive elements. Modify the generic archive handling code to not use the archive iovec when it differs from the element iovec. Also, various commits involving seek optimisation broke the vms archive handling, which needs to see a rewind on an archive element. * bfdio.c (bfd_read, bfd_write, bfd_tell, bfd_flush), (bfd_stat, bfd_seek, bfd_mmap): Do not use the archive bfd for IO when the archive and element iovec differ. * plugin.c (bfd_plugin_open_input), (bfd_plugin_close_file_descriptor): Likewise. * vms-lib.c (vms_lib_bopen): Force bfd_seek to call iovec seek.
12 daysPR 33385 unsupported relocsAlan Modra1-2/+2
Commit 96d3b80f5498 changed a couple of reloc functions to return false, and propagated the error. They previously did nothing, so revert to that sad state. * vms-alpha.c (alpha_vms_add_lw_reloc): Return true. (alpha_vms_add_qw_reloc): Likewise.
12 daysPR 33385 DST handlingAlan Modra1-23/+31
Commit 816995444667, a fix for a fuzzer testcase resulting in a buffer overflow, broke reading of DST. DST is a special case where a first pass over the section just sizes it. Commit a3c0896d80d2, another buffer overflow fix, wrongly removed a line incrementing DST record length. * vms-alpha.c (image_write): Don't do bounds check for sections in memory without contents. (evax_bfd_print_dst): Add one to length.
12 daysPR 33385 EOMAlan Modra1-2/+2
Another PR 21813 modification. * vmd-alpha.c (_bfd_vms_slurp_eeom): Allow 10 byte EOM. Don't set has_transfer or access fields past 10 bytes unless the entire EEOM is there.
12 daysPR 33385, Extended Image HeaderAlan Modra2-19/+17
This modifies some of the PR 21813 fixes, allowing for smaller EIHD. Not knowing any better, I chose to use EIHD__C_LENGTH as the minimum length. include/ * vms/eihd.h (EIHD__C_LENGTH): Comment. bfd/ * vms-alpha.c (_bfd_vms_slurp_eihd): Remove size check duplicating that done by the caller of this function. (alpha_vms_object_p): Allow smaller EIHD. (evax_bfd_print_image): Likewise. Don't print fields past the record size.
12 daysbinutils: Require GNU tail for 'objdump -Wi' testH.J. Lu7-4/+76
testsuite/binutils-all/objdump.exp has set got [remote_exec host "tail -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.tail"] But the default Solaris tail doesn't support "tail -n +4". Add ACX_PROG_GNU_TAIL to use GNU tail for 'objdump -Wi' test. Tested on Linux and Solaris. binutils/ PR binutils/33396 * Makefile.am (check-DEJAGNU): Also export TAIL. * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. * configure.ac: Add ACX_PROG_GNU_TAIL. * testsuite/binutils-all/objdump.exp: Require GNU tail for 'objdump -Wi' test and replace tail with $env(TAIL). config/ PR binutils/33396 * acx.m4 (ACX_PROG_GNU_TAIL): New. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
12 daysobjdump: Check the SEC_CODE bit for codeH.J. Lu1-0/+1
If a shared library has $ readelf -D -sW x.so | grep _PROCEDURE_LINKAGE_TABLE_ 3: 00000000000002c0 0 OBJECT GLOBAL DEFAULT 5 _PROCEDURE_LINKAGE_TABLE_ $ Disassembler treats PLT0 as data: $ objdump -dw x.so x.so: file format elf64-x86-64 Disassembly of section .plt: 00000000000002c0 <_PROCEDURE_LINKAGE_TABLE_>: 2c0: ff 35 7a 01 10 00 ff 25 7c 01 10 00 0f 1f 40 00 .5z....%|.....@. 00000000000002d0 <foo@plt>: 2d0: ff 25 7a 01 10 00 jmp *0x10017a(%rip) # 100450 <foo> 2d6: 68 00 00 00 00 push $0x0 2db: e9 e0 ff ff ff jmp 2c0 <_PROCEDURE_LINKAGE_TABLE_> Disassembly of section .text: 00000000000002e0 <func>: 2e0: e8 eb ff ff ff call 2d0 <foo@plt> 2e5: c3 ret Check the SEC_CODE bit on section for code. PR binutils/33389 * objdump.c (disassemble_section): Check SEC_CODE for code. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
12 daysgdb/testsuite: small fix for amd64-extended-prologue-analysis.expAndrew Burgess1-2/+6
I noticed I was sometimes getting this failure: FAIL: gdb.arch/amd64-extended-prologue-analysis.exp: offset \ initialization: ASM source: gdb_breakpoint: set breakpoint \ at *0x0000000000401151 The problem was introduced in commit: commit f9aa48dc545ef511e19f4dfab88a196b820fd2da Date: Thu Aug 28 11:50:13 2025 +0000 gdb, amd64: extend the amd64 prologue analyzer to skip register pushes A gdb_test_multiple exits early when processing the results of a 'disassemble' command, without waiting for the prompt to be seen. This can leave unhandled output in expect's input buffer, which will then throw off the next test. Update the gdb_test_multiple to wait for the prompt before declaring the test passed. After this I'm no longer seeing the above failure. There should be no change in what is tested after this commit.
12 daysx86: constrain and fix use of the "nojumps" .arch modifierJan Beulich7-21/+84
As said by the paragraph of the description that isn't modified here (a few lines up), this was only ever supposed to be used with 16-bit architectures. Actually enforcing this allows code in md_estimate_size_before_relax() to move to a less frequently used code path. (For backwards compatibility, keep accepting "jumps" also with 32- or 64-bit architectures.) Repeat the constraint also in the 2nd paragraph of the doc on this subject. And while there also insert a missing insn in the related i386-Jumps section. Furthermore checking a global variable during late processing is wrong. We need to record the state in the fragment, and use that rather than the state of the variable at the end of parsing all input. Seeing that there's no testing of the functionality at all, add a testcase as well.
12 daysx86: make TC_FRAG_INIT() resolve to a function callJan Beulich2-37/+25
This way we can avoid making various global variables non-static. Their set is to only ever grow, really.