aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2020-10-12Eliminate mi_run_to_main, introduce mi_clean_restartusers/palves/runto_mainPedro Alves59-400/+184
Since we now have mi_runto_main which is like runto_main, eliminate mi_run_to_main, in favor of a new MI clean_restart counterpart -- mi_clean_restart -- and mi_runto_main. This makes MI testcases look a bit more like CLI testcases. gdb/testsuite/ChangeLog: * lib/mi-support.exp (mi_clean_restart): New. (mi_run_to_main): Delete. All callers adjust to use mi_clean_restart / mi_runto_main. Change-Id: I34920bab4fea1f23fb752928c2969c1f6ad714b6
2020-10-12gdb/testsuite/: Use "-qualified" in explicit "break main", etc.Pedro Alves45-83/+83
Similar to the previous patch, but this time add "-q" to tests that do "break main", "list main", etc. explicitly. gdb/testsuite/ChangeLog: * config/monitor.exp: Use "list -q". * gdb.arch/gdb1558.exp: Use "break -q". * gdb.arch/i386-permbkpt.exp: Use "break -q". * gdb.arch/i386-prologue-skip-cf-protection.exp: Use "break -q". * gdb.base/break.exp: Use "break -q", "list -q" and "tbreak -q". * gdb.base/commands.exp: Use "break -q". * gdb.base/condbreak.exp: Use "break -q". * gdb.base/ctf-ptype.exp: Use "list -q". * gdb.base/define.exp: Use "break -q". * gdb.base/del.exp: Use "break -q". * gdb.base/fullname.exp: Use "break -q". * gdb.base/hbreak-in-shr-unsupported.exp: Use "hbreak -q". * gdb.base/hbreak-unmapped.exp: Use "hbreak -q". * gdb.base/hbreak2.exp: Use "hbreak -q" and "list -q". * gdb.base/hw-sw-break-same-address.exp: Use "break -q" and "hbreak -q". * gdb.base/included.exp: Use "list -q". * gdb.base/label.exp: Use "break -q". * gdb.base/lineinc.exp: Use "break -q". * gdb.base/list.exp: Use "list -q". * gdb.base/macscp.exp: Use "list -q". * gdb.base/pending.exp: Use "break -q". * gdb.base/prologue-include.exp: Use "break -q". * gdb.base/ptype.exp: Use "list -q". * gdb.base/sepdebug.exp: Use "break -q", "list -q" and "tbreak -q". * gdb.base/server-del-break.exp: Use "break -q". * gdb.base/style.exp: Use "break -q". * gdb.base/symbol-without-target_section.exp: Use "list -q". * gdb.base/watchpoint-reuse-slot.exp: Use "hbreak -q". * gdb.cp/exception.exp: Use "tbreak -q". * gdb.dwarf2/dw2-error.exp: Use "break -q". * gdb.dwarf2/fission-mix.exp: Use "break -q". * gdb.dwarf2/fission-reread.exp: Use "break -q". * gdb.dwarf2/pr13961.exp: Use "break -q". * gdb.linespec/explicit.exp: Use "list -q". * gdb.linespec/linespec.exp: Use "break -q". * gdb.mi/mi-simplerun.exp: Use "--qualified". * gdb.python/py-mi-objfile-gdb.py: Use "list -q". * gdb.server/bkpt-other-inferior.exp: Use "break -q". * gdb.server/connect-without-multi-process.exp: Use "break -q". * gdb.trace/change-loc.exp: Use "break -q". * gdb.trace/pending.exp: Use "break -q". * gdb.tui/basic.exp: Use "list -q". * gdb.tui/list-before.exp: Use "list -q". * gdb.tui/list.exp: Use "list -q". * lib/gdb.exp (gdb_has_argv0): Use "break -q". Change-Id: Iab9408e90ed71cbb111cd737d2d81b5ba8adb108
2020-10-12gdb/testsuite/: Use -qualified in runto_main / mi_runto_mainPedro Alves4-6/+10
In some runtimes, there may be a "main" function in some class or namespace. The breakpoint created by runto_main may therefore have unexpected locations on some other functions than the actual main. These breakpoint locations can unexpectedly get hit during tests and lead to failures. I saw this while playing with AMD's ROCm toolchain -- I wrote a board file to run the testsuite against device kernels. There, the runtime calls a "main" function before the device kernel code is reached: Thread 4 "bit_extract" hit Breakpoint 1, 0x00007ffeea140960 in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1 (gdb) bt #0 0x00007ffeea140960 in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1 #1 0x00007ffeea2257a5 in lld::elf::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1 #2 0x00007ffeea1bc374 in COMGR::linkWithLLD(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1 #3 0x00007ffeea1bfb09 in COMGR::InProcessDriver::execute(llvm::ArrayRef<char const*>) () from /opt/rocm/lib/libamd_comgr.so.1 #4 0x00007ffeea1c4da9 in COMGR::AMDGPUCompiler::linkToExecutable() () from /opt/rocm/lib/libamd_comgr.so.1 #5 0x00007ffeea1fde20 in dispatchCompilerAction(amd_comgr_action_kind_s, COMGR::DataAction*, COMGR::DataSet*, COMGR::DataSet*, llvm::raw_ostream&) () from /opt/rocm/lib/libamd_comgr.so.1 #6 0x00007ffeea203a87 in amd_comgr_do_action () from /opt/rocm/lib/libamd_comgr.so.1 ... To avoid that, pass "qualified" to runto, in runto_main, so that gdb_breakpoint ends up creating a breakpoint with -qualified. This avoids creating breakpoints locations for other unrelated "main" functions. Note: I first tried making runto itself use "-qualified", but that caused regressions in the gdb.ada/ tests, which use runto without specifying the whole fully-qualified function name (i.e., without the package). So I end up restricting the -qualified to runto_main/mi_runto_main. The gdb.base/ui-redirect.exp change is necessary because that testcase is looking at what "save breakpoint" generates. gdb/testsuite/ChangeLog: * gdb.base/ui-redirect.exp: Expect "break -qualified main" in saved breakpoints file. * gdb.guile/scm-breakpoint.exp: Expect "-qualified main" when inspecting breakpoint list. * lib/gdb.exp (runto_main): Add "qualified" to options. * lib/mi-support.exp (mi_runto_helper): Add 'qualified' parameter, and handle it. (mi_runto_main): Pass 1 as qualified argument. Change-Id: I51468359ab0a518f05f7c0394c97f7e33b45fe69
2020-10-12Introduce mi_runto_mainPedro Alves11-18/+24
This adds an mi_runto_main routine, very much like the runto_main CLI counterpart. Note there's already a mi_run_to_main (extra underscore in "run_to"), but unlike its intro comment says, that does more than the CLI's runto_main -- it also starts GDB. I would like to eliminate that other one by introducing a mi_clean_restart function instead. That is done later in the series. gdb/testsuite/ChangeLog: * lib/mi-support.exp (mi_runto_main): New proc. (mi_run_to_main): Use it. * gdb.mi/mi-catch-cpp-exceptions.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi-var-invalidate.exp: Likewise. * mi-var-list-children-invalid-grandchild.exp: Likewise. * gdb.mi/mi2-amd64-entry-value.exp: Likewise. * gdb.mi/new-ui-mi-sync.exp: Likewise. * gdb.mi/user-selected-context-sync.exp: Likewise. * gdb.opt/inline-cmds.exp: Likewise. * gdb.python/py-framefilter-mi.exp: Likewise. * gdb.python/py-mi.exp: Likewise. Change-Id: I2e49ca7b0b61cea57c1202e5dfa32417e6a4403d
2020-10-12'runto main' -> 'runto_main' throughoutPedro Alves56-63/+63
This commit does 's/runto main/runto_main/g' throughout. gdb/testsuite/ChangeLog: * gdb.ada/fun_in_declare.exp: Use "runto_main" instead of "runto main". * gdb.ada/small_reg_param.exp: Likewise. * gdb.arch/powerpc-d128-regs.exp: Likewise. * gdb.base/annota1.exp: Likewise. * gdb.base/anon.exp: Likewise. * gdb.base/breakpoint-in-ro-region.exp: Likewise. * gdb.base/dprintf-non-stop.exp: Likewise. * gdb.base/dprintf.exp: Likewise. * gdb.base/gdb11530.exp: Likewise. * gdb.base/gdb11531.exp: Likewise. * gdb.base/gnu_vector.exp: Likewise. * gdb.base/interrupt-noterm.exp: Likewise. * gdb.base/memattr.exp: Likewise. * gdb.base/step-over-syscall.exp: Likewise. * gdb.base/watch-cond-infcall.exp: Likewise. * gdb.base/watch-read.exp: Likewise. * gdb.base/watch-vfork.exp: Likewise. * gdb.base/watch_thread_num.exp: Likewise. * gdb.base/watchpoint-stops-at-right-insn.exp: Likewise. * gdb.guile/scm-frame-inline.exp: Likewise. * gdb.linespec/explicit.exp: Likewise. * gdb.opt/inline-break.exp: Likewise. * gdb.python/py-frame-inline.exp: Likewise. * gdb.reverse/break-precsave.exp: Likewise. * gdb.reverse/break-reverse.exp: Likewise. * gdb.reverse/consecutive-precsave.exp: Likewise. * gdb.reverse/consecutive-reverse.exp: Likewise. * gdb.reverse/finish-precsave.exp: Likewise. * gdb.reverse/finish-reverse.exp: Likewise. * gdb.reverse/fstatat-reverse.exp: Likewise. * gdb.reverse/getresuid-reverse.exp: Likewise. * gdb.reverse/i386-precsave.exp: Likewise. * gdb.reverse/i386-reverse.exp: Likewise. * gdb.reverse/i386-sse-reverse.exp: Likewise. * gdb.reverse/i387-env-reverse.exp: Likewise. * gdb.reverse/i387-stack-reverse.exp: Likewise. * gdb.reverse/insn-reverse.exp: Likewise. * gdb.reverse/machinestate-precsave.exp: Likewise. * gdb.reverse/machinestate.exp: Likewise. * gdb.reverse/pipe-reverse.exp: Likewise. * gdb.reverse/readv-reverse.exp: Likewise. * gdb.reverse/recvmsg-reverse.exp: Likewise. * gdb.reverse/rerun-prec.exp: Likewise. * gdb.reverse/s390-mvcle.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/solib-reverse.exp: Likewise. * gdb.reverse/step-precsave.exp: Likewise. * gdb.reverse/step-reverse.exp: Likewise. * gdb.reverse/time-reverse.exp: Likewise. * gdb.reverse/until-precsave.exp: Likewise. * gdb.reverse/until-reverse.exp: Likewise. * gdb.reverse/waitpid-reverse.exp: Likewise. * gdb.reverse/watch-precsave.exp: Likewise. * gdb.reverse/watch-reverse.exp: Likewise. * gdb.threads/kill.exp: Likewise. * gdb.threads/tid-reuse.exp: Likewise. Change-Id: I70f457253836019880b4d7fb981936afa56724c2
2020-10-11gdb: detect main function even when there's no matching msymbolAndrew Burgess4-10/+33
Currently, GDB will only stop the backtrace at the main function if there is a minimal symbol with the matching name. In Fortran programs compiled with gfortran this is not the case. The main function is present in the DWARF, and as marked as DW_AT_main_subprogram, but there's no minimal symbol. This commit extends `inside_main_func` to check the full symbols if no matching minimal symbol is found. There's an updated test case that covers this change. gdb/ChangeLog: * frame.c (inside_main_func): Check full symbols as well as minimal symbols. gdb/testsuite/ChangeLog: * gdb.fortran/mixed-lang-stack.exp (run_tests): Update expected output of backtrace.
2020-10-09ada-lang.c::advance_wild_match improve doc and parameter+temporaries typesJoel Brobecker2-6/+11
This commit fixes the type of one of the parameters as well as a couple of temporaries. While at it, the function's description is slightly rewritten to make it a little clearer what the function does. gdb/ChangeLog: * ada-lang.c (advance_wild_match): Rewrite the function's description. Change the type of target0, t0 and t1 to char.
2020-10-09Fix bit offset regressionTom Tromey5-10/+23
The type-safe attribute patch introduced a regression that can occur when the DW_AT_bit_offset value is negative. This can happen with some Ada programs. This patch fixes the problem. It also fixes a minor oddity in the existing scalar storage test -- this test was intended to assign a smaller number of bits to the field. 2020-10-09 Tom Tromey <tromey@adacore.com> * dwarf2/read.c (dwarf2_add_field): Handle signed offsets. gdb/testsuite/ChangeLog 2020-10-09 Tom Tromey <tromey@adacore.com> * gdb.ada/scalar_storage/storage.adb (Another_Range): New type. (Rec): Add field. Fix range. * gdb.ada/scalar_storage.exp: Update.
2020-10-09Return std::string from ada_encodeTom Tromey4-40/+34
This changes ada_encode to return a std::string. This simplifies it somewhat, removes a use of GROW_VECT, and is also simpler for callers to use. gdb/ChangeLog 2020-10-09 Tom Tromey <tromey@adacore.com> * ada-lang.h (ada_encode): Return std::string. * ada-lang.c (ada_encode_1): Return std::string. (ada_encode): Likewise. (type_from_tag, ada_lookup_name_info::ada_lookup_name_info): Update. * ada-exp.y (block_lookup, write_var_or_type): Update.
2020-10-09Handle void results as unformatted printsHannes Domani4-0/+17
When printing void results without any format letter, they are output as expected: (gdb) p $abcd $1 = void (gdb) p (void)10 $2 = void But if any format letter (besides s) is used, it always outputs zero: (gdb) p/x $abcd $3 = 0x0 (gdb) p/x (void)10 $4 = 0x0 So this adds void results to the types handled like unformatted prints. gdb/ChangeLog: 2020-10-09 Hannes Domani <ssbssa@yahoo.de> PR exp/26714 * printcmd.c (print_formatted): Handle void results as unformatted prints. gdb/testsuite/ChangeLog: 2020-10-09 Hannes Domani <ssbssa@yahoo.de> PR exp/26714 * gdb.base/printcmds.exp: Add tests for void results.
2020-10-09gdb: Delay releasing target_desc_up in more casesAndrew Burgess10-66/+89
After commit: commit 51a948fdf0e14fb69ab9e0c79ae8b2415801f9a3 Date: Mon Jul 20 14:18:04 2020 +0100 gdb: Have allocate_target_description return a unique_ptr There were a few places where we could (should?) have delayed releasing the target_desc_up until a little later. This commit catches these cases. In the case of ARC, the target_desc_up is now exposed right out to gdbserver, which means making a small change there too. There should be no user visible changes after this commit. gdb/ChangeLog: * arch/aarch32.c (aarch32_create_target_description): Release the target_desc_up as late as possible. * arch/aarch64.c (aarch64_create_target_description): Likewise. * arch/amd64.c (amd64_create_target_description): Likewise. * arch/arc.c (arc_create_target_description): Return a target_desc_up, don't release it. * arch/arc.h (arc_create_target_description): Update declaration. (arc_lookup_target_description): Move target_desc_up into the cache, and return a borrowed pointer. * arch/arm.c (arm_create_target_description): Release the target_desc_up as late as possible. * arch/i386.c (i386_create_target_description): Likewise. * arch/riscv.h (riscv_create_target_description): Update declaration to match definition. * arch/tic6x.c (tic6x_create_target_description): Release the target_desc_up as late as possible. gdbserver/ChangeLog: * linux-arc-low.cc (arc_linux_read_description): Release the unique_ptr returned from arc_create_target_description.
2020-10-09gnulib: Ensure all libraries are used when building gdb/gdbserverAndrew Burgess2-3/+7
An issue was reported here related to building GDB on MinGW: https://sourceware.org/pipermail/gdb/2020-September/048927.html It was suggested here: https://sourceware.org/pipermail/gdb/2020-September/048931.html that the solution might be to make use of $(LIB_GETRANDOM), a variable defined in the gnulib makefile, when linking GDB. In fact I think the issue is bigger than just LIB_GETRANDOM. When using the script binutils-gdb/gnulib/update-gnulib.sh to reimport gnulib there is a lot of output from gnulib's gnulib-tool. Part of that output is this: You may need to use the following makefile variables when linking. Use them in <program>_LDADD when linking a program, or in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library. $(FREXPL_LIBM) $(FREXP_LIBM) $(INET_NTOP_LIB) $(LIBTHREAD) $(LIB_GETLOGIN) $(LIB_GETRANDOM) $(LIB_HARD_LOCALE) $(LIB_MBRTOWC) $(LIB_SETLOCALE_NULL) $(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise What I think this is telling us is that we should be including the value of all these variables on the link line for gdb and gdbserver. The problem though is that these variables are define in gnulib's makefile, but are not (necessarily) defined in GDB's makefile. One solution would be to recreate the checks that gnulib performs in order to recreate these variables in both gdb's and gdbserver's makefile. Though this shouldn't be too hard, most (if not all) of these checks are in the form macros defined in m4 files in the gnulib tree, so we could just reference these as needed. However, in this commit I propose a different solution. Currently, in the top level makefile, we give gdb and gdbserver a dependency on gnulib. Once gnulib has finished building gdb and gdbserver can start, these projects then have a hard coded (relative) path to the compiled gnulib library in their makefiles. In this commit I extend the gnulib configure script to install a new makefile fragment in the gnulib build directory. This new file will have the usual variable substitutions applied to it, and so can include the complete list (see above) of all the extra libraries that are needed when linking against gnulib. In fact the new makefile fragment defines three variables, these are: LIBGNU: The path to the archive containing gnulib. Can be used as a dependency as when this file changes gdb/gdbserver should be relinked. LIBGNU_EXTRA_LIBS: A list of linker -l.... flags that should be included in the link line of gdb/gdbserver. These are libraries that $(LIBGNU) depends on. This list is taken from the output of gnulib-tool, which is run by our gnulib/update-gnulib.sh script. INCGNU: A list of -I.... include paths that should be passed to the compiler, these are where the gnulib headers can be found. Now both gdb and gdbserver can include the makefile fragment and make use of these variables. The makefile fragment relies on the variable GNULIB_BUILDDIR being defined. This is checked for in the fragment, and was already defined in the makefiles of gdb and gdbserver. gdb/ChangeLog: * Makefile.in: Include Makefile.gnulib.inc. Don't define LIBGNU or INCGNU. Make use of LIBGNU_EXTRA_LIBS when linking. gdbserver/ChangeLog: * Makefile.in: Include Makefile.gnulib.inc. Don't define LIBGNU or INCGNU. Make use of LIBGNU_EXTRA_LIBS when linking. gnulib/ChangeLog: * Makefile.gnulib.inc.in: New file. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Install the new file.
2020-10-09Notify observers that directories have changed when using "directory" CLI ↵Jan Vrany4-2/+30
command gdb/ChangeLog * source.c (directory_command): Notify observers that "directories" parameter has changed. gdb/testsuite/ChangeLog * gdb.mi/mi-cmd-param-changed.exp: Check that notification is is emmited for both 'set directories' and 'directory' commands.
2020-10-08Style more output of "disassemble" commandTom Tromey4-9/+27
I noticed a couple of spots where the "disassemble" could style its output, but currently does not. This patch adds styling to the function name at the start of the disassembly, and any addresses printed there. gdb/ChangeLog 2020-10-08 Tom Tromey <tom@tromey.com> * cli/cli-cmds.c (print_disassembly): Style function name and addresses. Add _() wrappers. gdb/testsuite/ChangeLog 2020-10-08 Tom Tromey <tom@tromey.com> * gdb.base/style.exp: Check that "main"'s name is styled.
2020-10-08Update GDB NEWS with ARC support in GDBserverShahab Vahedi2-0/+6
gdb/ChangeLog: * NEWS: Mention ARC support in GDBserver.
2020-10-08gdb: Have allocate_target_description return a unique_ptrAndrew Burgess76-512/+599
Update allocate_target_description to return a target_desc_up, a specialisation of unique_ptr. This commit does not attempt to make use of the unique_ptr in the best possible way, in almost all cases we immediately release the pointer from within the unique_ptr and then continue as before. There are a few places where it was easy to handle the unique_ptr, and in these cases I've done that. Everything under gdb/features/* is auto-regenerated. There should be no user visible changes after this commit. gdb/ChangeLog: * arch/aarch32.c (aarch32_create_target_description): Release unique_ptr returned from allocate_target_description. * arch/aarch64.c (aarch64_create_target_description): Likewise. * arch/amd64.c (amd64_create_target_description): Likewise. * arch/arc.c (arc_create_target_description): Likewise. * arch/arm.c (arm_create_target_description): Likewise. * arch/i386.c (i386_create_target_description): Likewise. * arch/riscv.c (riscv_create_target_description): Update return type. Handle allocate_target_description returning a unique_ptr. (riscv_lookup_target_description): Update to handle unique_ptr. * arch/tic6x.c (tic6x_create_target_description): Release unique_ptr returned from allocate_target_description. * features/microblaze-with-stack-protect.c: Regenerate. * features/microblaze.c: Regenerate. * features/mips-dsp-linux.c: Regenerate. * features/mips-linux.c: Regenerate. * features/mips64-dsp-linux.c: Regenerate. * features/mips64-linux.c: Regenerate. * features/nds32.c: Regenerate. * features/nios2.c: Regenerate. * features/or1k.c: Regenerate. * features/rs6000/powerpc-32.c: Regenerate. * features/rs6000/powerpc-32l.c: Regenerate. * features/rs6000/powerpc-403.c: Regenerate. * features/rs6000/powerpc-403gc.c: Regenerate. * features/rs6000/powerpc-405.c: Regenerate. * features/rs6000/powerpc-505.c: Regenerate. * features/rs6000/powerpc-601.c: Regenerate. * features/rs6000/powerpc-602.c: Regenerate. * features/rs6000/powerpc-603.c: Regenerate. * features/rs6000/powerpc-604.c: Regenerate. * features/rs6000/powerpc-64.c: Regenerate. * features/rs6000/powerpc-64l.c: Regenerate. * features/rs6000/powerpc-7400.c: Regenerate. * features/rs6000/powerpc-750.c: Regenerate. * features/rs6000/powerpc-860.c: Regenerate. * features/rs6000/powerpc-altivec32.c: Regenerate. * features/rs6000/powerpc-altivec32l.c: Regenerate. * features/rs6000/powerpc-altivec64.c: Regenerate. * features/rs6000/powerpc-altivec64l.c: Regenerate. * features/rs6000/powerpc-e500.c: Regenerate. * features/rs6000/powerpc-e500l.c: Regenerate. * features/rs6000/powerpc-isa205-32l.c: Regenerate. * features/rs6000/powerpc-isa205-64l.c: Regenerate. * features/rs6000/powerpc-isa205-altivec32l.c: Regenerate. * features/rs6000/powerpc-isa205-altivec64l.c: Regenerate. * features/rs6000/powerpc-isa205-ppr-dscr-vsx32l.c: Regenerate. * features/rs6000/powerpc-isa205-ppr-dscr-vsx64l.c: Regenerate. * features/rs6000/powerpc-isa205-vsx32l.c: Regenerate. * features/rs6000/powerpc-isa205-vsx64l.c: Regenerate. * features/rs6000/powerpc-isa207-htm-vsx32l.c: Regenerate. * features/rs6000/powerpc-isa207-htm-vsx64l.c: Regenerate. * features/rs6000/powerpc-isa207-vsx32l.c: Regenerate. * features/rs6000/powerpc-isa207-vsx64l.c: Regenerate. * features/rs6000/powerpc-vsx32.c: Regenerate. * features/rs6000/powerpc-vsx32l.c: Regenerate. * features/rs6000/powerpc-vsx64.c: Regenerate. * features/rs6000/powerpc-vsx64l.c: Regenerate. * features/rs6000/rs6000.c: Regenerate. * features/rx.c: Regenerate. * features/s390-gs-linux64.c: Regenerate. * features/s390-linux32.c: Regenerate. * features/s390-linux32v1.c: Regenerate. * features/s390-linux32v2.c: Regenerate. * features/s390-linux64.c: Regenerate. * features/s390-linux64v1.c: Regenerate. * features/s390-linux64v2.c: Regenerate. * features/s390-te-linux64.c: Regenerate. * features/s390-tevx-linux64.c: Regenerate. * features/s390-vx-linux64.c: Regenerate. * features/s390x-gs-linux64.c: Regenerate. * features/s390x-linux64.c: Regenerate. * features/s390x-linux64v1.c: Regenerate. * features/s390x-linux64v2.c: Regenerate. * features/s390x-te-linux64.c: Regenerate. * features/s390x-tevx-linux64.c: Regenerate. * features/s390x-vx-linux64.c: Regenerate. * mips-tdep.c (_initialize_mips_tdep): Release unique_ptr returned from allocate_target_description. * target-descriptions.c (allocate_target_description): Update return type. (print_c_tdesc::visit_pre): Release unique_ptr returned from allocate_target_description. gdbserver/ChangeLog: * linux-low.cc (linux_process_target::handle_extended_wait): Release the unique_ptr returned from allocate_target_description. * linux-riscv-low.cc (riscv_target::low_arch_setup): Likewise. * linux-x86-low.cc (tdesc_amd64_linux_no_xml): Change type. (tdesc_i386_linux_no_xml): Change type. (x86_linux_read_description): Borrow pointer from unique_ptr object. (x86_target::get_ipa_tdesc_idx): Likewise. (initialize_low_arch): Likewise. * tdesc.cc (allocate_target_description): Update return type. gdbsupport/ChangeLog: * tdesc.h (allocate_target_description): Update return type.
2020-10-07Add simple_search_memory unit testsTom Tromey3-0/+106
This adds some unit tests for simple_search_memory. I tried here to reproduce some bugs (PR gdb/11158 and PR gdb/17756), but was unable to. gdb/ChangeLog 2020-10-07 Tom Tromey <tromey@adacore.com> * unittests/search-memory-selftests.c: New file. * Makefile.in (SELFTESTS_SRCS): Add unittests/search-memory-selftests.c.
2020-10-07Document inclusive range in help for "find"Tom Tromey2-0/+7
PR gdb/16930 points out that the "find" command uses an inclusive range; but this is not documented in the "help". This patch updates the help text. gdb/ChangeLog 2020-10-07 Tom Tromey <tromey@adacore.com> PR gdb/16930: * findcmd.c (_initialize_mem_search): Mention that the range is inclusive.
2020-10-07Move simple_search_memory to gdbsupport/search.ccTom Tromey4-112/+24
This moves the simple_search_memory function to a new file, gdbsupport/search.cc. The API is slightly changed to make it more general. This generality is useful for wiring it to gdbserver, and also for unit testing. gdb/ChangeLog 2020-10-07 Tom Tromey <tromey@adacore.com> * target.h (simple_search_memory): Don't declare. * target.c (simple_search_memory): Move to gdbsupport. (default_search_memory): Update. * remote.c (remote_target::search_memory): Update. gdbsupport/ChangeLog 2020-10-07 Tom Tromey <tromey@adacore.com> * Makefile.in: Rebuild. * Makefile.am (libgdbsupport_a_SOURCES): Add search.cc. * search.h: New file. * search.cc: New file.
2020-10-07Rename some tests in find.expTom Tromey2-6/+10
This renames some tests in find.exp, to avoid duplicate test names. gdb/testsuite/ChangeLog 2020-10-07 Tom Tromey <tromey@adacore.com> * gdb.base/find.exp: Rename some tests.
2020-10-07gdb: put user-supplied CFLAGS at the endSimon Marchi2-3/+13
GDB currently doesn't build cleanly with clang (a -Wdeprecated-copy-dtor error). I configured my clang-based GDB build with CXXFLAGS="-Wno-error=deprecated-copy-dtor", so I can use it despite that problem. However, I found that it had no effect. This is because my -Wno-error=Wdeprecated-copy-dtor switch is followed by -Werror in the command line, which switches back all warnings to be errors. If we want the user-supplied C(XX)FLAGS to be able to override flags added by our configure script, the user-supplied C(XX)FLAGS should appear after the configure-supplied flags. This patch moves the user-supplied CXXFLAGS at the very end of the compilation command line, which fixes the problem described above. This means moving it out of INTERNAL_CFLAGS and inlining it in the users of INTERNAL_CFLAGS. I observed the problem when building GDB, but the same problem could happen with GDBserver, so the change is done there too. In GDBserver, INTERNAL_CFLAGS is passed when linking gdb/ChangeLog: * Makefile.in (COMPILE): Add CXXFLAGS. (INTERNAL_CFLAGS_BASE): Remove CXXFLAGS. (check-headers): Add CXXFLAGS. gdbserver/ChangeLog: * Makefile.in (COMPILE): Add CXXFLAGS. (INTERNAL_CFLAGS_BASE): Remove CXXFLAGS. (gdbserver$(EXEEXT)): Add CXXFLAGS. (gdbreplay$(EXEEXT)): Add CXXFLAGS. ($(IPA_LIB)): Add CXXFLAGS. (IPAGENT_COMPILE): Add CXXFLAGS. Change-Id: I00e054506695e0e9536095c6d14827e48abd8f69
2020-10-07arc: Add support for Linux coredump filesAnton Kolesov5-4/+270
With the implemenations in this patch, ARC gdb can handle coredump related matters. The binutils counter part of this patch has already been pushed [1]. v2 [2]: - arc_linux_collect_gregset: Use "reg <= ARC_LAST_REGNUM" instead of "reg < ARC_LAST_REGNUM" for the condition check of the for-loop. - arc-linux-tdep.c: Use "ARC_LAST_REGNUM < ARRAY_SIZE (...)" instead of "ARC_LAST_REGNUM <= ARRAY_SIZE (...)" for the "asserts". - Use "buf + arc_linux_core_reg_offsets[ARC_ERET_REGNUM]" instead of "buf + REG_OFF (6)". - Fix a few typos/indentation. v3 [3]: - Use gdb_assert_not_reached(text) instead of gdb_assert (!text). - Remove unnecessary braces in the for loop. [1] arc: Add support for ARC HS extra registers in core files https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=2745674244d6aecddcf636475034bdb9c0a6b4a0 [2] First remarks https://sourceware.org/pipermail/gdb-patches/2020-September/171912.html [3] Second remarks https://sourceware.org/pipermail/gdb-patches/2020-October/172302.html gdb/ChangeLog: * arc-linux-tdep.h: New file. * arc-linux-tdep.c (arc_linux_core_reg_offsets, arc_linux_supply_gregset, arc_linux_supply_v2_regset, arc_linux_collect_gregset, arc_linux_collect_v2_regset, arc_linux_gregset, arc_linux_v2_regset, arc_linux_iterate_over_regset_sections, arc_linux_core_read_description): Implement. (arc_linux_init_osabi): Set iterate_over_regset_sections. * arc-tdep.h (ARC_OFFSET_NO_REGISTER): Declare. (arc_gdbarch_features_create): Add. * arc-tdep.c (arc_gdbarch_features_create): Not static anymore.
2020-10-07arc: Rename "arc_gdbarch_features" structShahab Vahedi4-19/+26
"arc_gdbarch_features" is a data structure containing information about the ARC architecture: ISA version, register size, etc. This name is misleading, because although it carries the phrase "gdbarch", it has nothing to do with the type/interface in GDB. Traditionaly, "gdbarch" structures are only used for that purpose. To rectify this, this patch changes the name to "arc_arch_features". gdb/ChangeLog: * arch/arc.h: Rename "arc_gdbarch_features" to "arc_arch_features". * arc-tdep.h: Likewise. * arc-tdep.c: Likewise.
2020-10-07gdb/infcmd: remove redundant clear_proceed_status callTankut Baris Aktemur2-1/+5
In `attach_command`, there is a call to `init_wait_for_inferior` followed by a call to `clear_proceed_status`. However, `init_wait_for_inferior` already calls `clear_proceed_status`. Remove the redundant call. Regression-tested on X86_64 Linux. gdb/ChangeLog: 2020-10-07 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * infcmd.c (attach_command): Remove the redundant call to `clear_proceed_status`.
2020-10-07Correct logical error in NetBSD's read_memory and write_memoryKamil Rytarowski2-2/+6
In case of repeated ptrace PT_IO call and returning the value of transferred bytes equal to 0, do not return without setting xfered_len. gdb/ChangeLog: * nat/netbsd-nat.c (write_memory, read_memory): Update.
2020-10-07Add common write_memory and read_memory NetBSD routinesKamil Rytarowski4-0/+131
Instead of sharing the native-only code with all BSDs with slightly different semantics of the kernels, share the NetBSD-only behavior beteen the NetBSD native and gdbserver setup. NetBSD does not differentiate the address space I and D in the operations (contrary to OpenBSD). NetBSD handles EACCES that integrates with NetBSD specific PaX MPROTECT error handling. Add a verbose message in the native client that an operation could be cancelled due to PaX MPROTECT setup. gdb/ChangeLog: * nat/netbsd-nat.c (write_memory, read_memory): Add. * nat/netbsd-nat.h (write_memory, read_memory): Likewise. * nbsd-nat.c (nbsd_nat_target::xfer_partial): Update. gdbserver/ChangeLog: * netbsd-low.cc (netbsd_process_target::read_memory) (netbsd_process_target::write_memory): Update.
2020-10-07gdb: make signal_catch_counts a static arraySimon Marchi2-3/+6
I noticed that signal_catch_counts is a dynamically-allocated array of constant size, allocated at startup an never freed. This might as well be a statically-allocated array. gdb/ChangeLog: * break-catch-sig.c (signal_catch_counts): Make a static arrray. (_initialize_break_catch_sig): Don't allocate array. Change-Id: I220321df5ad6c1d2664ec9d483eea2dc1c979afe
2020-10-06gdb: Fix installation of gcore.1 on some platformsMichael Forney2-0/+6
gcore is installed on NetBSD, FreeBSD, Solaris (HAVE_NATIVE_GCORE_HOST=1) and Linux (HAVE_NATIVE_GCORE_TARGET=1). However, even though gcore.1 is installed conditional on those variables, HAVE_NATIVE_GCORE_HOST was missing from gdb/doc/Makefile.in, so manual installation was skipped on NetBSD, FreeBSD, and Solaris. gdb/doc/ChangeLog: 2020-10-06 Michael Forney <mforney@mforney.org> * Makefile.in (HAVE_NATIVE_GCORE_HOST): Add for gcore.1 install condition. Change-Id: I17c3ce2ecdfb806ece17f05ba78356b25ffa865e
2020-10-06Fix gdb.base/list.exp with ClangGary Benson3-2/+7
Two subtests of gdb.base/list.exp failed when built with Clang because the unused function "unused" was optimized out. This commit adds __attribute__ ((used)) to both definitions. gdb/testsuite/ChangeLog: * gdb.base/list0.c (unused): Add __attribute__ ((used)). * gdb.base/list1.c (unused): Likewise.
2020-10-06Fix gdb.base/list-ambiguous.exp with ClangGary Benson3-2/+8
The ambiguous variable parts of gdb.base/list-ambiguous.exp failed when built with Clang because the variable in question was unused and was optimized out. This commit adds __attribute__ ((used)) to both definitions. gdb/testsuite/ChangeLog: * gdb.base/list-ambiguous0.c (ambiguous_var): Add __attribute__ ((used)). * gdb.base/list-ambiguous1.c (ambiguous_var): Likewise.
2020-10-06gdb: handle unmapped overlays in find_pc_lineAndrew Burgess2-3/+17
I configured and built an m32r-elf toolchain, and ran the gdb.base/overlays.exp test. I saw a couple of errors where GDB would place a breakpoint in the wrong place when placing a breakpoint using a function name, for example in this function: /* 1 */ int foo (int x) /* 2 */ { /* 3 */ if (x) /* 4 */ return some_global_variable; /* 5 */ else /* 6 */ return 0; /* 7 */ } GDB would place the breakpoint on line 2 instead of line 3. The issue is that GDB was failing to skip the prologue correctly. The reason for this is that in m32r-tdep.c:m32r_skip_prologue, we first use find_pc_partial_function to find the functions start and end addresses, then we use find_pc_line to find the start and end of the first line of the function. Currently, if the pc value passed to find_pc_partial_function is in an unmapped overlay then the function start and end addresses that are returned are also the unmapped addresses. However, this is not the case for find_pc_line, here, if the address passed in is in an unmapped overlay then we still get back a symtab_and_line describing the mapped location. What this means is that if a function's mapped location is 0x100 -> 0x120, and its unmapped locations is 0x400 -> 0x420 then we think that the start/end is 0x400 and 0x420 respectively, but the first line might run from 0x100 to 0x108. GDB will then try to scan the prologue starting from 0x400 and ending at 0x108, this immediately gives up as it thinks we have gone past the end of the prologue and the breakpoint is placed at 0x400. In this commit I propose that we change find_pc_line to return addresses in the unmapped range if the address passed in is already in the unmapped range. Now the first line will appear to run from 0x400 to 0x408 and the prologue scanner will correctly find the end of the prologue. With this commit gdb.base/overlays.exp now completely passes with an m32r-elf toolchain. gdb/ChangeLog: * symtab.c (find_pc_line): Return unmapped addresses when the requested address is also unmapped.
2020-10-06gdb/testsuite: allow gdb.base/overlays.exp to compile for m32rAndrew Burgess4-38/+58
The gdb.base/overlays.exp test is only currently supported on m32r baremetal targets, however, when I configure a toolchain for m32r-elf the test does not compile. This commit updates the linker script, fixes some TCL errors in the exp file, and adds some missing includes to the source file so that the test does compile. With this test, when run against an m32r-elf toolchain the test mostly passes, but there are a couple of failures, these are GDB issues and will be addressed in a later commit. gdb/testsuite/ChangeLog: * gdb.base/m32r.ld: Remove SEARCH_DIR line. Add MEMORY regions, make use of regions throughout. * gdb.base/overlays.exp: Enclose string with variableds in "..", not {...}. * gdb.base/ovlymgr.c: Add 'string.h' and 'stdlib.h' includes.
2020-10-05gdb: sync tui header files in HFILES_NO_SRCDIRSimon Marchi2-1/+6
I noticed that tui/tui-windata.h didn't exist anymore, and that tui/tui-out.h wasn't listed. Fix that. gdb/ChangeLog: * Makefile.in (HFILES_NO_SRCDIR): Remove tui/tui-windata.h, add tui/tui-out.h. Change-Id: Ic75cc68432b90ba5be857a2852ad52dea326fe36
2020-10-05gdb: TYPE_VECTOR -> type::is_vector in amd64-windows-tdep.cSimon Marchi2-1/+6
I get this build failure: CXX amd64-windows-tdep.o cc1plus: warning: command-line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++ /home/smarchi/src/binutils-gdb/gdb/amd64-windows-tdep.c: In function 'return_value_convention amd64_windows_return_value(gdbarch*, value*, type*, regcache*, gdb_byte*, const gdb_byte*)': /home/smarchi/src/binutils-gdb/gdb/amd64-windows-tdep.c:374:6: error: 'TYPE_VECTOR' was not declared in this scope 374 | if (TYPE_VECTOR (type) && len == 16) | ^~~~~~~~~~~ TYPE_VECTOR was removed in favor of the type::is_vector method. gdb/ChangeLog: * amd64-windows-tdep.c (amd64_windows_return_value): Use type::is_vector instead of TYPE_VECTOR. Change-Id: I0ce26c3f7a33625761a8dba351c3158464f21b01
2020-10-05gdb: avoid unnecessary string copy in auto_load_objfile_script_1Simon Marchi2-4/+8
Assigning the result of STRIP_DRIVE_SPEC to an std::string creates an unnecessary copy of the string. STRIP_DRIVE_SPEC is defined as: #define STRIP_DRIVE_SPEC(f) ((f) + 2) So if it is passed a "const char *", it returns a "const char *". We could use a "const char *" intermediary variable instead of an std::string, or (as implemented in this patch) just use it directly in the concatenation right after. gdb/ChangeLog: * auto-load.c (auto_load_objfile_script_1): Don't use debugfile_holder as temporary variable when stripping drive letter. Change-Id: If2ccc7a156b22100754d9cdf6778ac7eeb93da4c
2020-10-05Fix function argument and return value locationsHannes Domani5-5/+46
Fixes these testsuite fails on Windows: FAIL: gdb.base/callfuncs.exp: p t_float_complex_values(fc1, fc2) FAIL: gdb.base/callfuncs.exp: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4) FAIL: gdb.base/callfuncs.exp: noproto: p t_float_complex_values(fc1, fc2) FAIL: gdb.base/callfuncs.exp: noproto: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4) FAIL: gdb.base/call-sc.exp: p/c fun(); call call-sc-tld FAIL: gdb.base/call-sc.exp: advance to fun for return; return call-sc-tld FAIL: gdb.base/call-sc.exp: zed L for return; return call-sc-tld FAIL: gdb.base/call-sc.exp: return foo; return call-sc-tld FAIL: gdb.base/call-sc.exp: return foo; synchronize pc to main() for 'call-sc-tld' FAIL: gdb.base/call-sc.exp: return foo; synchronize pc to main() for 'call-sc-tld' FAIL: gdb.base/call-sc.exp: advance to fun for finish; return call-sc-tld FAIL: gdb.base/call-sc.exp: zed L for finish; return call-sc-tld FAIL: gdb.base/call-sc.exp: finish foo; return call-sc-tld (the program is no longer running) FAIL: gdb.base/call-sc.exp: value foo finished; return call-sc-tld For function arguments (callfuncs.exp), only TYPE_CODE_COMPLEX was missing in the types passed via integer registers. For return values, there were a lot more issues: - TYPE_CODE_DECFLOAT is NOT returned via XMM0. - long double is NOT returned via XMM0. - but __int128 IS returned via XMM0. - the comments for TYPE_CODE_FLT state that __m128, __m128i and __m128d are returned by XMM0, and this is correct, but it doesn't actually check for them, because they are TYPE_CODE_ARRAY with TYPE_VECTOR So I had to add TYPE_CODE_DECFLOAT to the arguments passed via XMM register, but I had to remove it from the values returned via XMM0 register. gdb/ChangeLog: 2020-10-05 Hannes Domani <ssbssa@yahoo.de> * amd64-windows-tdep.c (amd64_windows_passed_by_integer_register): Add TYPE_CODE_COMPLEX. (amd64_windows_return_value): Fix types returned via XMM0. gdb/testsuite/ChangeLog: 2020-10-05 Hannes Domani <ssbssa@yahoo.de> * gdb.base/call-sc.c: Fix return struct on stack test case. * gdb.base/call-sc.exp: Likewise.
2020-10-05Add Luis Machado to AArch64/ARM GDB maintainersAlan Hayward2-0/+7
gdb/ChangeLog: * MAINTAINERS (Responsible Maintainers): Add Luis Machado to AArch64/ARM maintainers.
2020-10-04gdb: add doc for "set/show debug event-loop"Simon Marchi4-0/+24
I forgot that "set/show debug" commands are listed in the doc and in NEWS, so here they are. gdb/doc/ChangeLog: * gdb.texinfo (Debugging Output): Add set/show debug event-loop. gdb/ChangeLog: * NEWS: Mention set/show debug event-loop. Change-Id: If30b80177049006578280a06912ee2b97bd03a75
2020-10-04gdb/doc: space out list entries, fix one typeSimon Marchi2-1/+39
I want to add an item to this list, but it's so packed I have trouble finding where one item ends and the next starts. Add a few empty lines to make it a bit more readable. Doing this, I also noticed that an "aix-thread" should in fact be "aix-solib". gdb/doc/ChangeLog: * gdb.texinfo (Debugging Output): Add empty lines, fix typo. Change-Id: I7ef211f9e3988cfbc6ec94124d23a5f2412f3c82
2020-10-02Unconditionally use REG_EXTENDEDTom Tromey2-8/+7
skip.c checks whether REG_EXTENDED is defined -- but this should always be available, and is used unconditionally in other parts of gdb. This patch removes this check, then further simplifies this code, removing a declaration and a repeated assertion. 2020-10-02 Tom Tromey <tromey@adacore.com> * skip.c (skiplist_entry::skiplist_entry): Unconditionally use REG_EXTENDED.
2020-10-02gdb: fix some inferior_created observer signaturesSimon Marchi3-10/+7
I just noticed that in a7aba2668a7b ("gdb: remove arguments from inferior_created observable"), I forgot to update aix_thread_inferior_created and procfs_inferior_created, which are in files I can't compile. Remove the parameters from aix_thread_inferior_created. And simply remove procfs_inferior_created, since it's empty anyway. gdb/ChangeLog: * aix-thread.c (aix_thread_inferior_created): Remove parameters. * procfs.c (procfs_inferior_created): Remove. (_initialize_procfs): Don't register procfs_inferior_created. Change-Id: Ifc7def7c096332033b5d466d32cb873d1df18c2c
2020-10-02gdb: add debug prints in event loopSimon Marchi3-2/+86
Add debug printouts about event loop-related events: - When a file descriptor handler gets invoked - When an async event/signal handler gets invoked gdb/ChangeLog: * async-event.c (invoke_async_signal_handlers): Add debug print. (check_async_event_handlers): Likewise. * event-top.c (show_debug_event_loop): New function. (_initialize_event_top): Register "set debug event-loop" setting. gdbserver/ChangeLog: * server.cc (handle_monitor_command): Handle "set debug-event-loop". (captured_main): Handle "--debug-event-loop". (monitor_show_help): Mention new setting. (gdbserver_usage): Mention new flag. gdbsupport/ChangeLog: * event-loop.h (debug_event_loop): New variable declaration. (event_loop_debug_printf_1): New function declaration. (event_loop_debug_printf): New macro. * event-loop.cc (debug_event_loop): New variable. (handle_file_event): Add debug print. (event_loop_debug_printf_1): New function. Change-Id: If78ed3a69179881368e7895b42940ce13b6a1a05
2020-10-02gdb: move debug_prefixed_vprintf hereSimon Marchi5-46/+10
The following patch needs to output debug prints from gdbsupport code. Move debug_prefixed_vprintf so that it is possible to use it from gdbsupport. gdb/ChangeLog: * debug.c (debug_prefixed_vprintf): Move to gdbsupport. * debug.h: Remove. * infrun.c: Include gdbsupport/common-debug.h. * linux-nat.c: Likewise. gdbsupport/ChangeLog: * common-debug.cc (debug_prefixed_vprintf): Move here. * common-debug.h (debug_prefixed_vprintf): Move here. Change-Id: I5170065fc10a7a49c0f1bba67c691decb2cf3bcb
2020-10-02gdb: give names to async event/signal handlersSimon Marchi10-23/+59
Assign names to async event/signal handlers. They will be used in debug messages when file handlers are invoked. Unlike in the previous patch, the names are not copied in the structure, since we don't need to (all names are string literals for the moment). gdb/ChangeLog: * async-event.h (create_async_signal_handler): Add name parameter. (create_async_event_handler): Likewise. * async-event.c (struct async_signal_handler) <name>: New field. (struct async_event_handler) <name>: New field. (create_async_signal_handler): Assign name. (create_async_event_handler): Assign name. * event-top.c (async_init_signals): Pass name when creating handler. * infrun.c (_initialize_infrun): Likewise. * record-btrace.c (record_btrace_push_target): Likewise. * record-full.c (record_full_open): Likewise. * remote-notif.c (remote_notif_state_allocate): Likewise. * remote.c (remote_target::open_1): Likewise. * tui/tui-win.c (tui_initialize_win): Likewise. Change-Id: Icd9d9f775542ae5fc2cd148c12f481e7885936d5
2020-10-02gdb: give names to event loop file handlersSimon Marchi9-8/+33
Assign names to event loop file handlers. They will be used in debug messages when file handlers are invoked. In GDB, each UI used to get its own unique number, until commit cbe256847e19 ("Remove ui::num"). Re-introduce this field, and use it to make a unique name for the handler. I'm not too sure what goes on in ser-base.c, all I know is that it's what is used when debugging remotely. I've just named the main handler "serial". It would be good to have unique names there too. For instance when debugging with two different remote connections, we'd ideally want the handlers to have unique names. I didn't do it in this patch though. gdb/ChangeLog: * async-event.c (initialize_async_signal_handlers): Pass name to add_file_handler * event-top.c (ui_register_input_event_handler): Likewise. * linux-nat.c (linux_nat_target::async): Likewise. * run-on-main-thread.c (_initialize_run_on_main_thread): Likewise * ser-base.c (reschedule): Likewise. (ser_base_async): Likewise. * tui/tui-io.c: Likewise. * top.h (struct ui) <num>: New field. * top.c (highest_ui_num): New variable. (ui::ui): Initialize num. gdbserver/ChangeLog: * linux-low.cc (linux_process_target::async): Pass name to add_file_handler. * remote-utils.cc (handle_accept_event): Likewise. (remote_open): Likewise. gdbsupport/ChangeLog: * event-loop.h (add_file_handler): Add "name" parameter. * event-loop.cc (struct file_handler) <name>: New field. (create_file_handler): Add "name" parameter, assign it to file handler. (add_file_handler): Add "name" parameter. Change-Id: I9f1545f73888ebb6778eb653a618ca44d105f92c
2020-10-02gdb: remove arguments from inferior_created observableSimon Marchi15-18/+24
I noticed that non of the listeners of the inferior_created observable used either of the arguments. Remove them. This in turn allows removing the target parameter of post_create_inferior. Tested only by rebuilding. gdb/ChangeLog: * observable.h <inferior_created>: Remove parameters. Update all listeners. * inferior.h (post_create_inferior): Remove target parameter. Update all callers. Change-Id: I8944cefdc4447ed5347dc927b75abf1e7a0e27e6
2020-10-02Fix spelling mistake in gdb/testsuite/README.Gary Benson2-1/+5
This commit corrects the spelling mistake detailed below. gdb/testsuite/ChangeLog: * README: Fix "paralell".
2020-10-02DWARFv5: Handle DW_MACRO_define_strx and DW_MACRO_undef_strx macro entries.nitachra4-4/+101
GDB complaints "During symbol reading: unrecognized DW_MACFINO opcode 0xb" with the testcase given below. Clang is emitting DW_MACRO_define_strx and DW_MACRO_undef_strx entries in .debug_macro section which are not supported in GDB. This patch handles them. DW_MACRO_define_strx and DW_MACRO_undef_strx are added in DWARFv5. They have two operands. The first operand encodes the line number of the #define or #undef macro directive. The second operand identifies a string; it is represented using an unsigned LEB128 encoded value, which is interpreted as a zero-based index into an array of offsets in the .debug_str_offsets section. This is as per the section 6.3.2.1 of Dwarf Debugging Information Format Version 5. Test case used: #define MAX_SIZE 10 int main(void) { int size = 0; size = size + MAX_SIZE; printf("\n The value of size is [%d]\n",size); return 0; } clang -gdwarf-5 -fdebug-macro macro.c -o macro.out Before the patch: gdb/new_gdb/binutils-gdb/build/bin/gdb -q macro.out -ex "set complaints 1" -ex "start" Reading symbols from macro.out... During symbol reading: unrecognized DW_MACFINO opcode 0xb Temporary breakpoint 1 at 0x4004df: file macro.c, line 7. Starting program: /home/nitika/workspace/macro.out Temporary breakpoint 1, main () at macro.c:7 7 int size = 0; (gdb) Tested by running the testsuite before and after the patch with -gdwarf-5 and there is no increase in the number of test cases that fails. Used clang 11.0.0. gdb/ChangeLog: * dwarf2/macro.c (dwarf_decode_macro_bytes): Handle DW_MACRO_define_strx and DW_MACRO_undef_strx. (dwarf_decode_macros): Likewise * dwarf2/read.c (dwarf_decode_macros): Pass str_offsets_base in the parameters which is the value of DW_AT_str_offsets_base. * dwarf2/macro.h (dwarf_decode_macros): Modify the definition to include str_offsets_base.
2020-10-02Fix the i386 buildKamil Rytarowski2-1/+4
Remove old, no longer needed and no longer valid extern. ../../gdb/i386-nbsd-tdep.c:58:12: error: 'i386nbsd_sc_reg_offset' was declared 'extern' and later 'static' [-fpermissive] 58 | static int i386nbsd_sc_reg_offset[] = | ^~~~~~~~~~~~~~~~~~~~~~ In file included from ../../gdb/i386-nbsd-tdep.c:31: ../../gdb/i386-tdep.h:480:12: note: previous declaration of 'i386nbsd_sc_reg_offset' 480 | extern int i386nbsd_sc_reg_offset[]; | ^~~~~~~~~~~~~~~~~~~~~~ gdb/ChangeLog: * i386-tdep.h (i386nbsd_sc_reg_offset): Remove.
2020-10-02Remove the old sanity check of sigcontext offsets for NetBSD/i386Kamil Rytarowski3-6/+7
NetBSD switched to ucontext, back in 2003 and the sigcontext code is no longer available for users, except for legacy compat layers. This code was not available anyway as the pre-processor check was probably never operational and buildable on NetBSD. The code inside it does not compile. Meanwhile, move the offset variable into the ifdef goards and avoid the error about unused variable. ../../gdb/i386-bsd-nat.c: In function 'void _initialize_i386bsd_nat()': ../../gdb/i386-bsd-nat.c:347:7: error: unused variable 'offset' [-Werror=unused-variable] 347 | int offset; | ^~~~~~ cc1plus: all warnings being treated as errors gdb/ChangeLog: * i386-bsd-nat.c (_initialize_i386bsd_nat): Update. * i386-nbsd-tdep.c (i386nbsd_sc_reg_offset): Now static.