aboutsummaryrefslogtreecommitdiff
path: root/gdb/ChangeLog
AgeCommit message (Collapse)AuthorFilesLines
2018-07-16Remove buildsym_new_initTom Tromey1-0/+11
buildsym_new_init is just an alias for buildsym_init. This removes it. In the long run buildsym_init will also go away; this patch just helps make things a bit clearer in the meantime. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_new_init): Update. * mipsread.c (mipscoff_new_init): Update. * mdebugread.c (mdebug_build_psymtabs): Update. * elfread.c (elf_new_init): Update. * dbxread.c (dbx_new_init, coffstab_build_psymtabs) (elfstab_build_psymtabs, stabsect_build_psymtabs): Update. * buildsym.h (buildsym_new_init): Don't declare. * buildsym.c (buildsym_new_init): Remove.
2018-07-16Move within_function to stabsreadTom Tromey1-0/+8
The global within_function is only used by a few symbol readers. This patch moves the global out of buildsym and into stabsread, which seemed like a better fit. It also arranges for the existing readers to clear the global at the appropriate time. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * stabsread.h (within_function): Move from buildsym.h. * stabsread.c (start_stabs): Clear within_function. * coffread.c (coff_start_symtab): Clear within_function. * buildsym.h (within_function): Move to stabsread.h. * buildsym.c (prepare_for_building): Update.
2018-07-16Move processing_gcc to stabsreadTom Tromey1-0/+7
processing_gcc is also only used by stabsread -- it is set by the DWARF reader, but this turns out not to be needed. So, this patch moves processing_gcc and removes the assignment from the DWARF reader. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * stabsread.h (processing_gcc_compilation): Move from buildsym.h. * dwarf2read.c (dwarf2_start_symtab): Don't set processing_gcc_compilation. * buildsym.h (processing_gcc_compilation): Move to stabsread.h.
2018-07-16Move some code from buildsym to stabsreadTom Tromey1-0/+10
A few things that currently reside in buildsym.c turn out to be specific to the stabs reader. This patch moves these from buildsym.[ch] to stabsread.[ch]. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * stabsread.h (HASHSIZE, hashname, symnum, next_symbol_text) (next_symbol_text_func): Move from buildsym.h. * stabsread.c (hashname): Move from buildsym.c. * buildsym.h (HASHSIZE, symnum, next_symbol_text) (next_symbol_text_func, hashname): Move to stabsread.h. * buildsym.c: Don't include bcache.h (hashname): Move to stasbread.c.
2018-07-16Make context_stack_size static in buildsym.cTom Tromey1-0/+5
context_stack_size is declared in buildsym.h, but only used in buildsym.c. This makes it static in buildsym.c. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.h (context_stack_size): Don't declare. * buildsym.c (context_stack_size): New global.
2018-07-16Move processing_acc_compilation to dbxread.cTom Tromey1-0/+5
processing_acc_compilation is only used in dbxread.c, so move it there. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * dbxread.c (processing_acc_compilation): New global. * buildsym.h (processing_acc_compilation): Don't declare.
2018-07-16Move last_source_start_addr to buildsym_compunitTom Tromey1-0/+18
This moves the global last_source_start_addr into buildsym_compunit, adding some accessors as well. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * xcoffread.c (aix_process_linenos, complete_symtab): Update. * dbxread.c (read_ofile_symtab): Update. * coffread.c (coff_start_symtab, coff_end_symtab): Update. * buildsym.h (last_source_start_addr): Remove. (set_last_source_start_addr, get_last_source_start_addr): Declare. * buildsym.c (buildsym_compunit::buildsym_compunit): Add last_addr parameter. (struct buildsym_compunit) <m_last_source_start_addr>: New member. (prepare_for_building): Remove start_addr parameter. (start_symtab, restart_symtab, end_symtab_get_static_block) (end_symtab_with_blockvector): Update. (set_last_source_start_addr, get_last_source_start_addr): New functions.
2018-07-16Move have_line_numbers to buildsym_compunitTom Tromey1-0/+8
This moves the global have_line_numbers into buildsym_compunit. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (struct buildsym_compunit) <m_have_line_numbers>: New member. (have_line_numbers): Remove. (record_line, prepare_for_building, end_symtab_get_static_block) (augment_type_symtab): Update.
2018-07-16Move pending_macros to buildsym_compunitTom Tromey1-0/+12
This moves the pending_macros global into buildsym_compunit. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (~buildsym_compunit): Free the macro table. (struct buildsym_compunit) <get_macro_table, release_macros>: New methods. <m_pending_macros>: New member. (pending_macros): Remove. (~scoped_free_pendings, get_macro_table, prepare_for_building) (reset_symtab_globals, end_symtab_get_static_block) (end_symtab_with_blockvector, augment_type_symtab) (buildsym_init): Update.
2018-07-16Move last_source file to buildsym_compunitTom Tromey1-0/+11
This moves the global last_source_file into buildsym_compunit. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (buildsym_compunit::buildsym_compunit): Add name parameter. (buildsym_compunit::set_last_source_file): New method. <m_last_source_file>: New member. (prepare_for_building): Remove "name" parameter. (start_symtab, restart_symtab, reset_symtab_globals): Update. (last_source_file): Remove. (set_last_source_file, get_last_source_file): Update.
2018-07-16Add assert in prepare_for_buildingTom Tromey1-0/+4
This adds an assertion in prepare_for_building. This was useful for verifying whether some subsequent changes were valid. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (prepare_for_building): Add assert.
2018-07-16Change buildsym_compunit::comp_dir to be a unique_xmalloc_ptrTom Tromey1-0/+7
This change buildsym_compunit::comp_dir to be a unique_xmalloc_ptr. This is just a small cleanup to remove some manual memory management. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (~buildsym_compunit): Update. (struct buildsym_compunit) <comp_unit>: Now a unique_xmalloc_ptr. (start_subfile, patch_subfile_names) (end_symtab_with_blockvector): Update.
2018-07-16Use new and delete for buildsym_compunitTom Tromey1-0/+8
This changes buildsym_compunit to use new and delete. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * buildsym.c (struct buildsym_compunit): Add constructor, destructor, initializers. (start_buildsym_compunit): Remove. (free_buildsym_compunit): Use "delete". (start_symtab, restart_symtab): Use "new".
2018-07-15Fix filename in prior ChangeLog entrySimon Marchi1-4/+5
2018-07-13Remove struct keyword in range-based for loopSimon Marchi1-0/+5
Fix this with gcc 6.3.0: /home/simark/src/binutils-gdb/gdb/symfile.c: In function 'void set_objfile_default_section_offset(objfile*, const section_addr_info&, CORE_ADDR)': /home/simark/src/binutils-gdb/gdb/symfile.c:2114:14: error: types may not be defined in a for-range-declaration [-Werror] for (const struct other_sections *objf_sect : objf_addrs_sorted) ^~~~~~ gdb/ChangeLog: * symfile.c (set_objfile_default_section_offset): Remove struct keyword.
2018-07-14gdb: Add Stafford Horne as or1k maintainer.Stafford Horne1-0/+4
Since I helped upstream openrisc I would like to claim responsibility to maintain it. gdb/ChangeLog: yyyy-mm-dd Stafford Horne <shorne@gmail.com> * (Responsible Maintainers): Add myself as or1k maintainer. Signed-off-by: Stafford Horne <shorne@gmail.com>
2018-07-13Remove a warning on macOSTom Tromey1-0/+5
This removes a clang warning coming from -Wmissing-braces. ChangeLog 2018-07-13 Tom Tromey <tom@tromey.com> * symfile.c (set_objfile_default_section_offset): Use extra braces around initializer.
2018-07-13S390: Fix displaced stepping of "basr r,0"Andreas Arnez1-0/+5
The BASR instruction behaves differently depending on whether the second operand is a number from 1 to 15, or zero. In the former case BASR jumps to the address contained in the general register of that number, but in the latter case no jump is performed. GDB's displaced-stepping logic does not distinguish these cases, although it should. This is fixed. In the case where no jump is performed the PC is adjusted to point back after the original instruction. Otherwise the PC is left alone. gdb/ChangeLog: * s390-tdep.c (s390_displaced_step_fixup): Adjust PC for a non-branching basr.
2018-07-12Add a self-test for cli-utils.cPhilippe Waroquiers1-0/+6
tests added for: * number_or_range_parser In particular, it tests the cur_tok when parsing is finished. * parse_flags * parse_flags_qcs gdb/ChangeLog 2018-07-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add unittests/cli-utils-selftests.c * unittests/cli-utils-selftests.c: New file.
2018-07-12Announce the user visible changes for frame/thread apply in NEWS.Philippe Waroquiers1-0/+4
'frame apply', faas, taas, tfaas commands and [FLAG]... arg for thread apply. gdb/ChangeLog 2018-07-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS: Mention new commands. Mention change to 'thread apply'.
2018-07-12Add [FLAG]... arguments to 'thread apply'.Philippe Waroquiers1-0/+10
Enhance 'thread apply' command to also accept [FLAG]... arguments. An example usage for this new argument: thread apply all -s frame apply all -s p some_local_var_somewhere Prints the thread id, frame location and some_local_var_somewhere value in frames of threads that have such local var. To make the life of the user easier, the most typical use cases have shortcuts : taas : shortcut for 'thread apply all -s' tfaas : shortcut for 'thread apply all -s frame apply all -s" An example usage : tfaas p some_local_var_somewhere same as the longer: 'thread apply all -s frame apply all -s p some_local_var_somewhere' gdb/ChangeLog 2018-07-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * thread.c (thr_try_catch_cmd): New function. (thread_apply_all_command): Handle qcs flags. (thread_apply_command): Handle qcs flags. (taas_command): New function. (tfaas_command): New function. (_initialize_thread): Update to setup the new commands 'taas and 'tfaas'. Change doc string for 'thread apply'.
2018-07-12Implement frame apply [all | COUNT | -COUNT | level LEVEL... ] [FLAG]... ↵Philippe Waroquiers1-0/+15
COMMAND. Implement frame apply [all | COUNT | -COUNT | level LEVEL... ] [FLAG]... COMMAND. Also implement the command 'faas COMMAND', a shortcut for 'frame apply all -s COMMAND'. The syntax of 'frame apply' to specify some innermost or outermost frames is similar to 'backtrace' command, using COUNT or -COUNT. To apply a COMMAND to a more specific set of frames, the following new command and syntax can be used: frame apply level LEVEL... [FLAG]... COMMAND where LEVEL is one or more frame levels or range of frame levels. The new command 'frame apply' allows to apply a COMMAND to a number of frames, or to all frames, or to a set of frames. The optional [FLAG]... arguments allow to control what output to produce and how to handle errors raised when applying COMMAND to a frame. Some example usages for this new command: frame apply all info frame Produce info frame for all frames. frame apply all p $sp For each frame, print the location, followed by the frame sp. frame apply all -q p $sp Same as before, but -q flag (q = quiet) indicates to only print the frames sp. frame apply all p some_local_var_somewhere Print some_local_var_somewhere in all frames. 'frame apply' will abort as soon as the print command fails. frame apply all -c p some_local_var_somewhere Same as before, but -c flag (c = continue) means to print the error and continue applying command in case the print command fails. frame apply all -s p some_local_var_somewhere Same as before, but -s flag (s = silent) means to be silent for frames where the print command fails. In other words, this allows to 'search' the frame in which some_local_var_somewhere can be printed. frame apply all -s -q p some_local_var_somewhere Same as before, but does not print the frame info in which the variable is found. frame apply level 2-4 5 8-10 -s p i = i + 1 Increments i in the identified frames. gdb/ChangeLog 2018-07-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * stack.c: (trailing_outermost_frame): New function, mostly extracted from backtrace_command_1. (leading_innermost_frame): New function. (backtrace_command_1): Update to call trailing_outermost_frame. (frame_apply_command_count): New function. (frame_apply_level_command): New function. (frame_apply_all_command): New function. (frame_apply_command): New function. (faas_command): New function. (frame_cmd_list): New variable. (_initialize_stack): Update to setup the new commands 'frame apply' and 'faas'.
2018-07-12Add helper functions parse_flags and parse_flags_qcsPhilippe Waroquiers1-0/+13
Add helper functions parse_flags and parse_flags_qcs. parse_flags helper function allows to look for a set of flags at the start of a string. A flag must be given individually. parse_flags_qcs is a specialised helper function to handle the flags -q, -c and -s, that are used in the new command 'frame apply' and in the command 'thread apply. Modify number_or_range_parser::get_number to differentiate a - followed by digits from a - followed by an alpha (i.e. a flag or an option). That is needed for the addition of the [FLAG]... arguments to thread apply ID... [FLAG]... COMMAND Remove bool number_or_range_parser::m_finished, rather implement the 'finished' logic inside number_or_range_parser::finished. The new logic properly detects the end of parsing even if not at end of the string. This ensures that number_or_range_parser::cur_tok really points past the last parsed token when parsing is finished. Before, it was always pointing at the end of the string. As parsing now is finished directly when not positioned on a number, number_is_in_list must do an error check before the loop getting all numbers. The error message for 'thread apply -$unknownconvvar p 1' is now the more clear: Convenience variable must have integer value. Invalid thread ID: -$unknownconvvar p 1 instead of previously: negative value gdb/ChangeLog 2018-07-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli-utils.c (number_or_range_parser::get_number): Only handle numbers or convenience var as numbers. (parse_flags): New function. (parse_flags_qcs): New function. (number_or_range_parser::finished): Ensure parsing end is detected before end of string. * cli-utils.h (parse_flags): New function. (parse_flags_qcs): New function. (number_or_range_parser): Remove m_finished bool. (number_or_range_parser::skip_range): Set m_in_range to false. gdb/testsuite/ChangeLog 2018-07-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/skip.exp: Update expected error message.
2018-07-12Declare 'ioarg' (from ser-tcp.c:try_connect) as 'u_long' when on Windows ↵Sergio Durigan Junior1-0/+5
(and unbreak build on mingw32) When building GDB on mingw32, it fails with: ../../binutils-gdb/gdb/ser-tcp.c: In function 'int try_connect(const addrinfo*, unsigned int*)': ../../binutils-gdb/gdb/ser-tcp.c:176:25: error: invalid conversion from 'int*' to 'u_long* {aka long unsigned int*}' [-fpermissive] ioctl (sock, FIONBIO, &ioarg); ^~~~~~ In file included from ../../binutils-gdb/gdb/serial.h:23:0, from ../../binutils-gdb/gdb/ser-tcp.c:21: /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:977:34: note: initializing argument 3 of 'int ioctlsocket(SOCKET, long int, u_long*)' WINSOCK_API_LINKAGE int WSAAPI ioctlsocket(SOCKET s,__LONG32 cmd,u_long *argp); ^~~~~~~~~~~ make[2]: *** [Makefile:1610: ser-tcp.o] Error 1 The problem happens because the IPv6 commit (c7ab0aef11d91b637bf091aa9176b8dc4aadee46) wrongly removed the code responsible for declaring 'ioarg' with a different type if building for Windows. This patch restores that. gdb/ChangeLog: 2018-07-12 Sergio Durigan Junior <sergiodj@redhat.com> * ser-tcp.c (try_connect): Declare 'ioarg' as 'u_long' if building on Windows.
2018-07-11Implement IPv6 support for GDB/gdbserverSergio Durigan Junior1-0/+23
This patch implements IPv6 support for both GDB and gdbserver. Based on my research, it is the fourth attempt to do that since 2006. Since I used ideas from all of the previous patches, I also added their authors's names on the ChangeLogs as a way to recognize their efforts. For reference sake, you can find the previous attempts at: https://sourceware.org/ml/gdb-patches/2006-09/msg00192.html https://sourceware.org/ml/gdb-patches/2014-02/msg00248.html https://sourceware.org/ml/gdb-patches/2016-02/msg00226.html The basic idea behind the patch is to start using the new 'getaddrinfo'/'getnameinfo' calls, which are responsible for translating names and addresses in a protocol-independent way. This means that if we ever have a new version of the IP protocol, we won't need to change the code again (or, at least, won't have to change the majority of the code). The function 'getaddrinfo' returns a linked list of possible addresses to connect to. Dealing with multiple addresses proved to be a hard task with the current TCP auto-retry mechanism implemented on ser-tcp:net_open. For example, when gdbserver listened only on an IPv4 socket: $ ./gdbserver --once 127.0.0.1:1234 ./a.out and GDB was instructed to try to connect to both IPv6 and IPv4 sockets: $ ./gdb -ex 'target extended-remote localhost:1234' ./a.out the user would notice a somewhat big delay before GDB was able to connect to the IPv4 socket. This happened because GDB was trying to connect to the IPv6 socket first, and had to wait until the connection timed out before it tried to connect to the IPv4 socket. For that reason, I had to rewrite the main loop and implement a new method for handling multiple connections. After some discussion, Pedro and I agreed on the following algorithm: 1) For each entry returned by 'getaddrinfo', we try to open a socket and connect to it. 2.a) If we have a successful 'connect', we just use that connection. 2.b) If we don't have a successfull 'connect', but if we've got a ECONNREFUSED (meaning the the connection was refused), we keep track of this fact by using a flag. 2.c) If we don't have a successfull 'connect', but if we've got a EINPROGRESS (meaning that the connection is in progress), we perform a 'select' call on the socket until we have a result (either a successful connection, or an error on the socket). 3) If tcp_auto_retry is true, and we haven't gotten a successful connection, and at least one of our attempts failed with ECONNREFUSED, then we wait a little bit (i.e., call 'wait_for_connect'), check to see if there was a timeout/interruption (in which case we bail out), and then go back to (1). After multiple tests, I was able to connect without delay on the scenario described above, and was also able to connect in all other types of scenarios. I also implemented some hostname parsing functions (along with their corresponding unit tests) which are used to help GDB and gdbserver to parse hostname strings provided by the user. These new functions are living inside common/netstuff.[ch]. I've had to do that since IPv6 introduces a new URL scheme, which defines that square brackets can be used to enclose the host part and differentiate it from the port (e.g., "[::1]:1234" means "host ::1, port 1234"). I spent some time thinking about a reasonable way to interpret what the user wants, and I came up with the following: - If the user has provided a prefix that doesn't specify the protocol version (i.e., "tcp:" or "udp:"), or if the user has not provided any prefix, don't make any assumptions (i.e., assume AF_UNSPEC when dealing with 'getaddrinfo') *unless* the host starts with "[" (in which case, assume it's an IPv6 host). - If the user has provided a prefix that does specify the protocol version (i.e., "tcp4:", "tcp6:", "udp4:" or "udp6:"), then respect that. This method doesn't follow strictly what RFC 2732 proposes (that literal IPv6 addresses should be provided enclosed in "[" and "]") because IPv6 addresses still can be provided without square brackets in our case, but since we have prefixes to specify protocol versions I think this is not an issue. Another thing worth mentioning is the new 'GDB_TEST_SOCKETHOST' testcase parameter, which makes it possible to specify the hostname (without the port) to be used when testing GDB and gdbserver. For example, to run IPv6 tests: $ make check-gdb RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp6:[::1]' Or, to run IPv4 tests: $ make check-gdb RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp4:127.0.0.1' This required a few changes on the gdbserver-base.exp, and also a minimal adjustment on gdb.server/run-without-local-binary.exp. Finally, I've implemented a new testcase, gdb.server/server-connect.exp, which is supposed to run on the native host and perform various "smoke tests" using different connection methods. This patch has been regression-tested on BuildBot and locally, and also built using a x86_64-w64-mingw32 GCC, and no problems were found. gdb/ChangeLog: 2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Paul Fertser <fercerpav@gmail.com> Tsutomu Seki <sekiriki@gmail.com> Pedro Alves <palves@redhat.com> * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add 'unittests/parse-connection-spec-selftests.c'. (COMMON_SFILES): Add 'common/netstuff.c'. (HFILES_NO_SRCDIR): Add 'common/netstuff.h'. * NEWS (Changes since GDB 8.2): Mention IPv6 support. * common/netstuff.c: New file. * common/netstuff.h: New file. * ser-tcp.c: Include 'netstuff.h' and 'wspiapi.h'. (wait_for_connect): Update comment. New parameter 'gdb::optional<int> sock' instead of 'struct serial *scb'. Use 'sock' directly instead of 'scb->fd'. (try_connect): New function, with code from 'net_open'. (net_open): Rewrite main loop to deal with multiple sockets/addresses. Handle IPv6-style hostnames; implement support for IPv6 connections. * unittests/parse-connection-spec-selftests.c: New file. gdb/gdbserver/ChangeLog: 2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Paul Fertser <fercerpav@gmail.com> Tsutomu Seki <sekiriki@gmail.com> * Makefile.in (SFILES): Add '$(srcdir)/common/netstuff.c'. (OBS): Add 'common/netstuff.o'. (GDBREPLAY_OBS): Likewise. * gdbreplay.c: Include 'wspiapi.h' and 'netstuff.h'. (remote_open): Implement support for IPv6 connections. * remote-utils.c: Include 'netstuff.h', 'filestuff.h' and 'wspiapi.h'. (handle_accept_event): Accept connections from IPv6 sources. (remote_prepare): Handle IPv6-style hostnames; implement support for IPv6 connections. (remote_open): Implement support for printing connections from IPv6 sources. gdb/testsuite/ChangeLog: 2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Paul Fertser <fercerpav@gmail.com> Tsutomu Seki <sekiriki@gmail.com> * README (Testsuite Parameters): Mention new 'GDB_TEST_SOCKETHOST' parameter. * boards/native-extended-gdbserver.exp: Do not set 'sockethost' by default. * boards/native-gdbserver.exp: Likewise. * gdb.server/run-without-local-binary.exp: Improve regexp used for detecting when a remote debugging connection succeeds. * gdb.server/server-connect.exp: New file. * lib/gdbserver-support.exp (gdbserver_default_get_comm_port): Do not prefix the port number with ":". (gdbserver_start): New global GDB_TEST_SOCKETHOST. Implement support for detecting and using it. Add '$debughost_gdbserver' to the list of arguments used to start gdbserver. Handle case when gdbserver cannot resolve a network name. gdb/doc/ChangeLog: 2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Paul Fertser <fercerpav@gmail.com> Tsutomu Seki <sekiriki@gmail.com> * gdb.texinfo (Remote Connection Commands): Add explanation about new IPv6 support. Add new connection prefixes.
2018-07-11GDB: Work around D;PID handling bug in older GDBservers (PR gdb/23377)Pedro Alves1-0/+6
This commit adds a GDB workaround for the GDBserver bug exposed by commit f2ffa92bbce9 ("gdb: Eliminate the 'stop_pc' global"), so that newer GDBs can continue working with older GDBservers. gdb/ChangeLog: 2018-07-11 Pedro Alves <palves@redhat.com> PR gdb/23377 * remote.c (remote_target::remote_detach_pid): Call set_current_process.
2018-07-11gdb: Remove traces of h8300 ecoff supportPedro Alves1-0/+5
There's this little bit of ecoff support in the h8300 port that I ran into that I think we could remove. Grepping around BFD, I don't think ECOFF is supported for h8300. And if not, I'm failing to see why we'd support ECOFF debug info in ELF for h8300 (.mdebug). It kind of seems like someone just installed the set_gdbarch_ecoff_reg_to_regnum hook at the same time the dwarf2 and stabs hooks were installed. I'm removing this so that greps for ecoff stuff only lead to MIPS, as ISTR that Linux/MIPS support still relies on some subset of ECOFF for something. gdb/ChangeLog: 2018-07-11 Pedro Alves <palves@redhat.com> * h8300-tdep.c (h8300_gdbarch_init): Remove set_gdbarch_ecoff_reg_to_regnum calls.
2018-07-11Fix PR c++/23373: GDB hangs when printing a struct with a static member of ↵Sergio Durigan Junior1-0/+6
itself This patch fixes a failure that happens when a structure has a static member whose type is the same as itself. From the bug report: Example code: struct A { static A Empty; int a; }; int main(void) { A a; return 0; } Output: (gdb) ptype/o A /* offset | size */ type = struct A { static struct A { static struct A { static struct A { static struct A { static struct A { static struct A { ... # infinite loop The problem here is that GDB is not taking into account the fact that static members inside a class/struct are not stored in the class/struct, and therefore they should not be accounted for during the display of the offsets/sizes. The fix is simple: we just check if the field we're dealing with (on c-typeprint.c:c_type_print_base_struct_union) is static, and if it is then we don't iterate over it. This patch also adds a new test for this case, and doesn't introduce any regressions. I believe it is important enough to be included in the 8.2 branch. OK? gdb/ChangeLog: 2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com> PR c++/23373 * c-typeprint.c (c_type_print_base_struct_union): Don't print offsets/sizes for static members of a class/struct. gdb/testsuite/ChangeLog: 2018-07-11 Sergio Durigan Junior <sergiodj@redhat.com> PR c++/23373 * gdb.base/ptype-offsets.cc (struct static_member): New struct. (main) <stmember>: New variable. * gdb.base/ptype-offsets.exp: Add test for printing a struct with a static member in it.
2018-07-11Rename tdesc_register_size to tdesc_register_bitsizeAlan Hayward1-0/+7
tdesc_register_size returns number of bits, not bytes. Rename to make it clearer. Also, fixed bug in aarch64_get_tdesc_vq which assumed bytes. gdb/ * target-descriptions.c (tdesc_register_bitsize): Rename. * target-descriptions.h (tdesc_register_bitsize): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Use new name. * aarch64-tdep.c (aarch64_get_tdesc_vq): Convert size.
2018-07-10Use std::vector for moribund_locationsTom Tromey1-0/+10
This changes moribund_locations to use a std::vector rather than VEC. I also noticed that moribund_locations is only used in breakpoint.c, so now it is static as well. It might be possible to make this code a bit simpler by using a ref_ptr in moribund_locations; however, I have not done this. Tested by the buildbot. gdb/ChangeLog 2018-07-10 Tom Tromey <tom@tromey.com> * breakpoint.c (moribund_locations): Now static and a std::vector. (breakpoint_init_inferior, moribund_breakpoint_here_p) (build_bpstat_chain, update_global_location_list) (breakpoint_retire_moribund): Update. * breakpoint.h (bp_location_p): Remove typedef. Don't declare VEC.
2018-07-10gdb/riscv: Fix assertion in inferior call codeAndrew Burgess1-0/+8
An assertion when setting up arguments for an inferior call checks the size of the argument against xlen. However, if xlen and flen are different sizes, and the argument is being placed into a floating pointer register then we should be comparing against flen not xlen. This issue shows up as an assertion failure when running on an rv32g target with a binary compiled using the rv32f abi and making an inferior call involving large floating point arguments, for example the test gdb.base/infcall-nested-structs.exp. gdb/ChangeLog: * riscv-tdep.c (riscv_is_fp_regno_p): New function. (riscv_register_reggroup_p): Use new function, remove unneeded parenthesis. (riscv_push_dummy_call): Extend assert to compare against xlen or flen based on register type.
2018-07-10gdb/riscv: Use TYPE_SAFE_NAMEAndrew Burgess1-0/+4
In debug printing, use TYPE_SAFE_NAME instead of replicating the functionality using TYPE_NAME and a null check. gdb/ChangeLog: * riscv-tdep.c (riscv_print_arg_location): Use TYPE_SAFE_NAME.
2018-07-09gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.cAndrew Burgess1-0/+8
Switch to use add_setshow_zuinteger_unlimited_cmd for some of the control variables in remote.c. The variables hardware-watchpoint-limit, hardware-breakpoint-limit, and hardware-watchpoint-length-limit are all changed. For example, a user will now see this: (gdb) show remote hardware-breakpoint-limit The maximum number of target hardware breakpoints is unlimited. Instead of this: (gdb) show remote hardware-breakpoint-limit The maximum number of target hardware breakpoints is -1. And can do this: (gdb) set remote hardware-breakpoint-limit unlimited However, previously any negative value implied "unlimited", now only -1, or the text "unlimited" can be used for unlimited. Any other negative value will give an error about invalid input. This is a small change in the user interface, but, hopefully, this will not cause too many problems. I've also added show functions for these three variables to allow for internationalisation. gdb/ChangeLog: * remote.c (show_hardware_watchpoint_limit): New function. (show_hardware_watchpoint_length_limit): New function. (show_hardware_breakpoint_limit): New function. (_initialize_remote): Use add_setshow_zuinteger_unlimited_cmd where appropriate, update help text. gdb/doc/ChangeLog: * gdb.texinfo (Remote Configuration): Update descriptions for set/show of hardware-watchpoint-limit, hardware-breakpoint-limit, and hardware-watchpoint-length-limit variables.
2018-07-09Don't mention XM_CDEPS or NAT_CLIBSTom Tromey1-0/+5
Neither XM_CDEPS nor NAT_CLIBS are defined anywhere, so remove the uses. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (CDEPS): Don't mention XM_CDEPS. (CLIBS): Don't mention NAT_CLIBS.
2018-07-09Remove ADD_FILES and ADD_DEPS from Makefile.inTom Tromey1-0/+6
Nothing defines XM_ADD_FILES, TM_ADD_FILES, or NAT_ADD_FILES any more, so consequently ADD_FILES and ADD_DEPS are no longer needed. So, this removes them. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (ADD_FILES, ADD_DEPS): Remove. (LIBGDB_OBS, clean mostlyclean): Update. (gdb$(EXEEXT), insight$(EXEEXT)): Update.
2018-07-09Minimize yacc and lex outputTom Tromey1-0/+6
This minimizes the "make" output from the yacc and lex rules, following the same technique as the rest of the Makefile. The lex rule had a special case to deal with the situation where flex is not available. I don't think this is needed, so I removed it. If flex is truly unavailable, the person building gdb can simply "touch" the output file. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (%.c: %.y): Use ECHO_YACC. (%.c: %.l): Use ECHO_LEX. Just fail if flex not available. * silent-rules.mk (ECHO_YACC, ECHO_LEX): New variables.
2018-07-09Fix exec.c handling in MakefileTom Tromey1-0/+6
exec.c ws handled specially in COMMON_OBS, but there doesn't seem to be a reason for this. This changes the Makefile to treat exec.c as an ordinary source file. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (ALLDEPFILES): Remove exec.c. (COMMON_OBS): Remove exec.o. (COMMON_SFILES): Add exec.c.
2018-07-09Remove lint supportTom Tromey1-0/+4
I don't think anyone uses lint any more, so this removes the support for it from the Makefile. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (LINT, LINTFLAGS, LINTFILES, lint): Remove.
2018-07-09Use a stamp file for version.cTom Tromey1-0/+6
This introduces a stamp file for version.c, preventing unnecessary version.o rebuilds. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (clean mostlyclean): Remove stamp-version. (version.c): Depend on stamp-version. (stamp-version): New rule, from version.c rule.
2018-07-09Use a stamp file for init.cTom Tromey1-0/+6
This introduces a stamp file for init.c. This prevents constant rebuilds of init.o, by arranging for init.c to only be modified when its contents change. (FWIW this is a standard idiom in use by Automake and by gdb itself for many years.) gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (init.c): Depend on stamp-init. (stamp-init): New rule, from init.c rule. (clean mostlyclean): Remove stamp-init.
2018-07-09Simplify INIT_FILESTom Tromey1-0/+5
This simplifies the INIT_FILES variable. COMMON_OBS includes CONFIG_OBS and SUBDIR_GCC_COMPILE_OBS, so there's no need to reference CONFIG_OBS or SUBDIR_GCC_COMPILE_SRCS there. Once this is done, it it clear that duplicates can't occur, so remove the duplicate-removing code as well. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (INIT_FILES): Remove CONFIG_SRCS, SUBDIR_GCC_COMPILE_SRCS.
2018-07-09Remove some unused code from init.c build ruleTom Tromey1-0/+4
The init.c build rule has a few sed expressions that aren't necessary any more. This removes them. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (init.c): Remove some unused sed rules.
2018-07-09Remove TSOBS from gdb/Makefile.inTom Tromey1-0/+8
The TSOBS variable doesn't seem to serve a useful purpose in gdb/Makefile.in, so remove it. gdb/ChangeLog 2018-07-09 Tom Tromey <tom@tromey.com> * Makefile.in (TSOBS): Remove. (INIT_FILES): Update. (LIBGDB_OBS): Update. (COMMON_SFILES): Add inflow.c. (SFILES): Remove inflow.c.
2018-07-07contrib/gdb-add-index.sh -dwarf-5Jan Kratochvil1-0/+4
------------------------------------------------------------------------------ (gdb) help save gdb-index Save a gdb-index file. Usage: save gdb-index [-dwarf-5] DIRECTORY No options create one file with .gdb-index extension for pre-DWARF-5 compatible .gdb_index section. With -dwarf-5 creates two files with extension .debug_names and .debug_str for DWARF-5 .debug_names section. ------------------------------------------------------------------------------ But gdb-add-index command provided no way how to pass the -dwarf-5 option. gdb/ChangeLog 2018-07-07 Jan Kratochvil <jan.kratochvil@redhat.com> * contrib/gdb-add-index.sh ($dwarf5): New, use it.
2018-07-07ia64-tdep.c: Fix -Wwrite-strings errorsSimon Marchi1-0/+7
Simply add const where necessary to get rid of errors like: /home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:1: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings] static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg)); ^~~~~~~~~~~~~~ /home/simark/src/binutils-gdb/gdb/common/preprocessor.h:28:25: note: in definition of macro ‘STRINGIFY_1’ #define STRINGIFY_1(x) #x ^ /home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:29: note: in expansion of macro ‘STRINGIFY’ static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg)); ^~~~~~~~~ gdb/ChangeLog: * ia64-tdep.c (get_reg_name, get_fpreg_name, get_saveloc_name, is_signal_frame_name, step_name, init_remote_name, create_addr_space_name, destroy_addr_space_name, search_unwind_table_name, find_dyn_list_name): Constify.
2018-07-05darwin: Silence syscall deprecated declaration warningSimon Marchi1-0/+5
This patch silences this warning: /Users/simark/src/binutils-gdb/gdb/darwin-nat.c:839:10: error: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Werror,-Wdeprecated-declarations] res = syscall (SYS___pthread_kill, thread->gdb_port, nsignal); ^ /usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here int syscall(int, ...); ^ The comment of the new pthread_kill function explains why we use the syscall function directly. include/ChangeLog: * diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS): Define for clang. gdb/ChangeLog: * darwin-nat.c (darwin_pthread_kill): New function. (darwin_resume_thread): Use darwin_pthread_kill.
2018-07-05[gdb] Fix build error in macroexp.cTom de Vries1-0/+4
When doing a combined build with the gcc and binutils-gdb repos, I run into this build error in gdb: ... gdb/macroexp.c: \ In function ‘void get_next_token_for_substitution(macro_buffer*, \ macro_buffer*, char**, macro_buffer*, char**, int*, bool*)’: gdb/macroexp.c:925:17: error: \ implicitly-declared ‘constexpr macro_buffer& \ macro_buffer::operator=(const macro_buffer&)’ is deprecated \ [-Werror=deprecated-copy] *token = *lookahead; ... Wdeprecated-copy is a new gcc warning added after gcc 8. This patch fixes the build error by adding an explicit copy operator to the macro_buffer class. I've added asserts to ensure that both the dest and src of the copy are shared, in other words, neither is owner of the text pointer. I've run the gdb testsuite on x86_64-linux and the asserts did not trigger. 2018-07-05 Tom de Vries <tdevries@suse.de> * macroexp.c (macro_buffer) <operator=>: New member function.
2018-07-04Use exit_inferior in darwin_attach_pidTom Tromey1-0/+4
Commit a50c11c666 was intended to use exit_inferior in darwin_attach_pid, but I accidentally pushed the wrong version of the patch. This fixes the problem. gdb/ChangeLog 2018-07-04 Tom Tromey <tom@tromey.com> * darwin-nat.c (darwin_attach_pid): Use exit_inferior.
2018-07-04darwin: Don't use sbrkSimon Marchi1-0/+7
This patch gets rid of this warning on macOS: CXX main.o /Users/simark/src/binutils-gdb/gdb/main.c:492:27: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations] lim_at_start = (char *) sbrk (0); ^ /usr/include/unistd.h:585:1: note: 'sbrk' has been explicitly marked deprecated here __deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED ^ /usr/include/sys/cdefs.h:176:37: note: expanded from macro '__deprecated' #define __deprecated __attribute__((deprecated)) ^ sbrk on macOS is not useful for our purposes, since sbrk(0) always returns the same value. From what I read, brk/sbrk on macOS is just an emulation, it always returns a pointer in a 4MB section reserved for that. So instead of letting users use "maint set per-command space on" and print silly results, I think we should just disable that feature for this platform (as we do for platforms that don't have sbrk). I defined a HAVE_USEFUL_SBRK macro and used that instead of HAVE_SBRK. gdb/ChangeLog: * common/common-defs.h (HAVE_USEFUL_SBRK): Define. * main.c: Use HAVE_USEFUL_SBRK instead of HAVE_SBRK. * maint.c: Likewise. * top.c: Likewise.
2018-07-04Update NEWS post GDB 8.2 branch creation.Joel Brobecker1-0/+6
gdb/ChangeLog: * NEWS: Create a new section for the next release branch. Rename the section of the current branch, now that it has been cut.