aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2019-08-29Fix PR win32/24284: tcp_auto_retry doesn't work in MinGWBernhard Wodok2-0/+17
This was reported by Bernhard Wodok, along with a patch to fix the issue. I adjusted the patch a bit, and I'm submitting the patch on his behalf. According to Bernhard, the issue can be reproduced by doing: 1. start gdb 2. enter 'target remote :2345' 3. observe that it throws a "connection refused" error immediately instead of waiting and throwing a timeout error I.e., I believe it can be reproduced by our current tests, which is why I'm not proposing any extra tests here (well, I don't use nor have any Windows system to test this, so...). The problem happens because, on ser-tcp:wait_for_connect, we call 'gdb_select' passing 0 as its first argument, which, when using MinGW, ends up using the 'gdb_select' version from mingw-hdep.c, and when the first argument is 0 this means that WaitForMultipleObjects will be called with 0 as its first argument as well. According to the MS API docs, this is forbidden: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects The proposed fix is simple: we just call Sleep when N == 0 (and when TIMEOUT is non-NULL), and return 0. It makes sense to me. Both Bernhard and Paul Carroll confirmed that the fix works. I'm Cc'ing Bernhard in case you have any questions about the patch. OK? gdb/ChangeLog: 2019-08-29 Bernhard Wodok <barto@gmx.net> Sergio Durigan Junior <sergiodj@redhat.com> PR win32/24284 * mingw-hdep.c (gdb_select): Handle case when 'n' is zero.
2019-08-29[gdb/testsuite] Fix gdb.fortran/info-types.exp regexpTom de Vries3-4/+25
The gdb.fortran/info-types.exp test-case passes with gcc 7 (though not on openSUSE, due to the extra debug info) and fails with gcc 4.8 and gcc 8. Fix the gdb_test regexp to fix all those cases. gdb/testsuite/ChangeLog: 2019-08-29 Tom de Vries <tdevries@suse.de> * gdb.fortran/info-types.exp: Fix gdb_test regexp to allow more diverse debug info. * lib/fortran.exp (fortran_int8): New proc, based on fortran_int4.
2019-08-28[gdb/testsuite] Fix info-var.exp for debug info from other filesTom de Vries2-2/+13
On openSUSE Leap 15.1, I get: ... FAIL: gdb.base/info-var.exp: info variables FAIL: gdb.base/info-var.exp: info variables -n ... because the info variables command prints info also for init.c: ... File init.c:^M 24: const int _IO_stdin_used;^M ... while the regexps in the test-case only expect info for info-var-f1.c and info-var-f2.c. Fix this by extending the regexps. Tested on x86_64-linux, both openSUSE Leap 15.1 and Fedora 30. gdb/testsuite/ChangeLog: 2019-08-28 Tom de Vries <tdevries@suse.de> * gdb.base/info-var.exp: Allow info variables to print info for files other than info-var-f1.c and info-var-f2.c.
2019-08-28gdb/fortran: Don't include module symbols when searching for typesAndrew Burgess5-2/+26
Currently the 'info types' command will return symbols that correspond to Fortran modules. This is because the symbols are created with domain MODULE_DOMAIN and address_class LOC_TYPEDEF. The address_class LOC_TYPEDEF is the same address_class used for type symbols which is why the modules show up when listing types. This commit explicitly prevents symbols in the MODULE_DOMAIN from appearing when we search for symbols in the TYPES_DOMAIN, this prevents the Fortran module symbols from appearing in the output of 'info types'. gdb/ChangeLog: * symtab.c (search_symbols): Don't include MODULE_DOMAIN symbols when searching for types. gdb/testsuite/ChangeLog: * gdb.fortran/info-types.exp: Add module. * gdb.fortran/info-types.f90: Update expected results.
2019-08-28gdb/fortran: Implement la_print_typedef for FortranAndrew Burgess8-1/+111
Implement an la_print_typedef method for Fortran, this allows 'info types' to work for Fortran. The implementation is just copied from ada_print_typedef (with the appropriate changes). To support the testing of this patch I added a new proc, fortran_character1, to lib/fortran.exp which returns a regexp to match a 1-byte character type. The regexp returned is correct for current versions of gFortran. All of the other regexp are guesses based on all of the other support procs in lib/fortran.exp, I haven't tested them myself. gdb/ChangeLog: * f-lang.c (f_language_defn): Use f_print_typedef. * f-lang.h (f_print_typedef): Declare. * f-typeprint.c (f_print_typedef): Define. gdb/testsuite/ChangeLog: * gdb.fortran/info-types.exp: New file. * gdb.fortran/info-types.f90: New file. * lib/fortran.exp (fortran_character1): New proc.
2019-08-27Fix compiler warning in linux-namespaces.cChristian Biesinger2-1/+5
../../gdb/nat/linux-namespaces.c: In function ‘void mnsh_main(int)’: ../../gdb/nat/linux-namespaces.c:604:8: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized] close (fd); ~~~~~~^~~~ And the warning is correct -- mnsh_recv_message can return -1 and leave fd uninitialized, and mnsh_main will still call close (fd) if that happens. Initialize fd to -1 to avoid that. gdb/ChangeLog: 2019-08-27 Christian Biesinger <cbiesinger@google.com> * nat/linux-namespaces.c (mnsh_main): Initialize fd (to -1).
2019-08-27gdb: Add new -n flag to some info commandsAndrew Burgess16-164/+446
The 'info variables', its alias 'whereis', and 'info functions' all include non-debug symbols in the output by default. The list of non-debug symbols can sometimes be quite long, resulting in the debug symbol based results being scrolled off the screen. This commit adds a '-n' flag to all of the commands listed above that excludes the non-debug symbols from the results, leaving just the debug symbol based results. gdb/ChangeLog: * cli/cli-utils.c (info_print_options_defs): Delete. (make_info_print_options_def_group): Delete. (extract_info_print_options): Delete. (info_print_command_completer): Delete. (info_print_args_help): Add extra parameter, and optionally include text about -n flag. * cli/cli-utils.h (struct info_print_options): Delete. (extract_info_print_options): Delete declaration. (info_print_command_completer): Delete declaration. (info_print_args_help): Add extra parameter, extend header comment. * python/python.c (gdbpy_rbreak): Pass additional parameter to search_symbols. * stack.c (struct info_print_options): New type. (info_print_options_defs): New file scoped variable. (make_info_print_options_def_group): New static function. (info_print_command_completer): New static function. (info_locals_command): Update to use new local functions. (info_args_command): Likewise. (_initialize_stack): Add extra parameter to calls to info_print_args_help. * symtab.c (search_symbols): Add extra parameter, use this to possibly excluse non-debug symbols. (symtab_symbol_info): Add extra parameter, which is passed on to search_symbols. (struct info_print_options): New type. (info_print_options_defs): New file scoped variable. (make_info_print_options_def_group): New static function. (info_print_command_completer): New static function. (info_variables_command): Update to use local functions, and pass extra parameter through to symtab_symbol_info. (info_functions_command): Likewise. (info_types_command): Pass additional argument through to symtab_symbol_info. (rbreak_command): Pass extra argument to search_symbols. (_initialize_symtab): Add extra arguments for calls to info_print_args_help, and update help text for 'info variables', 'whereis', and 'info functions' commands. * symtab.h (search_symbols): Add extra argument to declaration. * NEWS: Mention new flags. gdb/doc/ChangeLog: * gdb.texinfo (Symbols): Add information about the -n flag to "info variables" and "info functions". gdb/testsuite/ChangeLog: * gdb.base/info-fun.exp: Extend to test the -n flag for 'info functions'. Reindent as needed. * gdb.base/info-var-f1.c: New file. * gdb.base/info-var-f2.c: New file. * gdb.base/info-var.exp: New file. * gdb.base/info-var.h: New file.
2019-08-26Factor out the common code in lookup_{static,global}_symbolChristian Biesinger2-57/+57
The two functions are extremely similar; this factors out their code into a shared _internal function. gdb/ChangeLog: 2019-08-26 Christian Biesinger <cbiesinger@google.com> * symtab.c (lookup_static_symbol): Call the new function (and move it down to be next to lookup_global_symbol). (struct global_sym_lookup_data): Add block_enum member and rename to... (struct global_or_static_sym_lookup_data): ...this. (lookup_symbol_global_iterator_cb): Pass block_index instead of GLOBAL_BLOCK to lookup_symbol_in_objfile and rename to... (lookup_symbol_global_or_static_iterator_cb): ...this. (lookup_global_or_static_symbol): New function. (lookup_global_symbol): Call new function.
2019-08-26[gdb, c++] Improve error message when using libstdcxx without SDT probesTom de Vries4-2/+56
When using catch catch/rethrow/catch, a libstdcxx with SDT probes is required for both the regexp argument, and the convenience variable $_exception ( https://sourceware.org/gdb/current/onlinedocs/gdb/Set-Catchpoints.html ). Currently, when using these features with a libstdcxx without SDT probes, we get the cryptic error message: ... not stopped at a C++ exception catchpoint ... Improve this by instead emitting the more helpful: ... did not find exception probe (does libstdcxx have SDT probes?) ... Tested on x86_64-linux. gdb/ChangeLog: 2019-08-26 Tom de Vries <tdevries@suse.de> PR c++/24852 * break-catch-throw.c (fetch_probe_arguments): Improve error mesage when pc_probe.prob == NULL. gdb/testsuite/ChangeLog: 2019-08-26 Tom de Vries <tdevries@suse.de> PR c++/24852 * gdb.cp/no-libstdcxx-probe.exp: New test.
2019-08-26[gdb/testsuite] Make skip_libstdcxx_probe_tests return 1 if trueTom de Vries4-6/+15
The tcl proc skip_libstdcxx_probe_tests currently returns 0 if the probe tests need to be skipped, while tcl interprets 0 as false rather than true, which is confusing. Fix this by making skip_libstdcxx_probe_tests return 1 if the probe tests need to be skipped. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-26 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (skip_libstdcxx_probe_tests_prompt): Return 1 if probe * tests need to be skipped. * gdb.cp/exceptprint.exp: Update call to skip_libstdcxx_probe_tests. * gdb.mi/mi-catch-cpp-exceptions.exp: Update call to mi_skip_libstdcxx_probe_tests.
2019-08-26Use raw strings on gdb.python/py-xmethods.exp (and fix Python 3.8's ↵Sergio Durigan Junior2-18/+23
"SyntaxWarning: invalid escape sequence") The way unrecognized escape sequences are handled has changed in Python 3.8: users now see a SyntaxWarning message, which will eventually become a SyntaxError in future versions of Python: (gdb) source /blabla/gdb.python/py-xmethods/py-xmethods.py /blabla/gdb.python/py-xmethods/py-xmethods.py:204: SyntaxWarning: invalid escape seque nce \+ 'operator\+', /blabla/gdb.python/py-xmethods/py-xmethods.py:211: SyntaxWarning: invalid escape seque nce \+ 'operator\+\+', One of our testcases, gdb.python/py-xmethods.exp, contains strings in the form of "operator\+". This is not recognized by Python, but is still needed by the testsuite to work properly. The solution is simple: we just have to make sure these strings are marked as raw (i.e, r""). This is what this patch does. I took the opportunity to also convert other strings to raw, which, in two cases, allowed the removal of an extra backslash. I tested this using Python 3.7 and Python 3.8, and everything works fine. I think I could push this as obvious, but decided to send it to gdb-patches just in case. gdb/testsuite/ChangeLog: 2019-08-26 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.python/py-xmethods.exp: Use raw strings when passing arguments to SimpleXMethodMatcher.
2019-08-25dwarf2read: fix compilation issue with gcc 4.8Simon Marchi2-5/+11
gcc 4.8 (and probably other versions too) doesn't like that the local variable symbol_linkage has the same name as the enum class defined in the same context: CXX dwarf2read.o /home/smarchi/src/binutils-gdb/gdb/dwarf2read.c: In member function ‘dwarf2_per_cu_data* dw2_debug_names_iterator::next()’: /home/smarchi/src/binutils-gdb/gdb/dwarf2read.c:5850:22: error: ‘symbol_linkage’ is not a class, namespace, or enumeration } symbol_linkage = symbol_linkage::unknown; ^ Rename the local variable to avoid this. This problem was originally reported with the Netbsd builder on the buildbot, which uses gcc 5.5, I believe. I am not able to test it on that builder right now, but chances are that the fix will work there too. gdb/ChangeLog: * dwarf2read.c (dw2_debug_names_iterator::next): Rename local variable symbol_linkage to symbol_linkage_.
2019-08-25dwarf2read: replace gdb::optional<bool> with enumSimon Marchi2-5/+16
gdb::optional<bool> is dangerous, because it's easy to do: if (opt_bool) when you actually meant if (*opt_bool) or vice-versa. The first checks if the optional is set, the second checks if the wrapped bool is true. Replace it with an enum that explicitly defines the three possible states. gdb/ChangeLog: * dwarf2read.c (dw2_debug_names_iterator::next): Use enum to represent whether the symbol is static, dynamic, or we don't know.
2019-08-25Convert the RX target to make use of target descriptions.Yoshinori Sato8-115/+231
gdb/ChangeLog 2019-08-25 Yoshinori Sato <ysato@users.sourceforge.jp> * gdb/rx-tdep.c (rx_register_names): New. (rx_register_name): Delete. (rx_psw_type): Delete. (rx_fpsw_type): Delete. (rx_register_type): Delete. (rx_gdbarch_init): Convert target-descriptions. (_initialize_rx_tdep): Add initialize_tdesc_rx. * gdb/features/Makefile: Add rx.xml. * gdb/features/rx.xml: New. * gdb/features/rx.c: Generated. * gdb/NEWS: Mention target description support. gdb/doc/ChangeLog: 2019-08-25 Yoshinori Sato <ysato@users.sourceforge.jp> * gdb.texinfo (Standard Target Features): Add RX Features sub-section.
2019-08-24Fix compile warning in symtab.cChristian Biesinger2-6/+10
My compiler (g++ 8.2) can't tell that *bsc_ptr and *slot_ptr are only used in the cases when it does get initialized. Just initialize the vars earlier to avoid the warning, there does not seem to be a downside to it. ../../gdb/symtab.c: In function ‘block_symbol lookup_static_symbol(const char*, domain_enum)’: ../../gdb/symtab.c:1366:11: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized] xfree (slot->value.not_found.name); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../gdb/symtab.c:2578:29: note: ‘slot’ was declared here struct symbol_cache_slot *slot; ^~~~ ../../gdb/symtab.c:1405:3: warning: ‘bsc’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (bsc == NULL) ^~ ../../gdb/symtab.c:2577:30: note: ‘bsc’ was declared here struct block_symbol_cache *bsc; ^~~ ../../gdb/symtab.c: In function ‘block_symbol lookup_global_symbol(const char*, const block*, domain_enum)’: ../../gdb/symtab.c:1366:11: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized] xfree (slot->value.not_found.name); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../gdb/symtab.c:2658:29: note: ‘slot’ was declared here struct symbol_cache_slot *slot; ^~~~ ../../gdb/symtab.c:1409:14: warning: ‘bsc’ may be used uninitialized in this function [-Wmaybe-uninitialized] ++bsc->collisions; ~~~~~^~~~~~~~~~ ../../gdb/symtab.c:2657:30: note: ‘bsc’ was declared here struct block_symbol_cache *bsc; ^~~ gdb/ChangeLog: 2019-08-22 Christian Biesinger <cbiesinger@google.com> * symtab.c (symbol_cache_lookup): Always initialize *bsc_ptr and *slot_ptr.
2019-08-23Move gdb-dlfcn.[ch] to gdbsupport/Sergio Durigan Junior13-12/+38
I need to use 'gdb_dlopen' inside 'gdbsupport/', but it's not yet supported there. This commit moves 'gdb-dlfcn.[ch]' to 'gdbsupport/', which makes it available also on gdbserver. gdb/ChangeLog: 2019-08-23 Sergio Durigan Junior <sergiodj@redhat.com> * configure.ac: Don't check for 'dlfcn.h' (moved to gdbsupport/common.m4). * Makefile.in (COMMON_SFILES): Move 'gdb-dlfcn.c' to 'gdbsupport/'. (HFILES_NO_SRCDIR): Likewise, for 'gdb-dlfcn.h'. * compile/compile-c-support.c: Include 'gdbsupport/gdb-dlfcn.h'. * gdbsupport/common.m4: Check for 'dlfcn.h'. * gdb-dlfcn.c: Move to... * gdbsupport/gdb-dlfcn.c: ... here. * gdb-dlfcn.h: Move to... * gdbsupport/gdb-dlfcn.h: ... here. gdb/gdbserver/ChangeLog: 2019-08-23 Sergio Durigan Junior <sergiodj@redhat.com> * Makefile.in (SFILES): Add 'gdbsupport/gdb-dlfcn.c'. (OBS): Add 'gdbsupport/gdb-dlfcn.o'. * config.in: Regenerate. * configure: Regenerate.
2019-08-23Fix bug in nios2 prologue analysis.Sandra Loosemore2-3/+10
The nios2 prologue analyzer was mistakenly using an unsigned int field to represent a 32-bit signed value. This caused problems with an incorrect conversion being applied to negative values when they were automatically promoted for addition to a 64-bit CORE_ADDR value. This patch fixes test failures in gdb.base/large-frame.exp and gdb.dwarf2/dw2-ref-missing-frame.exp. Normally the nios2 backend prefers to use the dwarf2 unwinder so the prologue analyzer is only invoked if there is no dwarf2 information. 2019-08-23 Sandra Loosemore <sandra@codesourcery.com> gdb/ * nios2-tdep.c (struct reg_value): Improve comments. Make the offset field signed.
2019-08-22Make GDB compile with Python 3 on MinGWChristian Biesinger3-9/+46
PyFile_FromString and PyFile_AsFile have been removed in Python 3. There is no obvious replacement that works here, and we can't just pass our FILE* to a DLL in Windows because it may use a different C runtime. So we just call a Python function which reads and executes file contents. Care must be taken to execute it in the context of __main__. Tested by inverting the ifdef and running the testsuite on Debian Linux (even without the patch, I failed at running the testsuite on Windows). I did test with both Python 2 and 3. gdb/ChangeLog: 2019-08-22 Christian Biesinger <cbiesinger@google.com> * python/lib/gdb/__init__.py (_execute_file): New function. * python/python.c (python_run_simple_file): Call gdb._execute_file on Windows.
2019-08-22[gdb/testsuite] Make gdb_test message more informative in ↵Tom de Vries2-2/+7
multi-term-settings.exp This racy fail message, reported in PR24929: ... FAIL: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: \ stop with control-c ... does not make clear which gdb_test fails here: ... if {$expect_ttou} { gdb_test "" "Quit" "stop with control-c" } else { gdb_test "" "received signal SIGINT.*" "stop with control-c" } ... Fix this by making the gdb_test message argument more informative. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-22 Tom de Vries <tdevries@suse.de> * gdb.multi/multi-term-settings.exp (coretest): Make gdb_test messages more informative.
2019-08-22gdb/fortran: Remove some dead code from the parserAndrew Burgess2-11/+8
The Fortran parser contains some code that looks like it was probably inherited from the C/C++ parser as it checks to see if the current language is C++, which should never be true when we're in the Fortran parser. gdb/ChangeLog: * f-exp.y (yylex): Remove is_a_field_of_this local variable, and all uses as this was never set to anything but a zero value.
2019-08-21Fix nullptr in with_command_1Pedro Alves4-0/+13
Running 'with' without arguments crashes GDB. This fixes it. gdb/ChangeLog: 2019-08-21 Bogdan Harjoc <harjoc@gmail.com> * cli/cli-cmds.c (with_command_1): Error out if no arguments. gdb/testsuite/ChangeLog: 2019-08-21 Pedro Alves <palves@redhat.com> * gdb.base/with.exp: Test "with" with no arguments.
2019-08-21Fix g++ 9.1 build breakageChristian Biesinger2-0/+6
gdb/ChangeLog: 2019-08-21 Christian Biesinger <cbiesinger@google.com> * tui/tui-data.h (tui_gen_win_info): Add an =default move constructor, required by some GCC versions.
2019-08-21gdb/djgpp: Add Hygon Dhyana processor supportJinke Fan2-3/+8
Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture between AMD and Haiguang Information Technology Co.,Ltd., which aims at providing high performance x86 processors for the China server market. Its first generation processor codename is Dhyana, which originates from AMD technology and shares most of the architecture with AMD's family 17h, but with different CPU Vendor ID("HygonGenuine")/Family series number(Family 18h). gdb/ChangeLog: 2019-08-21 Jinke Fan <fanjinke51@yeah.net> * go32-nat.c (go32_sysinfo): Add hygon_p.
2019-08-21[gdb/testsuite] Stabilize gdb-caching-proc.exp test orderTom de Vries2-0/+5
The test-case gdb-caching-proc.exp tests each gdb_caching_proc in gdb/testsuite/lib/*.exp. However, the order of .exp file being tested can change from run to run, because of using glob. Fix this by sorting the glob result. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-21 Tom de Vries <tdevries@suse.de> * gdb.base/gdb-caching-proc.exp: Sort files.
2019-08-20Change some tui_data_window methods to be privateTom Tromey2-30/+39
Turning various calls into methods has made it possible to now change some tui_data_window methods to be private. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <last_regs_line_no, line_from_reg_element_no, first_reg_element_no_inline, display_all_data, delete_data_content_windows, erase_data_content>: Now private.
2019-08-20Remove some defines from tui-data.hTom Tromey3-7/+12
This removes the HILITE and NO_HILITE defines from tui-data.h, in favor of simply passing a bool to box_win. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (box_win): Change type of highlight_flag. (tui_unhighlight_win, tui_highlight_win) (tui_win_info::make_window): Update. * tui/tui-data.h (HILITE, NO_HILITE): Remove.
2019-08-20Move some defines to tui-stack.cTom Tromey3-11/+21
Some #defines in tui-data.h are only used in tui-stack.c, so move them there. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-data.h (PROC_PREFIX, LINE_PREFIX, PC_PREFIX) (MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH) (MAX_PID_WIDTH): Move to tui-stack.c. * tui/tui-stack.c (PROC_PREFIX, LINE_PREFIX, PC_PREFIX) (MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH) (MAX_PID_WIDTH): Move from tui-data.h.
2019-08-20Change tui_make_window to be a methodTom Tromey9-35/+49
I combined several small changes into one patch here. I believe I started by noticing that the "title" is not needed by tui_gen_win_info and could be self-managing (i.e. std::string). Moving this revealed that "can_box" is also a property of tui_win_info and not tui_gen_win_info; and this in turn caused the changes to tui_make_window and box_win. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_window): Don't declare. * tui/tui-wingeneral.c (box_win): Change type of win_info. (box_win): Update. (tui_gen_win_info::make_window): Rename from tui_make_window. (tui_win_info::make_window): New method. (tui_gen_win_info::make_visible): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-regs.c (tui_data_window::show_register_group): Update. (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_gen_win_info) <make_window>: Declare. <can_box>: Remove. <title>: Remove. (struct tui_win_info) <make_window>: Declare. <can_box>: Now virtual. <title>: New member. * tui/tui-data.c (~tui_gen_win_info): Don't free title. * tui/tui-command.c (tui_cmd_window::resize): Update.
2019-08-20Remove tui_data_window::display_regsTom Tromey3-7/+7
There's no need for tui_data_window::display_regs any more (if there ever was). All the paths through data window construction will end up setting this to true. This patch removes the member. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <display_regs>: Remove. * tui/tui-regs.c (tui_data_window::show_registers): Update. (tui_data_window::check_register_values): Update.
2019-08-20Remove indirection from tui_data_window::regs_contentTom Tromey3-34/+38
tui_data_window::regs_content is currently a vector of unique_ptr. However, due to the way this is managed now, there is no need to keep the pointers -- it can simply be a vector of the objects themselves. This patch removes this extra layer of indirection. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window): Use DISABLE_COPY_AND_ASSIGN. <regs_content>: Change type, removing unique_ptr. <tui_data_window>: Add move constructor. * tui/tui-regs.c (tui_data_window::show_registers) (tui_data_window::show_register_group) (tui_data_window::display_registers_from) (tui_data_window::display_registers_from) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_data_window::rerender, tui_data_window::refresh_window) (tui_data_window::check_register_values): Update.
2019-08-20Add two methods to tui_data_windowTom Tromey4-35/+43
This changes tui_show_registers and tui_show_register_group to be methods on tui_data_window. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <show_registers, show_register_group>: Declare. (tui_show_register_group): Don't declare. * tui/tui-regs.c (tui_data_window::show_registers): Rename from tui_show_registers. (tui_data_window::show_register_group): Rename from tui_show_register_group. (tui_data_window::check_register_values, tui_reg_command): Update. * tui/tui-layout.c (tui_set_layout): Update.
2019-08-20Change tui_check_register_values to be a methodTom Tromey4-20/+28
This changes tui_check_register_values to be a method on tui_data_window. An additional check in tui_register_changed is needed, because TUI_DATA_WIN could be NULL at this point. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <check_register_values>: Declare. (tui_check_register_values): Don't declare. * tui/tui-regs.c (tui_data_window::check_register_values): Rename from tui_check_register_values. * tui/tui-hooks.c (tui_register_changed): Update.
2019-08-20Rearrange tui-regs.c some moreTom Tromey2-23/+20
This moves tui_reg_layout later in tui-regs.c, closer to where it is used. It also changes tui_show_registers not to enable the TUI or change the layout -- this is already done by this point by all the callers. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reg_layout): Move later. (tui_show_registers): Don't enable TUI mode or change layout.
2019-08-20Change tui_data_item_window::content to be a unique_xmalloc_ptrTom Tromey5-36/+33
This changes tui_data_item_window::content to be a unique_xmalloc_ptr and fixes up the fallout. It also removes a parameter from tui_expand_tabs, as it was only ever given one value. This also removes some tab-handling code from tui_data_window::display_registers_from. Because the content can only be set by tui_register_format, and because that calls tui_expand_tabs, it's not possible to see a tab here. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <~tui_data_item_window>: Remove. <content>: Now a unique_xmalloc_ptr. * tui/tui-regs.c (tui_register_format): Return a unique_xmalloc_ptr. (tui_get_register): Update. (~tui_data_item_window): Remove. (tui_data_window::display_registers_from, tui_display_register): Update. * tui/tui-io.h (tui_expand_tabs): Update. * tui/tui-io.c (tui_expand_tabs): Return a unique_xmalloc_ptr. Remove "col" parameter.
2019-08-20Remove tui_data_item_window::valueTom Tromey3-2/+6
The field tui_data_item_window::value is not used, so remove it. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <value>: Remove field. * tui/tui-regs.c (~tui_data_item_window): Update.
2019-08-20Minor rearrangement in tui-regs.cTom Tromey2-53/+53
This moves a couple of functions earlier in tui-regs.c. Previously they were in the "command" section of the file, but really they belong in the "window implementation" section. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_register_format, tui_get_register): Move earlier.
2019-08-20Remove NULL check from tui_reg_commandTom Tromey2-3/+5
tui_reg_command has an unnecessary NULL check. The preceding call to tui_reg_layout will ensure the window exists. This patch removes the check. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reg_command): Remove NULL check.
2019-08-20Some i18n fixes for the TUITom Tromey5-6/+11
The TUI has a few #defines that hold user-visible strings. As these are only used in a single spot, this patch removes the defines, preferring direct use of the string where needed. Furthermore, now the strings are wrapped in _(), which is friendlier for i18n purposes. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-source.h (struct tui_source_window): Update. * tui/tui-regs.c (tui_show_registers): Update. * tui/tui-disasm.h (struct tui_disasm_window): Update. * tui/tui-data.h (NO_SRC_STRING, NO_DISASSEM_STRING) (NO_REGS_STRING): Remove defines.
2019-08-20[gdb/testsuite] Clean up stale exec in gdb_compile_pascalTom de Vries2-0/+7
When running a pascal test with the stabs target board: ... $ test=gdb.pascal/case-insensitive-symbols.exp $ cd build/gdb/testsuite $ make check RUNTESTFLAGS="$test --target_board=stabs" ... we get: ... nr of untested testcases 1 nr of unsupported tests 1 ... due to: ... Error: Illegal parameter: -gstabs+^M Error: /usr/bin/ppcx64 returned an error exitcode^M ... OTOH, when running the same pascal test without the stabs target board: ... $ make check RUNTESTFLAGS="$test" ... we get: ... nr of expected passes 20 ... But when subsequently again running with the stabs target board: ... $ make check RUNTESTFLAGS="$test --target_board=stabs" ... we now get: ... nr of expected passes 20 ... The problem is that gdb_compile_pascal determines success based on existence of the exec after compilation: ... if ![file exists $destfile] { unsupported "Pascal compilation failed: $result" return "Pascal compilation failed." } ... without removing the exec before compilation, which allows a stale exec to make it seem as if compilation has succeeded. Fix this by removing the stale exec before compilation. gdb/testsuite/ChangeLog: 2019-08-20 Tom de Vries <tdevries@suse.de> * lib/pascal.exp (gdb_compile_pascal): Remove $destfile before compilation.
2019-08-20Improve remote attach round-trips without btraceConrad Meyer2-0/+10
For remotes which do not support btrace at all, we can save several round trips for each thread. This is especially significant when your remote is a kernel with 100s or 1000s of threads and latency is intercontinental. Previously, with target, remote, and infrun debugging enabled, one might see: Sending packet: $Hg18aee#43...Ack Packet received: OK Sending packet: $Hg186f7#eb...Ack Packet received: OK remote:target_xfer_partial (24, , 0x805454000, 0x0, 0x0, 4096) = -1, 0 repeated for all non-exited threads. Afterwards, if the remote does not specify 'qXfer:btrace-conf:read+' in qSupported stub features, these unnecessary thread switches are avoided. gdb/ChangeLog: * remote.c (remote_target::remote_btrace_maybe_reopen): Avoid unnecessary thread walk if remote doesn't support the packet.
2019-08-19Fix indentation in value_has_fieldTom Tromey2-1/+5
value_has_field had a mis-indented line. This fixes it. gdb/ChangeLog 2019-08-19 Tom Tromey <tromey@adacore.com> * python/py-value.c (value_has_field): Fix indentation.
2019-08-19Fix Fortran regression with variables in nested functionsTom Tromey4-11/+31
Sergio pointed out that commit commit aa3b6533 ("Allow nested function displays") regressed a few gdb.fortran tests. I was able to reproduce these failures with gcc head. The bug is that some spots calling contained_in will in fact do the wrong thing if nested functions are considered as contained. In the particular case of the Fortran regression, it was the call in block_innermost_frame, being called from get_hosting_frame -- in this case, the caller is specifically trying to avoid the nested case. This patch fixes the problem by adding an "allow_nested" parameter to contained_in, essentially reverting the change for most callers. gdb/ChangeLog 2019-08-19 Tom Tromey <tromey@adacore.com> * printcmd.c (do_one_display, info_display_command): Update. * block.h (contained_in): Return bool. Add allow_nested parameter. * block.c (contained_in): Return bool. Add allow_nested parameter.
2019-08-19Add Rust support to source highlightingTom Tromey4-7/+39
Currently, no release of GNU Source Highlight supports Rust. However, I've checked in a patch to do so there, and I plan to make a new release sometime this summer. This patch prepares gdb for that by adding support for Rust to the source highlighting code. Because Source Highlight will throw an exception if the language is unrecognized, this also changes gdb to ignore exceptions here. This will cause gdb to fall back to un-highlighted source text. This updates gdb's configure script to reject the combination of Source Highlight and -static-libstdc++. This is done because it's not possible to use -static-libstdc++ and then catch exceptions from a shared library. Tested with the current and development versions of Source Highlight. gdb/ChangeLog 2019-08-19 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Disallow the combination of -static-libstdc++ and source highlight. * source-cache.c (get_language_name): Handle rust. (source_cache::get_source_lines): Ignore highlighting exceptions.
2019-08-16[gdb/testsuite] Fix compare-sections.exp with -fPIE/-pieTom de Vries2-2/+14
When running gdb.base/compare-sections.exp with target board -fPIE/-pie, we get: ... FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r ... The test expects the read-only sections to have the same contents as in the file: ... # Assume startup code doesn't change read-only sections. compare_sections "-r" ... but that's not the case for PIE executables. Fix this by allowing mismatched read-only sections for PIE executables. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-08-16 Tom de Vries <tdevries@suse.de> * gdb.base/compare-sections.exp ("after run to main"): Allow mismatched read-only sections for PIE executables.
2019-08-16Remove the TUI execution info windowTom Tromey10-67/+46
The TUI execution info window is unusual in that it is always linked to a source or disassembly window. Even updates of its content are handled by the source window, so it really has no life of its own. This patch removes this window entirely and puts its functionality directly into the source window. This simplifies the code somewhat. This is a user-visible change, because now the box around the source (or disassembly) window encloses the execution info as well. I consider this an improvement as well, though. Note that this patch caused ncurses to start emitting the "CSI Z" sequence, so I've added this to the test suite terminal implementation. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui.h (enum tui_win_type) <EXEC_INFO_WIN>: Remove. * tui/tui-winsource.h (struct tui_exec_info_window): Remove. (struct tui_source_window_base) <make_visible, refresh_window, resize>: Remove methods. <execution_info>: Remove field. * tui/tui-winsource.c (tui_source_window_base::do_erase_source_content) (tui_show_source_line, tui_source_window_base) (~tui_source_window_base): Update. (tui_source_window_base::resize) (tui_source_window_base::make_visible) (tui_source_window_base::refresh_window): Remove. (tui_source_window_base::update_exec_info): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update. gdb/testsuite/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_csi_Z): New proc. * gdb.tui/basic.exp: Update window positions. * gdb.tui/empty.exp: Update window positions.
2019-08-16Remove useless assignment from tui_remove_hooksTom Tromey2-1/+5
tui_remove_hooks clears deprecated_query_hook, but nothing in the TUI ever sets it; so remove the assignment. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-hooks.c (tui_remove_hooks): Don't set deprecated_query_hook.
2019-08-16Change tui_show_symtab_source to be a methodTom Tromey4-11/+20
This changes tui_show_symtab_source to be a method on tui_source_window. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_update_source_windows_with_addr) (tui_update_source_windows_with_line): Update. * tui/tui-source.h (struct tui_source_window) <show_symtab_source>: Declare. (tui_show_symtab_source): Don't declare. * tui/tui-source.c (tui_show_symtab_source): Rename from tui_show_symtab_source.
2019-08-16Introduce tui_source_window_base::set_contents methodTom Tromey7-39/+67
This introduces the tui_source_window_base::set_contents method and implements it in the subclasses. This removes a check of the window type. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_contents>: Declare. * tui/tui-winsource.c (tui_source_window_base::update_source_window_as_is): Update. * tui/tui-source.h (struct tui_source_window) <set_contents>: Declare. (tui_set_source_content): Don't declare. * tui/tui-source.c (tui_source_window::set_contents): Rename from tui_set_source_content. * tui/tui-disasm.h (struct tui_disasm_window) <set_contents>: Declare. (tui_set_disassem_content): Don't declare. * tui/tui-disasm.c (tui_disasm_window::set_contents): Rename from tui_set_disassem_content.
2019-08-16Change tui_update_breakpoint_info to be a methodTom Tromey3-21/+28
This changes tui_update_breakpoint_info to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <update_breakpoint_info>: Declare. (tui_update_breakpoint_info): Don't declare. * tui/tui-winsource.c (tui_source_window_base::update_source_window_as_is) (tui_update_all_breakpoint_info): Update. (tui_source_window_base::update_breakpoint_info): Rename from tui_update_breakpoint_info. (tui_source_window_base::update_exec_info): Update.
2019-08-16Change tui_update_source_window to be a methodTom Tromey5-18/+29
This changes tui_update_source_window to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <update_source_window>: Declare. (tui_update_source_window): Don't declare. * tui/tui-winsource.c (tui_source_window_base::update_source_window): Rename from tui_update_source_window. (tui_source_window_base::rerender): Update. * tui/tui-source.c (tui_source_window::maybe_update): Update. * tui/tui-disasm.c (tui_show_disassem) (tui_show_disassem_and_update_source) (tui_disasm_window::maybe_update): Update.