aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-04-14[gdb] Expand symbolless symtabs using maint expand-symtabsTom de Vries13-24/+165
Consider this test-case, consisting of header file hello.h: ... inline static const char* foo (void) { return "foo"; } ... and source file hello.c: ... int main (void) { printf ("hello: %s\n", foo ()); return 0; } ... compiled with -g: ... $ gcc hello.c -g ... When trying to expand the partial symtab for hello.h: ... $ gdb -batch \ -iex "set language c" \ a.out \ -ex "maint expand-symtabs hello.h" \ -ex "maint info psymtabs" ... we in fact find that the partial symtab for hello.h (and corresponding includer partial symtab hello.c) have not been expanded: ... { psymtab hello.h ((struct partial_symtab *) 0x27cf070) readin no ... { psymtab hello.c ((struct partial_symtab *) 0x2cf09e0) readin no ... This is due to the recursively_search_psymtabs call in psym_expand_symtabs_matching: ... if (recursively_search_psymtabs (ps, objfile, domain, lookup_name, symbol_matcher)) ... which always returns false for symbolless partial symtabs. The same problem occurs with CUs where the dwarf is generated by gas --gdwarf-2 for a foo.S: if we read such a test-case with -readnow, we'll have a symbolless symtab for foo.S. But if we read the test-case with partial symtabs, and expand those using "maint expand-symtabs", the foo.S psymtab remains unexpanded. Fix this by passing a NULL symbol_matcher and lookup_name to expand_symtabs_matching in maintenance_expand_symtabs, and skipping the call to recursively_search_psymtabs if symbol_matcher == NULL and lookup_name == NULL. Build and tested on x86_64-linux, with native. In addition, tested test-case with target boards cc-with-gdb-index.exp, cc-with-debug-names.exp and readnow.exp. gdb/ChangeLog: 2020-04-14 Tom de Vries <tdevries@suse.de> PR symtab/25720 * symmisc.c (maintenance_expand_symtabs): Call expand_symtabs_matching with NULL symbol_matcher and lookup_name. * psymtab.c (psym_expand_symtabs_matching): Handle NULL symbol_matcher and lookup_name. * dwarf2/read.c (dw2_expand_symtabs_matching) (dw2_debug_names_expand_symtabs_matching): Same. * symfile.h (struct quick_symbol_functions::expand_symtabs_matching): Make lookup_name a pointer. Update comment. * symtab.c (global_symbol_searcher::expand_symtabs): Handle lookup_name being a pointer. * symfile.c (expand_symtabs_matching): Same. * symfile-debug.c (debug_qf_expand_symtabs_matching): Same. * linespec.c (iterate_over_all_matching_symtabs): Same. gdb/testsuite/ChangeLog: 2020-04-14 Tom de Vries <tdevries@suse.de> PR symtab/25720 * gdb.base/maint-expand-symbols-header-file.c: New test. * gdb.base/maint-expand-symbols-header-file.exp: New file. * gdb.base/maint-expand-symbols-header-file.h: New test.
2020-04-14readelf: Consolidate --syms --use-dynamic with --dyn-symsH.J. Lu17-647/+703
When reconstructing dynamic symbol table from the PT_DYNAMIC segment, compute dynamic symbol table size from hash table. For DT_HASH, the number of dynamic symbol table entries equals the number of chains. For DT_GNU_HASH/DT_MIPS_XHASH, only defined symbols with non-STB_LOCAL indings are in hash table. Since DT_GNU_HASH/DT_MIPS_XHASH place all symbols with STB_LOCAL binding before symbols with other bindings and all undefined symbols defined ones in dynamic symbol table, the highest symbol index in DT_GNU_HASH/DT_MIPS_XHASH is the highest dynamic symbol table index. Rewrite print_dynamic_symbol to dump dynamic symbol table for --dyn-syms and --syms --use-dynamic. binutils/ PR binutils/25707 * readelf.c (nbuckets): New. (nchains): Likewise. (buckets): Likewise. (chains): Likewise. (ngnubuckets): Likewise. (gnubuckets): Likewise. (gnuchains): Likewise. (mipsxlat): Likewise. (ngnuchains): Likewise. (gnusymidx): Likewise. (VALID_SYMBOL_NAME): Likewise. (VALID_DYNAMIC_NAME): Use it. (get_dynamic_data): Moved before process_dynamic_section. (get_num_dynamic_syms): New function. (process_dynamic_section): Use DT_SYMTAB, DT_SYMENT, DT_HASH, DT_GNU_HASH and DT_MIPS_XHASH to reconstruct dynamic symbol table. Use DT_STRTAB and DT_STRSZ to reconstruct dynamic string table. (get_symbol_index_type): Don't print "bad section index" when there is no section header. (print_dynamic_symbol): Rewrite. (process_symbol_table): Call print_dynamic_symbol to dump dynamic symbol table. ld/ PR binutils/25707 * testsuite/ld-arm/armthumb-lib.sym: Updated. * testsuite/ld-arm/farcall-mixed-app.sym: Likewise. * testsuite/ld-arm/farcall-mixed-app2.sym: Likewise. * testsuite/ld-arm/fdpic-main-m.sym: Likewise. * testsuite/ld-arm/fdpic-main.sym: Likewise. * testsuite/ld-arm/fdpic-shared-m.sym: Likewise. * testsuite/ld-arm/fdpic-shared.sym: Likewise. * testsuite/ld-arm/mixed-app.sym: Likewise. * testsuite/ld-arm/mixed-lib.sym: Likewise. * testsuite/ld-arm/preempt-app.sym: Likewise. * testsuite/ld-elf/hash.d: Likewise. * testsuite/ld-elf/pr13195.d: Likewise. * testsuite/ld-elfvsb/hidden2.d: Likewise. * testsuite/ld-mips-elf/hash2.d: Likewise.
2020-04-14gdb/testsuite: Move helper function into lib/dwarf.expAndrew Burgess6-57/+27
Every time I write a test making use of the DWARF assembler I end up copying in the function get_func_info. Duplicating code is bad, so lets put this function into lib/dwarf.exp and remove all of the duplicates. There should be no changes in the testsuite behaviour after this commit. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-inline-many-frames.exp (get_func_info): Delete. * gdb.dwarf2/dw2-inline-small-func.exp: Pass options to get_func_info. (get_func_info): Delete. * gdb.dwarf2/dw2-is-stmt-2.exp (get_func_info): Delete. * gdb.dwarf2/dw2-is-stmt.exp (get_func_info): Delete. * lib/dwarf.exp (get_func_info): New function.
2020-04-14Automatic date update in version.inGDB Administrator1-1/+1
2020-04-13Remove gdb_fildes_tTom Tromey5-31/+15
gdb_fildes_t and pfildes are no longer used, so remove them. gdbserver/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * server.h (gdb_fildes_t): Remove typedef. * remote-utils.c (remote_desc, list_desc): Now int. (INVALID_DESCRIPTOR): Remove. (gdb_connected, remote_close) (check_remote_input_interrupt_request): Update. * utils.h (pfildes): Don't declare. * utils.c (pfildes): Remove.
2020-04-13Move gdb_notifier commentTom Tromey2-11/+12
This moves the gdb_notifier comment a bit lower in event-loop.c, to where it belongs; and removes an obsolete comment that Pedro pointed out. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.c: Move comment. Remove obsolete comment.
2020-04-13Switch gdbserver to gdbsupport event loopTom Tromey7-628/+60
This changes gdbserver to use the gdbserver event loop, removing the ancient fork. gdbserver/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * server.h (handle_serial_event, handle_target_event): Update. * server.c: Don't call initialize_event_loop. (keep_processing_events): New global. (handle_serial_event): Return void. Set keep_processing_events. (handle_target_event): Return void. (start_event_loop): Move from event-loop.c. Rewrite. * remote-utils.c (handle_accept_event): Return void. (reset_readchar): Use delete_timer. (process_remaining): Return void. (reschedule): Use create_timer. * event-loop.h: Remove. * event-loop.cc: Remove. * Makefile.in (OBS): Use gdbsupport/event-loop.o, not event-loop.o.
2020-04-13Implement event-loop glue for gdbserverTom Tromey2-0/+41
event-loop.c requires the client to provide some functions. This patch implements these functions for gdbserver. gdbserver/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * server.c (invoke_async_signal_handlers) (check_async_event_handlers, flush_streams, gdb_select): New functions.
2020-04-13Move event-loop.[ch] to gdbsupport/Tom Tromey33-40/+78
This moves event-loop.[ch] to gdbsupport/ and updates the uses in gdb. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * run-on-main-thread.c: Update include. * unittests/main-thread-selftests.c: Update include. * tui/tui-win.c: Update include. * tui/tui-io.c: Update include. * tui/tui-interp.c: Update include. * tui/tui-hooks.c: Update include. * top.h: Update include. * top.c: Update include. * ser-base.c: Update include. * remote.c: Update include. * remote-notif.c: Update include. * remote-fileio.c: Update include. * record-full.c: Update include. * record-btrace.c: Update include. * python/python.c: Update include. * posix-hdep.c: Update include. * mingw-hdep.c: Update include. * mi/mi-main.c: Update include. * mi/mi-interp.c: Update include. * main.c: Update include. * linux-nat.c: Update include. * interps.c: Update include. * infrun.c: Update include. * inf-loop.c: Update include. * event-top.c: Update include. * event-loop.c: Move to ../gdbsupport/. * event-loop.h: Move to ../gdbsupport/. * async-event.h: Update include. * Makefile.in (COMMON_SFILES, HFILES_NO_SRCDIR): Update. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.h: Move from ../gdb/. * event-loop.cc: Move from ../gdb/.
2020-04-13Introduce async-event.[ch]Tom Tromey13-345/+430
This patch splits out some gdb-specific code from event-loop, into new files async-event.[ch]. Strictly speaking this code could perhaps be put into gdbsupport/, but because gdbserver does not currently use it, it seemed better, for size reasons, to split it out. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * tui/tui-win.c: Include async-event.h. * remote.c: Include async-event.h. * remote-notif.c: Include async-event.h. * record-full.c: Include async-event.h. * record-btrace.c: Include async-event.h. * infrun.c: Include async-event.h. * event-top.c: Include async-event.h. * event-loop.h: Move some declarations to async-event.h. * event-loop.c: Don't include ser-event.h or top.h. Move some code to async-event.c. * async-event.h: New file. * async-event.c: New file. * Makefile.in (COMMON_SFILES): Add async-event.c. (HFILES_NO_SRCDIR): Add async-event.h.
2020-04-13Introduce and use flush_streamsTom Tromey5-2/+23
Code in gdbsupport can't call gdb_flush, so this introduces a new "flush_streams" function that must be supplied by the client. Note that the similar gdb_flush_out_err exists, but it isn't defined in quite the same way, so it wasn't clear to me whether the two could be merged. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * utils.c (flush_streams): New function. * event-loop.c (gdb_wait_for_event): Call flush_streams. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * errors.h (flush_streams): Declare.
2020-04-13Use warning in event-loopTom Tromey2-6/+10
Change event-loop.c to avoid printf_unfiltered in favor of warning. warning is aleady available to code in gdbsupport/. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.c (handle_file_event): Use warning, not printf_unfiltered.
2020-04-13Include <chrono> in event-loop.cTom Tromey2-0/+6
Include <chrono> in event-loop.c, because it is used there. Currently it is included indirectly, but after the subsequent patches this will no longer be the case. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.c: Include <chrono>.
2020-04-13Move gdb_select.h to gdbsupport/Tom Tromey15-13/+33
This moves gdb_select.h to gdbsupport/, so it can be used by other code there. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * gdb_select.h: Move to ../gdbsupport/. * event-loop.c: Update include path. * top.c: Update include path. * ser-base.c: Update include path. * ui-file.c: Update include path. * ser-tcp.c: Update include path. * guile/scm-ports.c: Update include path. * posix-hdep.c: Update include path. * ser-unix.c: Update include path. * gdb_usleep.c: Update include path. * mingw-hdep.c: Update include path. * inflow.c: Update include path. * infrun.c: Update include path. * event-top.c: Update include path. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * gdb_select.h: Move from ../gdb/.
2020-04-13Move event-loop configury to common.m4Tom Tromey10-14/+55
gdb_select.h and the event loop require some configure checks, so this moves the needed checks to common.m4 and updates the configure scripts. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Remove checks that are now in GDB_AC_COMMON. gdbserver/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * configure: Rebuild. * config.in: Rebuild. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * config.in, configure: Rebuild. * common.m4 (GDB_AC_COMMON): Check for poll.h, sys/poll.h, sys/select.h, and poll.
2020-04-13Move start_event_loop out of event-loop.cTom Tromey4-55/+62
A subsequent patch is going to move event-loop.c to gdbsupport. In a review of an earlier version of this series, Pedro pointed out that the resulting code would be cleaner if start_event_loop were not shared -- because gdb and gdbserver have some different needs here -- and so this moves start_event_loop to main.c. Because the only caller is there, it is also now static. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.h (start_event_loop): Don't declare. * event-loop.c (start_event_loop): Move... * main.c (start_event_loop): ...here. Now static.
2020-04-13Update my email address on MAINTAINERSSergio Durigan Junior2-2/+6
Commit pushed under the obvious/trivial rule. gdb/ChangeLog: 2020-04-13 Sergio Durigan Junior <sergiodj@sergiodj.net> * MAINTAINERS: Update my email address.
2020-04-13[gdb/testsuite] Fix gdb.ada/catch_ex_std.exp gnatlink FAILTom de Vries2-0/+8
When running test-case gdb.ada/catch_ex.exp using system gnatmake, gnatmake is invoked like this: ... Executing on host: \ gnatmake foo.adb -gnata -f -Isrc/gdb/testsuite/gdb.ada/catch_ex -g -lm \ -o outputs/gdb.ada/catch_ex/foo ... When I try to use a more recent gnatmake, by mocking up a combined build: ... $ ls -la build/gcc/ lrwxrwxrwx gfortran -> /usr/bin/gfortran-10 lrwxrwxrwx gnatbind -> /usr/bin/gnatbind-10 lrwxrwxrwx gnatlink -> /usr/bin/gnatlink-10 lrwxrwxrwx gnatmake -> /usr/bin/gnatmake-10 lrwxrwxrwx xg++ -> /usr/bin/g++-10 lrwxrwxrwx xgcc -> /usr/bin/gcc-10 ... gnatmake is invoked like this: ... Executing on host: \ /data/gdb_versions/devel/build/gcc/gnatmake \ -I/data/gdb_versions/devel/build/gcc/ada/rts \ --GCC=/data/gdb_versions/devel/build/gcc/xgcc \ --GNATBIND=/data/gdb_versions/devel/build/gcc/gnatbind \ --GNATLINK=/data/gdb_versions/devel/build/gcc/gnatlink \ -cargs -B/data/gdb_versions/devel/build/gcc \ -largs --GCC=/data/gdb_versions/devel/build/gcc/xgcc \ -B/data/gdb_versions/devel/build/gcc \ -margs foo.adb -gnata -f -Isrc/gdb/testsuite/gdb.ada/catch_ex -g -lm \ -o outputs/gdb.ada/catch_ex/foo ... This is set up by this bit in find_gnatmake in /usr/share/dejagnu/libgloss.exp: ... if {![is_remote host]} { set file [lookfor_file $tool_root_dir gnatmake] if { $file == "" } { set file [lookfor_file $tool_root_dir gcc/gnatmake] } if { $file != "" } { set root [file dirname $file] set CC "$file -I$root/ada/rts --GCC=$root/xgcc \ --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink \ -cargs -B$root \ -largs --GCC=$root/xgcc -B$root -margs" } else { ... However, when running test-case gdb.ada/catch_ex_std.exp using the mockup combined build, we get: ... Executing on host: \ /data/gdb_versions/devel/build/gcc/gnatlink foo \ -Wl,-rpath,\$ORIGIN -Wl,-lsome_package b~foo.adb:26:79: "SS_Stack" not declared in "Secondary_Stack"^M b~foo.adb:26:89: incorrect constraint for this kind of type^M b~foo.adb:121:56: "Runtime_Default_Sec_Stack_Size" not declared in "Parameters"^M FAIL: gdb.ada/catch_ex_std.exp: gnatlink foo ... The problem is caused by the fact that the test uses gnatlink directly rather than using gnatmake. The invoked gnatlink (which is gnatlink-10) calls gcc-7, which are incompatible (see gcc PR86211). This problem doesn't occur with gnatmake because there the gcc to use is passed as an argument to gnatlink. Fix this by adding the -largs bit from find_gnatmake in find_ada_tool, for the case that $tool == gnatlink. Tested on x86_64-linux, with system gcc, and gcc-10. gdb/testsuite/ChangeLog: 2020-04-13 Tom de Vries <tdevries@suse.de> * lib/ada.exp (find_ada_tool): Pass --GCC and -B to gnatlink, similar to what find_gnatmake does.
2020-04-13Implement IP_MINIMAL and IP_ALL on NetBSDKamil Rytarowski2-0/+16
gdb/ChangeLog: * nbsd-nat.c (nbsd_nat_target::info_proc): Add IP_MINIMAL and IP_ALL.
2020-04-13Automatic date update in version.inGDB Administrator1-1/+1
2020-04-12Implement "info proc cmdline" for NetBSDKamil Rytarowski2-0/+44
Add nbsd_pid_to_cmdline() to query the program command line. gdb/ChangeLog: * nbsd-nat.c (nbsd_pid_to_cmdline): Add. (nbsd_nat_target::info_proc): Add do_cmdline.
2020-04-12Implement "info proc cwd" for NetBSDKamil Rytarowski2-0/+31
Add nbsd_pid_to_cwd() to query the program current directory. gdb/ChangeLog: * nbsd-nat.c (nbsd_pid_to_cwd): Add. (nbsd_nat_target::info_proc): Add do_cwd.
2020-04-12Implement "info proc exe" for NetBSDKamil Rytarowski2-0/+16
Use pid_to_exec_file() to query the program. gdb/ChangeLog: * nbsd-nat.c (nbsd_nat_target::info_proc): Add do_exe.
2020-04-12Implement "info proc mappings" for NetBSDKamil Rytarowski5-0/+276
Define nbsd_nat_target::find_memory_regions and nbsd_nat_target::info_proc. info_proc handles as of now only the "mappings" command. Define a local static function kinfo_get_vmmap() that reads the process memory layout of a specified process. kinfo_get_vmmap() wraps the sysctl(3) call. nbsd-tdep.c defines now utility functions for printing the process memory layout: * nbsd_info_proc_mappings_header() * nbsd_vm_map_entry_flags() * nbsd_info_proc_mappings_entry() gdb/ChangeLog: * nbsd-nat.c; Include "nbsd-tdep.h" and "gdbarch.h". * nbsd-nat.c (nbsd_nat_target::find_memory_regions) (nbsd_nat_target::info_proc): New functions. * nbsd-nat.c (kinfo_get_vmmap): New function. * nbsd-nat.c (nbsd_nat_target::info_proc) Use nbsd_info_proc_mappings_header and nbsd_info_proc_mappings_entry. * nbsd-tdep.c (nbsd_info_proc_mappings_header) (nbsd_info_proc_mappings_entry, nbsd_vm_map_entry_flags): New functions. * nbsd-tdep.c (KINFO_VME_PROT_READ, KINFO_VME_PROT_WRITE) (KINFO_VME_PROT_EXEC, KINFO_VME_FLAG_COW) (KINFO_VME_FLAG_NEEDS_COPY, KINFO_VME_FLAG_NOCOREDUMP) (KINFO_VME_FLAG_PAGEABLE, KINFO_VME_FLAG_GROWS_UP) (KINFO_VME_FLAG_GROWS_DOWN): New.
2020-04-12Automatic date update in version.inGDB Administrator1-1/+1
2020-04-10gdb: fix undefined behavior reported in copy_bitwiseArtur Shepilko2-1/+6
gdb version 9.1, built with clang 8.0.0 on Ubuntu 18.04 (x86_64); --enable-ubsan (for clang's undefined behavior sanitizer) Executing command; `maint selftest copy_bitwise` bombs in runtime error: ../../gdb/utils.c:3432:28: runtime error: left shift of negative value -1 Closer look reveals the offending shift: `(~0 << nbits)`, apparently 0 is treated as signed int, resulting in negative complement. Explicitly stating it unsigned 0U fixes it and the `copy_bitwise` test passes ok.
2020-04-11Automatic date update in version.inGDB Administrator1-1/+1
2020-04-10Avoid infinite recursion in get_msymbol_addressTom Tromey2-1/+5
Sometimes, get_msymbol_address can cause infinite recursion, leading to a crash. This was reported previously here: https://sourceware.org/pipermail/gdb-patches/2019-November/162154.html A user on irc reported this as well, and with his help and the help of a friend of his, we found that the problem occurred because, when reloading a separate debug objfile, the objfile would lose the OBJF_MAINLINE flag. This would cause some symbols from this separate debug objfile to be marked "maybe_copied" -- but then get_msymbol_address could find the same symbol and fail as reported. This patch fixes the bug by preserving OBJF_MAINLINE. No test case, unfortunately, because I could not successfully make one. gdb/ChangeLog 2020-04-10 Tom Tromey <tromey@adacore.com> * symfile.c (symbol_file_add_separate): Preserve OBJF_MAINLINE.
2020-04-10Skip separate debug files when handling copy relocationsTom Tromey2-1/+10
get_symbol_address and get_msymbol_address call lookup_minimal_symbol_linkage, which iterates over the separate debug files of the objfile that is passed in. This means that if these functions pass in a separate debug objfile, then they are doing unnecessary work. This patch avoids the extra work by skipping separate debug objfiles in the loops. gdb/ChangeLog 2020-04-10 Tom Tromey <tromey@adacore.com> * symtab.c (get_symbol_address, get_msymbol_address): Skip separate debug files.
2020-04-10Fix debugging of WOW64 processesHannes Domani4-8/+30
The new code regarding pending stops only checks for EXCEPTION_BREAKPOINT, but for WOW64 processes STATUS_WX86_BREAKPOINT is necessary as well. Also, ignore_first_breakpoint is used now in nat/windows-nat.c as well, but was not available there. gdb/ChangeLog: 2020-04-10 Hannes Domani <ssbssa@yahoo.de> * nat/windows-nat.c (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP): Move to... * nat/windows-nat.h (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP): ... here. * windows-nat.c (windows_nat_target::get_windows_debug_event): Check for STATUS_WX86_BREAKPOINT. (windows_nat_target::wait): Same.
2020-04-10ld: xfail several shared (non PIC) tests on SolarisRainer Orth2-4/+11
Three ld tests currently FAIL on Solaris/SPARC: FAIL: shared (non PIC) FAIL: shared (non PIC, load offset) FAIL: shared (PIC main, non PIC so) all of them in the same way: /var/gcc/binutils/sparcv7/obj/binutils/ld/tmpdir/ld/collect-ld: read-only segment has dynamic relocations Given that Solaris defaults to -z text, this is to be expected, thus this patch xfail's them. Tested on sparc-sun-solaris2.11 and sparcv9-sun-solaris2.11. * testsuite/ld-shared/shared.exp: Remove dangling comments. xfail shared non PIC tests on Solaris.
2020-04-10[gdb/testsuite] Fix -readnow FAIL in gdb.base/style.expTom de Vries2-1/+15
When running test-case gdb.base/style.exp with target board readnow, we run into: ... FAIL: gdb.base/style.exp: filename is styled when loading symbol file ... The problem is that with -readnow, an extra "Expanding full symbols" message is generated: ... (gdb) file $file^M Reading symbols from $file...^M Expanding full symbols from $file...^M (gdb) FAIL: gdb.base/style.exp: filename is styled when loading symbol file ... and the test does not expect this message. Fix this by expecting the additional message for -readnow. gdb/testsuite/ChangeLog: 2020-04-10 Tom de Vries <tdevries@suse.de> * gdb.base/style.exp: Expect "Expanding full symbols" message for -readnow.
2020-04-10[gdb/cli] Don't let python colorize strip leading newlinesTom de Vries5-2/+24
Consider the test-case gdb.base/async.exp. Using the executable, I run to main, and land on a line advertised as line 26: ... $ gdb outputs/gdb.base/async/async -ex start Reading symbols from outputs/gdb.base/async/async... Temporary breakpoint 1 at 0x4004e4: file gdb.base/async.c, line 26. Starting program: outputs/gdb.base/async/async Temporary breakpoint 1, main () at gdb.base/async.c:26 26 y = foo (); ... But actually, the line turns out to be line 28: ... $ cat -n gdb.base/async.c ... 26 y = 2; 27 z = 9; 28 y = foo (); ... This is caused by the following: the python colorizer initializes the lexer with default options (no second argument to get_lexer_for_filename): ... def colorize(filename, contents): # Don't want any errors. try: lexer = lexers.get_lexer_for_filename(filename) formatter = formatters.TerminalFormatter() return highlight(contents, lexer, formatter) ... which include option stripnl=True, which strips leading and trailing newlines. This causes the python colorizer to strip the two leading newlines of async.c. Fix this by initializing the lexer with stripnl=False. Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-04-10 Tom de Vries <tdevries@suse.de> PR cli/25808 * python/lib/gdb/__init__.py: Initialize lexer with stripnl=False. gdb/testsuite/ChangeLog: 2020-04-10 Tom de Vries <tdevries@suse.de> PR cli/25808 * gdb.base/style.c: Add leading newlines. * gdb.base/style.exp: Use gdb_get_line_number to get specific lines. Check listing of main's one-line body.
2020-04-10Automatic date update in version.inGDB Administrator1-1/+1
2020-04-09gdb: move Tom de Vries to Global MaintainersSimon Marchi2-1/+6
gdb/ChangeLog: * MAINTAINERS (Global Maintainers): Add Tom de Vries. (Write After Approval): Remove Tom de Vries.
2020-04-09Partially revert my UB fix in record_lineBernd Edlinger2-19/+26
This reverts the following commit partially: commit 64dc2d4bd24ff7119c913fff91184414f09b8042 Author: Bernd Edlinger <bernd.edlinger@hotmail.de> Date: Thu Mar 12 11:52:34 2020 +0100 Fix an undefined behavior in record_line Additionally do not completely remove symbols at the same PC than the end marker, instead make them non-is-stmt breakpoints. We keep the undefined behavoir fix, but have to restore the original behavior regarding deletion of the line entries. 2020-04-09 Bernd Edlinger <bernd.edlinger@hotmail.de> revert partially: 2020-04-01 Bernd Edlinger <bernd.edlinger@hotmail.de> * buildsym.c (record_line): Fix undefined behavior and preserve lines at eof.
2020-04-09Add SVR4 psABI specific parser for AUXV entriesKamil Rytarowski5-44/+80
NetBSD and OpenBSD always use an int to store the type as defined in the SVR4 psABI specifications rather than long as assumed by the default parser. Define svr4_auxv_parse() that shares code with default_auxv_parse(). Remove obsd_auxv_parse() and switch OpenBSD to svr4_auxv_parse(). Remove not fully accurate comment from obsd-tdep.c. Use svr4_auxv_parse() on NetBSD. gdb/ChangeLog: * auxv.h (svr4_auxv_parse): New. * auxv.c (default_auxv_parse): Split into default_auxv_parse and generic_auxv_parse. (svr4_auxv_parse): Add. * obsd-tdep.c: Include "auxv.h". (obsd_auxv_parse): Remove. (obsd_init_abi): Remove comment. (obsd_init_abi): Change set_gdbarch_auxv_parse passed argument from `obsd_auxv_parse' to `svr4_auxv_parse'. * nbsd-tdep.c: Include "auxv.h". (nbsd_init_abi): Call set_gdbarch_auxv_parse.
2020-04-09ld: Fix pr22269-1 on 32-bit Solaris/SPARCRainer Orth2-1/+5
pr22269-1.s currently FAILs to assemble on 32-bit Solaris/SPARC: ERROR: -K PIC tmpdir/pr22269-1.s: assembly failed UNRESOLVED: pr22269-1 (static pie undefined weak) tmpdir/pr22269-1.s: Assembler messages: tmpdir/pr22269-1.s:27: Error: Architecture mismatch on "be,pn %icc,.LL4 ,pn %icc,.LL4". tmpdir/pr22269-1.s:27: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.) tmpdir/pr22269-1.s:32: Error: Architecture mismatch on "return %i7+8". tmpdir/pr22269-1.s:32: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.) tmpdir/pr22269-1.s:36: Error: Architecture mismatch on "return %i7+8". tmpdir/pr22269-1.s:36: (Requires v9|v9a|v9b|v9c|v9d|v9e|v9v|v9m|m8; requested architecture is sparclite.) I could trace this to the fact that gcc on sparc-sun-solaris2.* defaults to --with-cpu=v9. So the gcc -S step of compiling the testcase is run with -mcpu=v9, while the manual invocation of as-new lacks the corresponding -Av9, creating a mismatch. Solaris seems to be the only affected target, otherwise only 64-bit-default configurations default to --with-cpu=v9 or --with-cpu=ultrasparc: sparcv9-*-*, sparc64-*-*, sparc64-*-freebsd*, ultrasparc-*-freebsd*, and sparc64-*-openbsd*. This patch just adds -Av9 to AFLAGS_PIC in ld-elf/shared.exp. It has a precedent in ld-elfvers/vers.exp where -Av9a is added to as_options on sparc-*-*. It lets the test pass and causes no other changes in sparc-sun-solaris2.11 test results. * testsuite/ld-elf/shared.exp: Add -Av9 to AFLAGS_PIC on sparc*-*-*.
2020-04-08x86: Correct -mlfence-before-indirect-branch= documentationH.J. Lu2-3/+8
Replace "after indirect near branch" with "before indirect near branch". * doc/c-i386.texi: Correct -mlfence-before-indirect-branch= documentation.
2020-04-09Automatic date update in version.inGDB Administrator1-1/+1
2020-04-08Add pending stop support to gdbserver's Windows portTom Tromey2-3/+38
This changes gdbserver to also handle pending stops, the same way that gdb does. This is PR gdb/22992. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> PR gdb/22992 * win32-low.c (child_continue): Call matching_pending_stop. (get_child_debug_event): Call fetch_pending_stop. Push pending stop when needed.
2020-04-08Implement stopped_by_sw_breakpoint for Windows gdbserverTom Tromey3-12/+75
This changes the Windows gdbserver port to implement the stopped_by_sw_breakpoint target method. This is needed to support pending stops. This is a separate patch now, because Pedro suggested splitting it out for simpler bisecting, in the case that it introduces a bug. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.h (win32_process_target::stopped_by_sw_breakpoint) (win32_process_target::supports_stopped_by_sw_breakpoint): Declare. * win32-low.c (win32_supports_z_point_type): Always handle Z_PACKET_SW_BP. (win32_insert_point): Call insert_memory_breakpoint when needed. (win32_remove_point): Call remove_memory_breakpoint when needed. (win32_process_target::stopped_by_sw_breakpoint) (win32_process_target::supports_stopped_by_sw_breakpoint): New methods. (win32_target_ops): Update. (maybe_adjust_pc): New function. (win32_wait): Call maybe_adjust_pc.
2020-04-08Introduce win32_target_ops::decr_pc_after_breakTom Tromey4-0/+13
This adds a decr_pc_after_break member to win32_target_ops and updates the two Windows targets to set it. Note that I can't test the win32-arm-low.c change. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.h (struct win32_target_ops) <decr_pc_after_break>: New field. * win32-i386-low.c (the_low_target): Update. * win32-arm-low.c (the_low_target): Update.
2020-04-08Add read_pc / write_pc support to win32-lowTom Tromey5-0/+103
This changes win32-low.c to implement the read_pc and write_pc methods. A subsequent patch will need these. Note that I have no way to test, or even compile, the win32-arm-low.c change. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.h (win32_process_target::read_pc) (win32_process_target::write_pc): Declare. * win32-low.c (win32_process_target::read_pc) (win32_process_target::write_pc): New methods. * win32-i386-low.c (i386_win32_get_pc, i386_win32_set_pc): New functions. (the_low_target): Update. * win32-arm-low.c (arm_win32_get_pc, arm_win32_set_pc): New functions. (the_low_target): Update.
2020-04-08Make last_wait_event staticTom Tromey3-9/+15
Now that last_wait_event is entirely handled in nat/windows-nat.c, it can be made static. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * nat/windows-nat.h (last_wait_event): Don't declare. (wait_for_debug_event): Update comment. * nat/windows-nat.c (last_wait_event): Now static.
2020-04-08Move wait_for_debug_event to nat/windows-nat.cTom Tromey6-14/+31
This moves the wait_for_debug_event helper function to nat/windows-nat.c, and changes gdbserver to use it. wait_for_debug_event is a wrapper for WaitForDebugEvent that also sets last_wait_event when appropriate. This is needed to properly handle queued stops. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (wait_for_debug_event): Move to nat/windows-nat.c. * nat/windows-nat.h (wait_for_debug_event): Declare. * nat/windows-nat.c (wait_for_debug_event): Move from windows-nat.c. No longer static. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (win32_kill, get_child_debug_event): Use wait_for_debug_event.
2020-04-08Introduce fetch_pending_stopTom Tromey4-20/+51
This introduces a new "fetch_pending_stop" function and changes gdb to use it. This function removes the first matching pending stop from the list of such stops. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (get_windows_debug_event): Use fetch_pending_stop. * nat/windows-nat.h (fetch_pending_stop): Declare. * nat/windows-nat.c (fetch_pending_stop): New function.
2020-04-08Share some inferior-related Windows codeTom Tromey6-31/+77
This adds a couple of functions to nat/windows-nat.c and changes gdb and gdbserver to use them. One function checks the list of pending stops for a match (not yet used by gdbserver, but will be in a subsequent patch); and the other is a wrapper for ContinueDebugEvent that always uses the last "real" stop event. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_continue): Use matching_pending_stop and continue_last_debug_event. * nat/windows-nat.h (matching_pending_stop) (continue_last_debug_event): Declare. * nat/windows-nat.c (DEBUG_EVENTS): New define. (matching_pending_stop, continue_last_debug_event): New functions. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (child_continue): Call continue_last_debug_event.
2020-04-08Share handle_exceptionTom Tromey6-304/+266
Both gdb and gdbserver have a "handle_exception" function, the bulk of which is shared between the two implementations. This patch arranges for the entire thing to be moved into nat/windows-nat.c, with the differences handled by callbacks. This patch introduces one more callback to make this possible. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (MS_VC_EXCEPTION): Move to nat/windows-nat.c. (handle_exception_result): Move to nat/windows-nat.h. (DEBUG_EXCEPTION_SIMPLE): Remove. (windows_nat::handle_ms_vc_exception): New function. (handle_exception): Move to nat/windows-nat.c. (get_windows_debug_event): Update. (STATUS_WX86_BREAKPOINT, STATUS_WX86_SINGLE_STEP): Move to nat/windows-nat.c. * nat/windows-nat.h (handle_ms_vc_exception): Declare. (handle_exception_result): Move from windows-nat.c. (handle_exception): Declare. * nat/windows-nat.c (MS_VC_EXCEPTION, handle_exception) (STATUS_WX86_SINGLE_STEP, STATUS_WX86_BREAKPOINT): Move from windows-nat.c. gdbserver/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * win32-low.c (handle_exception): Remove. (windows_nat::handle_ms_vc_exception): New function. (get_child_debug_event): Add "continue_status" parameter. Update. (win32_wait): Update.
2020-04-08Remove some globals from windows-nat.cTom Tromey2-6/+6
windows-nat.c has a few "count" globals that don't seem to be used. Possibly they were used for debugging at some point, but they no longer seem useful to me. Because they get in the way of some code sharing, this patch removes them. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (exception_count, event_count): Remove. (handle_exception, get_windows_debug_event) (do_initial_windows_stuff): Update.