aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-09-10Enhance the disassembler so that it will reliably determine whether a reloc ↵Nick Clifton93-2552/+1280
applies to the middle of the next insn. PR 24907 binutils* objdump.c (null_print): New function. (disassemble_bytes): Delete previous_octets local and replace with a test of the max_reloc_offset_into_insn field of the bfd_arch_info structure. If a reloc is a potential match for the next insn, then perform a dummy disassembly in order to calculate its real length. bfd * archures.c (bfd_arch_info_type): Add max_reloc_offset_into_insn field. (bfd_default_arch_struct): Initialise the new field. * bfd-in2.h: Regenerate. * cpu-aarch64.c: Initialise the new field. * cpu-alpha.c: Likewise. * cpu-arc.c: Likewise. * cpu-arm.c: Likewise. * cpu-avr.c: Likewise. * cpu-bfin.c: Likewise. * cpu-bpf.c: Likewise. * cpu-cr16.c: Likewise. * cpu-cr16c.c: Likewise. * cpu-cris.c: Likewise. * cpu-crx.c: Likewise. * cpu-csky.c: Likewise. * cpu-d10v.c: Likewise. * cpu-d30v.c: Likewise. * cpu-dlx.c: Likewise. * cpu-epiphany.c: Likewise. * cpu-fr30.c: Likewise. * cpu-frv.c: Likewise. * cpu-ft32.c: Likewise. * cpu-h8300.c: Likewise. * cpu-hppa.c: Likewise. * cpu-i386.c: Likewise. * cpu-ia64.c: Likewise. * cpu-iamcu.c: Likewise. * cpu-ip2k.c: Likewise. * cpu-iq2000.c: Likewise. * cpu-k1om.c: Likewise. * cpu-l1om.c: Likewise. * cpu-lm32.c: Likewise. * cpu-m10200.c: Likewise. * cpu-m10300.c: Likewise. * cpu-m32c.c: Likewise. * cpu-m32r.c: Likewise. * cpu-m68hc11.c: Likewise. * cpu-m68hc12.c: Likewise. * cpu-m68k.c: Likewise. * cpu-m9s12x.c: Likewise. * cpu-m9s12xg.c: Likewise. * cpu-mcore.c: Likewise. * cpu-mep.c: Likewise. * cpu-metag.c: Likewise. * cpu-microblaze.c: Likewise. * cpu-mips.c: Likewise. * cpu-mmix.c: Likewise. * cpu-moxie.c: Likewise. * cpu-msp430.c: Likewise. * cpu-mt.c: Likewise. * cpu-nds32.c: Likewise. * cpu-nfp.c: Likewise. * cpu-nios2.c: Likewise. * cpu-ns32k.c: Likewise. * cpu-or1k.c: Likewise. * cpu-pdp11.c: Likewise. * cpu-pj.c: Likewise. * cpu-plugin.c: Likewise. * cpu-powerpc.c: Likewise. * cpu-pru.c: Likewise. * cpu-riscv.c: Likewise. * cpu-rl78.c: Likewise. * cpu-rs6000.c: Likewise. * cpu-rx.c: Likewise. * cpu-s12z.c: Likewise. * cpu-s390.c: Likewise. * cpu-score.c: Likewise. * cpu-sh.c: Likewise. * cpu-sparc.c: Likewise. * cpu-spu.c: Likewise. * cpu-tic30.c: Likewise. * cpu-tic4x.c: Likewise. * cpu-tic54x.c: Likewise. * cpu-tic6x.c: Likewise. * cpu-tic80.c: Likewise. * cpu-tilegx.c: Likewise. * cpu-tilepro.c: Likewise. * cpu-v850.c: Likewise. * cpu-v850_rh850.c: Likewise. * cpu-vax.c: Likewise. * cpu-visium.c: Likewise. * cpu-wasm32.c: Likewise. * cpu-xc16x.c: Likewise. * cpu-xgate.c: Likewise. * cpu-xstormy16.c: Likewise. * cpu-xtensa.c: Likewise. * cpu-z80.c: Likewise. * cpu-z8k.c: Likewise. gas * testsuite/gas/arm/pr24907.s: New test. * testsuite/gas/arm/pr24907.d: Expected disassembly.
2019-09-10[PATCH][ARM][GAS]: Support to MVE VCTP instruction.Srinath Parvathaneni6-0/+177
This patch adds support for MVE VCTP instruction in assembler. gas ChangeLog: 2019-09-10 Srinath Parvathaneni <srinath.parvathaneni@arm.com> * config/tc-arm.c (M_MNEM_vctp): Add new Mnemonic. (do_mve_vctp): Add function to encode VCTP instruction. * testsuite/gas/arm/mve-vctp-bad.d: New test. * testsuite/gas/arm/mve-vctp-bad.l: Likewise. * testsuite/gas/arm/mve-vctp-bad.s: Likewise. * testsuite/gas/arm/mve-vctp.d: Likewise. * testsuite/gas/arm/mve-vctp.s: Likewise.
2019-09-09DWARF 5 support: Handle dwo_idAli Tamur2-25/+115
* DW_UT_skeleton and DW_UT_split_compile compilation units have dwo ids to match the compilation unit in the skeleton and .dwo files. The dwo_id is in the header. Tested with CC=/usr/bin/gcc (version 8.3.0) against master branch (also with -gsplit-dwarf and -gdwarf-4 flags) and there was no increase in the set of tests that fails. This is part of an effort to support DWARF 5 in gdb. gdb/ChangeLog: * dwarf2read.c (comp_unit_head): Update comment. (dwarf2_dwo_name): New function declaration. (dwarf_unit_type_name): New function declaration. (read_comp_unit_head): Add support for new compilation units, DW_UT_partial, DW_UT_skeleton, DW_UT_split_compile, DW_UT_split_type. Particularly, DW_UT_skeleton and DW_UT_split_compile have dwo_id (currently named as "signature") in their header. Also clarify error messages. (lookup_dwo_id): New function. Returns the dwo id of the given compile unit. (lookup_dwo_unit): Use the new lookup_dwo_id function. (init_cutu_and_read_dies): Use the new dwarf2_dwo_name and lookup_dwo_id functions. (create_dwo_cu_reader): Use the added lookup_dwo_id function. (dwarf2_dwo_name): Get the dwo name if present. (dwarf_unit_type_name): Convert DW_UT_* types to string for diagnostic purposes.
2019-09-10Automatic date update in version.inGDB Administrator1-1/+1
2019-09-09Use ui_out for "info win"Tom Tromey2-6/+18
This changes the "info win" command to use ui-out. This yields somewhat nicer table output. gdb/ChangeLog 2019-09-09 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_all_windows_info): Use ui_out.
2019-09-09Fix leak detected in python.c initialization code.Philippe Waroquiers2-1/+13
Valgrind reports the below leak. Make the variable progname_copy static, so that Valgrind continues to find a pointer to the memory given to Python. Note that the comment in do_start_initialization and the Python documentation indicates that the progname given to Py_SetProgramName cannot be freed. However, in Python 3.7.4, Py_SetProgramName does: void Py_SetProgramName(const wchar_t *program_name) { ... PyMem_RawFree(_Py_path_config.program_name); _Py_path_config.program_name = _PyMem_RawWcsdup(program_name); So, it looks like 3.7.4 Python duplicates its argument, which explains the leak found by Valgrind. It looks better to respect the doc and not have GDB freeing the string given to Py_SetProgramName, and avoid the leak error by declaring the progname_copy static. This will work with Python versions that really use this string without duplicating it, and avoids a leak report for Python version that duplicates it. ==4023== 200 bytes in 1 blocks are definitely lost in loss record 4,545 of 7,116^M ==4023== at 0x4C29F33: malloc (vg_replace_malloc.c:307)^M ==4023== by 0x446D27: xmalloc (alloc.c:60)^M ==4023== by 0x657C77: do_start_initialization (python.c:1610)^M ==4023== by 0x657C77: _initialize_python() (python.c:1823)^M ==4023== by 0x75FE24: initialize_all_files() (init.c:231)^M ==4023== by 0x708A94: gdb_init(char*) (top.c:2242)^M ==4023== by 0x5E7460: captured_main_1 (main.c:857)^M ==4023== by 0x5E7460: captured_main (main.c:1161)^M ==4023== by 0x5E7460: gdb_main(captured_main_args*) (main.c:1186)^M ==4023== by 0x4122D4: main (gdb.c:32)^M gdb/ChangeLog 2019-09-09 Philippe Waroquiers <philippe.waroquiers@skynet.be> * python/python.c (do_start_initialization): Make progname_copy static, to avoid a leak report.
2019-09-09i386: Adjust for new output format from readelfH.J. Lu14-13/+44
PR binutils/24887 * testsuite/ld-i386/property-1.r: Adjust for new output format from readelf. * testsuite/ld-i386/property-1a.r: Likewise. * testsuite/ld-i386/property-2.r: Likewise. * testsuite/ld-i386/property-2a.r: Likewise. * testsuite/ld-i386/property-3.r: Likewise. * testsuite/ld-i386/property-3a.r: Likewise. * testsuite/ld-i386/property-4.r: Likewise. * testsuite/ld-i386/property-4a.r: Likewise. * testsuite/ld-i386/property-5.r: Likewise. * testsuite/ld-i386/property-5a.r: Likewise. * testsuite/ld-i386/property-6.r: Likewise. * testsuite/ld-i386/property-7.r: Likewise. * testsuite/ld-i386/property-7a.r: Likewise. * testsuite/ld-i386/property-1.r: Likewise. * testsuite/ld-i386/property-1a.r: Likewise. * testsuite/ld-i386/property-2.r: Likewise. * testsuite/ld-i386/property-2a.r: Likewise. * testsuite/ld-i386/property-3.r: Likewise. * testsuite/ld-i386/property-3a.r: Likewise. * testsuite/ld-i386/property-4.r: Likewise. * testsuite/ld-i386/property-4a.r: Likewise. * testsuite/ld-i386/property-5.r: Likewise. * testsuite/ld-i386/property-5a.r: Likewise. * testsuite/ld-i386/property-6.r: Likewise. * testsuite/ld-i386/property-7.r: Likewise. * testsuite/ld-i386/property-7a.r: Likewise.
2019-09-09Add markers for 2.33 branch to NEWS and ChangeLog files.Phil Blundell18-0/+60
2019-09-09Automatic date update in version.inGDB Administrator1-1/+1
2019-09-08Truncate long TUI window titlesTom Tromey6-12/+25
If a TUI window has a long title, it can overflow the title line. This changes the TUI to use just the tail part of the title in this case. gdb/ChangeLog 2019-09-08 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (box_win): Truncate long window titles. gdb/testsuite/ChangeLog 2019-09-08 Tom Tromey <tom@tromey.com> * gdb.tui/resize.exp: Remove setup_xfail. * gdb.tui/regs.exp: Remove setup_xfail. * gdb.tui/basic.exp: Remove setup_xfail.
2019-09-08Automatic date update in version.inGDB Administrator1-1/+1
2019-09-07Change lookup_symbol's block_index parameter type to block_enumSimon Marchi5-9/+23
The only two values valid to pass to the block_index parameter of quick_symbol_functions::lookup_symbol are GLOBAL_BLOCK and STATIC_BLOCK, part of enum block_enum. Change the type of that parameter to block_enum. Change also the block_index field of dw2_symtab_iterator in the same way.. This makes it consistent with dw2_debug_names_iterator, which already uses block_enum for its block_index field. This is a follow-up to this thread: https://sourceware.org/ml/gdb-patches/2019-08/msg00097.html gdb/ChangeLog: * dwarf2read.c (struct dw2_symtab_iterator) <block_index>: Change type to gdb::optional<block_enum>. (dw2_symtab_iter_init): Change block_index parameter type to gdb::optional<block_enum>. (dw2_lookup_symbol): Change block_index parameter type to block_enum.c (dw2_debug_names_lookup_symbol): Likewise. * psymtab.c (psym_lookup_symbol): Likewise. * symfile-debug.c (debug_qf_lookup_symbol): Likewise. * symfile.h (struct quick_symbol_functions) <lookup_symbol>: Likewise.
2019-09-07Automatic date update in version.inGDB Administrator1-1/+1
2019-09-06un-XFAIL under Clang tests using labelsDavid Blaikie4-14/+6
gdb/testsuite/ * gdb.base/label.exp: un-XFAIL label related tests under Clang. * gdb.cp/cplabel.exp: Ditto. * gdb.linespec/ls-errs.exp: Ditto.
2019-09-06Change int to bool for the relocate_* functionsChristian Biesinger3-8/+15
These parameters are only used as bools. This also renames "flag" to "relocatable" to make it clearer what it does. gdb/ChangeLog: 2019-09-06 Christian Biesinger <cbiesinger@google.com> * defs.h (relocate_gdb_directory): Change int to bool in signature and rename flag to relocatable. * main.c (relocate_path): Likewise. (relocate_gdb_directory): Likewise.
2019-09-06beos.em qsort predicate tidyAlan Modra2-29/+30
lang_input_section_type** is better than lang_statement_union_type** here since that is in fact the type passed to the qsort predicate, and I think it's worth factoring out the common indirections. * emultempl/beos.em (sort_by_file_name): Use appropriate intermediary variables. (sort_by_section_name): Likewise.
2019-09-06bfd_get_filenameAlan Modra23-49/+87
This macro says: /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ I reckon that isn't such a good idea since it can result in char* variables where const char* is appropriate. Not very many places need the char* cast. bfd/ * aout-target.h (object_p): Formatting. * bfd-in.h (bfd_get_filename): Don't cast to char*. * corefile.c (generic_core_file_matches_executable_p): Constify variables and remove cast. * bfd-in2.h: Regenerate. binutils/ * nm.c (print_object_filename_bsd, print_object_filename_sysv), (print_object_filename_posix, print_archive_filename_bsd), (print_archive_filename_sysv, print_archive_filename_posix), (print_archive_member_bsd, print_archive_member_sysv), (print_archive_member_posix): Constify parameter. (struct output_fns <print_object_filename, print_archive_filename>), (<print_archive_member>): Likewise. * objcopy.c (copy_archive): Add cast for make_tempdir. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Constify variable. * emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise. gdb/ * coffread.c (coff_symfile_read): Constify filename variable. * dbxread.c (dbx_symfile_init, coffstab_build_psymtabs), (elfstab_build_psymtabs, stabsect_build_psymtabs): Likewise. * gdb_bfd.c (gdb_bfd_close_or_warn): Likewise. * solib.c (reload_shared_libraries_1): Likewise. * symfile.c (reread_symbols): Likewise. * solib-aix.c (solib_aix_bfd_open): Add cast for xfree of filename. * solib-darwin.c (darwin_bfd_open): Likewise. * symfile-mem.c (symbol_file_add_from_memory): Likewise. sim/cris/ * sim-if.c (sim_open): Constify filename variable.
2019-09-06Automatic date update in version.inGDB Administrator1-1/+1
2019-09-05Fix PR ld/24574Eric Botcazou2-0/+11
This restores a line that has been dropped when the auto-import feature of the PE-COFF linker was overhauled about one year. It is necessary for GDB to properly resolve extern symbol in DLLs. ld/ChangeLog * pe-dll.c (pe_find_data_imports): Replace again the original name of the undefined symbol with the __imp_ prefixed one after it is resolved.
2019-09-05[gdb/testsuite] Restore breakpoint command in ui-redirect.expTom de Vries3-8/+56
In gdb.base/ui-redirect.exp, the "save breakpoint" command is used to write the current breakpoints to a file, but the actual output is not verified. Consequently, the test has regressed in that the "print 1" command associated with a breakpoint on main is removed by a subsequent runto_main, which first deletes all breakpoints: ... (gdb) break main Breakpoint 1 at 0x4004d7: file start.c, line 34. (gdb) commands Type commands for breakpoint(s) 1, one per line. End with a line saying just "end". > PASS: gdb.base/ui-redirect.exp: commands print 1 > PASS: gdb.base/ui-redirect.exp: print 1 end (gdb) PASS: gdb.base/ui-redirect.exp: end delete breakpoints Delete all breakpoints? (y or n) y ... and consequently the "save breakpoint" output is missing the breakpoint command for main: ... break main - commands - print 1 - end break foo break bar ... Fix this by replacing "gdb_breakpoint main" with runto_main, and verifying the "save breakpoints" output. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-05 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (cmp_file_string): New proc. * gdb.base/ui-redirect.exp: Replace "gdb_breakpoint main" with runto_main. Verify save breakpoints output.
2019-09-05PowerPC warning on symbol+offset@gotAlan Modra2-3/+8
* config/tc-ppc.c (ppc_elf_suffix): Display the relocation operator on GOT reloc warnings/errors.
2019-09-05PowerPC64 GOT_PCREL relocsAlan Modra2-53/+31
PC-relative relocs typically use the addend in adjusting what they are relative to. For example: bcl 20,31,1f 1: mflr 12 addi 12,12,xxx-1b generates "R_PPC64_REL16 xxx+0x4" for the addi (when little-endian). The addend reflects the fact that you want the offset relative to the previous insn not the current one in this case. So the question is, will we ever want to do something like that for an instruction using R_PPC64_GOT_PCREL34? I thought so at the time I first implemented support in ld but at the time I think the hardware was possibly going to support pcrel+offset+reg addressing. In which case you might want something like: load_big_offset_into_r2 pld 3,sym-big_offset@got@pcrel(2) which would be a way of supporting more than 8G offsets from code to the GOT. We could do the same with load_big_offset_into_r2 pla 9,sym-big_offset@got@pcrel ldx 3,9,2 However, this is really a poor version of TOC-pointer relative code. So let's go with an addend on R_PPC64_GOT_PCREL34 meaning that sym+addend should be put in a GOT entry, and the relocation calculate the pc-relative offset to that GOT entry. Note that this is an extension to the ABI, which says (by the expression given for GOT relocs) that non-zero addends on GOT and PLT relocs are ignored. This is true for all GOT/PLT relocs, not just the pcrel ones. * elf64-ppc.c (ppc64_elf_check_relocs): Interpret an addend in GOT_PCREL and PLT_PCREL relocs as affecting the value stored in the GOT/PLT entry rather than affecting the offset to that GOI/PLT entry. (ppc64_elf_edit_toc, ppc64_elf_relocate_section): Likewise.
2019-09-05R_PPC64_PCREL_OPTAlan Modra5-17/+75
The loads and stores handled in the second instruction of a sequence marked by R_PPC64_PCREL_OPT may be a prefix instruction. For example: pld ra,symbol@got@pcrel 0: pld rt,off(ra) .reloc 0b-8,R_PPC64_PCREL_OPT,(.-8)-(0b-8) can be optimised to pld rt,symbol+off@pcrel pnop * elf64-ppc.c (xlate_pcrel_opt): Handle prefix loads and stores in second instruction. (ppc64_elf_relocate_section): Likewise.
2019-09-05PR24955, libbfd terminating program on out of memoryAlan Modra7-9/+85
This patch fixes the worst of the cases where libbfd might terminate a program due to calling xstrdup or xmalloc. I've also fixed some error paths that didn't clean up properly. PR 24955 * libbfd-in.h (bfd_strdup): New inline function. * archive.c (_bfd_get_elt_at_filepos): Use bfd_strdup. Close bfd on error. * elfcode.h (_bfd_elf_bfd_from_remote_memory): Use bfd_strdup. * opncls.c (bfd_fopen): Use bfd_strdup. Close fd and stream on error. (bfd_openstreamr): Use bfd_strdup. (bfd_openr_iovec, bfd_openw, bfd_create): Likewise. * plugin.c (try_load_plugin): Use bfd_malloc. * libbfd.h: Regenerate.
2019-09-05Automatic date update in version.inGDB Administrator1-1/+1
2019-09-04Avoid expect's buffer overflow in info-var.exp test.Philippe Waroquiers2-4/+8
Once the executable is started, info variables can show thousands of variables belonging to glibc (see below). This long list of variables then causes the test to fail, due to expect's buffer overflow: Running /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var.exp ... ERROR: internal buffer is full. ERROR: internal buffer is full. ERROR: internal buffer is full. Fix this by testing 'info variables' without running the executable. gdb ./info-var ... Reading symbols from ./info-var... (gdb) |info variables|wc 27 54 971 (gdb) start Temporary breakpoint 1 at 0x1129: file /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c, line 23. Starting program: /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/outputs/gdb.base/info-var/info-var Temporary breakpoint 1, main () at /bd/home/philippe/gdb/git/build_binutils-gdb/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/info-var-f1.c:23 23 return global_var + get_offset() + f1_var; (gdb) |info variables|wc 4334 14581 130738 (gdb) gdb/testsuite/ChangeLog 2019-09-04 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/info-var.exp: Test info variables without running to main, to avoid expect's buffer overflow.
2019-09-04Automatic date update in version.inGDB Administrator1-1/+1
2019-09-03gdb: Handle missing domain types in: maintenance print psymbolsAndrew Burgess2-0/+11
Some domain_enum values were not handled in print_partial_symbols which means that 'maintenance print psymbols' would print '<invalid domain>' when it shouldn't have. gdb/ChangeLog: * psymtab.c (print_partial_symbols): Handle missing domain_enum values MODULE_DOMAIN and COMMON_BLOCK_DOMAIN.
2019-09-03Handle biased typesTom Tromey15-34/+251
In Ada, the programmer can request that a range type with a non-zero base be stored in the minimal number of bits required for the range. This is done by biasing the values; so, for example, a range of -7..-4 may be stored as two bits with a bias of -7. This patch implements this for gdb. It is done by adding a bias to struct range_bounds and then adjusting a few spots to handle this. The test case is written to use -fgnat-encodings=minimal, but a future compiler patch will change the compiler to emit DW_AT_GNU_bias with -fgnat-encodings=gdb. It seemed good to get the gdb patch in first. Tested on x86-64 Fedora 29; plus a variety of targets using AdaCore's internal test suite. gdb/ChangeLog 2019-09-03 Tom Tromey <tromey@adacore.com> * ada-valprint.c (ada_val_print_num): Don't recurse for range types. (has_negatives): Unbias a range type bound. * dwarf2read.c (read_subrange_type): Handle DW_AT_GNU_bias. * gdbtypes.c (operator==): Handle new field. (create_range_type): Add "bias" parameter. (create_static_range_type, resolve_dynamic_range): Update. * gdbtypes.h (struct range_bounds) <bias>: New member. (create_range_type): Add bias parameter. * printcmd.c (print_scalar_formatted): Unbias range types. * value.c (unpack_long): Unbias range types. (pack_long): Bias range types. gdb/testsuite/ChangeLog 2019-09-03 Tom Tromey <tromey@adacore.com> * gdb.ada/bias.exp: New file. * gdb.ada/bias/bias.adb: New file. * gdb.ada/print_chars.exp: Add regression test. * gdb.ada/print_chars/foo.adb (My_Character): New type. (MC): New variable.
2019-09-03Fix buffer underrun bug in the TI C30 disassembler.Nick Clifton2-1/+9
PR 24961 * tic30-dis.c (get_indirect_operand): Check for bufcnt being greater than zero before indexing via (bufcnt -1).
2019-09-03Fix a potential buffer overrun in the MMIX disassembler when processing a ↵Nick Clifton2-37/+66
corrupt input file. PR 24958 * mmix-dis.c (MAX_REG_NAME_LEN): Define. (MAX_SPEC_REG_NAME_LEN): Define. (struct mmix_dis_info): Use defined constants for array lengths. (get_reg_name): New function. (get_sprec_reg_name): New function. (print_insn_mmix): Use new functions.
2019-09-03Automatic date update in version.inGDB Administrator1-1/+1
2019-09-02Check arguments for all probes before using themAlan Hayward2-4/+19
There is a long standing bug in the Arm toolchain where invalid stap probes get created due to the probes referring to symbols which have been resolved away. More details are here: https://bugzilla.redhat.com/show_bug.cgi?id=1196181 When these invalid probes are present, GDB will create the breakpoints and then fail to stop. The errors are only spotted the first time GDB stops, which is too late. The solution is to ensure the arguments for all the probes are resolved before using them. This fixes >100 timeouts when running break-interp.exp when using bad probes. gdb/ChangeLog: * solib-svr4.c (svr4_find_and_create_probe_breakpoints): Check all probe arguments.
2019-09-02Use gdbarch for probe::get_argument_countAlan Hayward7-13/+20
The probe function get_argument_count does not need a frame, only the current gdbarch. Switch the code to pass gdbarch instead. No functional changes. gdb/ChangeLog: * break-catch-throw.c (fetch_probe_arguments): Use gdbarch. * dtrace-probe.c (dtrace_probe::get_argument_count): Likewise. * probe.c (probe_safe_evaluate_at_pc) (compute_probe_arg) (compile_probe_arg): Likewise. * probe.h (get_argument_count): Likewise. * solib-svr4.c (solib_event_probe_action): Likewise. * stap-probe.c (stap_probe::get_argument_count): Likewise.
2019-09-02Refactor svr4_create_solib_event_breakpointsAlan Hayward2-67/+66
Move the bulk of svr4_create_solib_event_breakpoints into a new function to simplify the logic. No functional changes. gdb/ChangeLog: * solib-svr4.c (svr4_find_and_create_probe_breakpoints): Move code to here... (svr4_create_solib_event_breakpoints): ...from here.
2019-09-02Re: Memory leak in dwarf2.cAlan Modra2-18/+22
PR 11983 * dwarf2.c (read_alt_indirect_string): Free debug_filename on success. Tidy. (read_alt_indirect_ref): Likewise.
2019-09-02Memory leak in dwarf2.cAlan Modra2-7/+15
This fixes a small leak of debug_filename. bfd_openr copies the file name since git commit 1be5090bca. PR 11983 * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Free debug_filename on success. Tidy.
2019-09-02Automatic date update in version.inGDB Administrator1-1/+1
2019-08-31RISC-V: Fix linker problems with tls copy relocs.Jim Wilson2-0/+20
The linker doesn't allocate memory space for sections that are only SEC_ALLOC and SEC_THREAD_LOCAL. See the IS_TBSS test in ld/ldlang.c. So we need to pretend that .tdata.dyn sections have contents to get the right result. It will be marked this way anyways if there is a .tdata section to merge with. bfd/ PR 23825 * elfnn-riscv.c (riscv_elf_create_dynamic_sections): Add SEC_LOAD, SEC_DATA, and SEC_HAS_CONTENTS to .tdata.dyn section.
2019-09-01Automatic date update in version.inGDB Administrator1-1/+1
2019-08-31Automatic date update in version.inGDB Administrator1-1/+1
2019-08-30RISC-V: Force linker error exit after unresolvable reloc.Jim Wilson2-1/+9
This was noticed while trying to test the compiler -msave-restore support. Putting non-pic code in a shared library gives a linker error, but doesn't stop the build. rohan:2030$ cat libtmp.c extern int sub2 (int); int sub (int i) { return sub2 (i + 10); } rohan:2031$ cat libtmp2.c extern int sub (int); int sub2 (int i) { return sub (i + 10); } rohan:2032$ riscv64-unknown-linux-gnu-gcc --shared -o libtmp.so libtmp.c rohan:2033$ riscv64-unknown-linux-gnu-gcc --shared -o libtmp2.so libtmp2.c libtmp.so /home/jimw/FOSS/install-riscv64/lib/gcc/riscv64-unknown-linux-gnu/8.3.0/../../../../riscv64-unknown-linux-gnu/bin/ld: /tmp/cctrsIBe.o(.text+0x18): unresolvable R_RISCV_CALL relocation against symbol `sub' rohan:2034$ echo $? 0 rohan:2035$ ls -lt libtmp2.so -rwxr-xr-x 1 jimw jimw 6912 Aug 30 14:32 libtmp2.so rohan:2036$ The patch fixes this by forcing a linker error. I now get this. ohan:2059$ sh tmp.script /home/jimw/FOSS/BINUTILS/X-riscv64-linux/ld/ld-new: libtmp2.o(.text+0x18): unresolvable R_RISCV_CALL relocation against symbol `sub' /home/jimw/FOSS/BINUTILS/X-riscv64-linux/ld/ld-new: final link failed: bad value rohan:2060$ echo $? 1 rohan:2061$ ls -lt libtmp2.so ls: cannot access 'libtmp2.so': No such file or directory bfd/ * elfnn-riscv.c (riscv_elf_relocate_section): For unresolvable reloc error, call bfd_set_error, set ret to FALSE, and goto out label.
2019-08-30Remove "\nError: " suffix from nat/fork-inferior.c:trace_start_error warning ↵Sergio Durigan Junior2-1/+6
message Rationale: https://sourceware.org/ml/gdb-patches/2019-08/msg00651.html This very simple patch removes the "\nError: " suffix from the warning message printed by nat/fork-inferior.c:trace_start_error. This proved to just pollute the screen, causing things like: Starting program: /usr/bin/true warning: Could not trace the inferior process. Error: warning: ptrace: Permission denied This "Error: " string is not useful at all, and can confuse things, therefore let's just remove it and simplify the resulting messages: Starting program: /usr/bin/true warning: Could not trace the inferior process. warning: ptrace: Permission denied gdb/ChangeLog: 2019-08-30 Sergio Durigan Junior <sergiodj@redhat.com> * nat/fork-inferior.c (trace_start_error): Remove "\nError: " suffix from warning message.
2019-08-30Remove tui_win_info::refresh_allTom Tromey7-49/+14
The TUI has two duplicate "re-render this window" methods, "rerender" and "refresh_all". They differ only slightly in semantics, so I wanted to see if they could be unified. After looking into this, I decided that refresh_all was not needed. There are 4 calls to tui_refresh_all_win (the only caller of this method): 1. tui_enable. This sets the layout, which renders the windows. 2. tui_cont_sig. Here, I think it's sufficient to simply redraw the current window contents from the curses backing store, because gdb state didn't change while it was suspended 3. tui_dispatch_ctrl_char. This is the C-l handler, and here it's explicitly enough to just refresh the screen (as above). 4. tui_refresh_all_command. This is the command equivalent of C-l. So, this patch removes this method entirely and simplifies tui_refresh_all_win. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <refresh_all>: Don't declare. * tui/tui-winsource.c (tui_source_window_base::refresh_all): Remove. * tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or tui_show_locator_content. * tui/tui-regs.h (struct tui_data_window) <refresh_all>: Don't declare. * tui/tui-regs.c (tui_data_window::refresh_all): Remove. * tui/tui-data.h (struct tui_win_info) <refresh_all>: Don't declare.
2019-08-30Don't call wrefresh from tui_cont_sigTom Tromey2-2/+4
tui_cont_sig does not need to call wrefresh, because this is already done by tui_refresh_all_win. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-io.c (tui_cont_sig): Don't call wrefresh.
2019-08-30Minor rearrangement of tui-stack.cTom Tromey2-13/+12
This move _initialize_tui_stack to the end of tui-stack.c, per the gdb style; and then removes two unnecessary forward declarations. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-stack.c (_initialize_tui_stack): Move later. Remove unnecessary forward declarations.
2019-08-30Make tui_locator_window::set_locator_fullname re-renderTom Tromey2-3/+8
This changes tui_locator_window::set_locator_fullname to re-render the locator window, so that the callers don't need to do this. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-stack.c (tui_locator_window::set_locator_fullname): Call rerender. (tui_update_locator_fullname, tui_show_frame_info): Don't call tui_show_locator_content.
2019-08-30Swap tui_show_locator_content and tui_locator_window::rerenderTom Tromey2-21/+23
This swaps the bodies ot tui_show_locator_content and tui_locator_window::rerender, so that the latter does the work, and the former is now just an exported convenience wrapper. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-stack.c (tui_show_locator_content): Move lower. Rewrite. (tui_locator_window::rerender): Rewrite using body of previous tui_show_locator_content.
2019-08-30Turn two locator functions into methodsTom Tromey3-47/+59
This changes tui_set_locator_fullname and tui_set_locator_info to be methods on tui_locator_window. This enables some subsequent cleannups. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-stack.h (struct tui_locator_window) <set_locator_info, set_locator_fullname>: New methods. * tui/tui-stack.c (tui_locator_window::set_locator_fullname): Rename from tui_set_locator_fullname. (tui_locator_window::set_locator_info): Rename from tui_set_locator_info. Return bool. (tui_update_locator_fullname, tui_show_frame_info): Update.
2019-08-30Don't call tui_refresh_all from show_layoutTom Tromey2-1/+4
show_layout calls tui_refresh_all in one case. However, it doesn't need to any more, because the resize method on each window will also update the contents. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_layout): Don't call tui_refresh_all.