aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2015-06-12Fix MI dprintf-insert not printing on a resolved pending location.Antoine Tremblay6-2/+155
This patch fixes the "Format string required" error when trying to print a dprintf on a now resolved, pending location when set via the MI interface even if the format string is entered correctly. This patch also adds a test case to check that issue called mi-dprintf-pending.exp. gdb/ChangeLog: PR breakpoints/16465 * breakpoint.c (create_breakpoint): Save extra_string for pending breakpoints. gdb/testsuite/ChangeLog: PR breakpoints/16465 * gdb.mi/mi-dprintf-pending.c: New file. * gdb.mi/mi-dprintf-pending.exp: New test. * gdb.mi/mi-dprintf-pendshr.c: New file.
2015-06-12Fix broken GDB build after adding Bound table support for i386.Walfred Tedeschi4-2/+17
Types used for some variables could not be used for 32 bits, causing a compilation failure. This patch adds a cast to force a quite compilation, but at the same time it bails out in the case that the cast performed is not safe, i.e. in the case where the debuggee is 64bit and debugger is 32bit. Documentation was also affected, once a different version of texinfo the docs could not be build. 2015-06-10 Walfred Tedeschi <walfred.tedeschi@intel.com> * i386-tdep.c (i386_mpx_get_bt_entry): Add a cast for mpx_bd_mask and bt_mask to CORE_ADDR. doc: * gdb.textinfo (i386): Fix "@end table" end and "@table" placement.
2015-06-11Use pulongest for printing ssize_tGary Benson2-4/+10
This commit changes the debug printing code in linux-namespaces.c to use pulongest instead of "%ld". gdb/ChangeLog: * nat/linux-namespaces.c (mnsh_send_message): Use pulongest. (mnsh_recv_message): Likewise.
2015-06-11Fix ARI new warnings introduced in i386-tdep.c.Walfred Tedeschi2-2/+7
1. gdb/i386-tdep.c:8720: Do not use 'long long', instead use LONGEST gdb/i386-tdep.c:8720: long long int size; 2. gdb/i386-tdep.c:8755: Do not use printf(%ll), instead use printf(%s,phex()) to dump a 'long long' value gdb/i386-tdep.c:8755: ui_out_field_fmt (uiout, "size", "%lld", size); 2015-06-11 Walfred Tedeschi <walfred.tedeschi@intel.com> * i386-tdep.c (i386_mpx_print_bounds): use of LONGEST instead of long long int and plongest instead of %ll. Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
2015-06-11Fix ARI warning in linux-namespaces.cGary Benson2-1/+6
This commit fixes the following ARI warning: gdb/nat/linux-namespaces.c:28: regression: Do not include wait.h or sys/wait.h, instead include gdb_wait.h gdb/ChangeLog: * nat/linux-namespaces.c (gdb_wait.h): New include. (sys/wait.h): Do not include.
2015-06-10dwarf2read: call dwarf_finish_line when ending a sequenceSimon Marchi2-1/+6
Commit d9b3de22f33e400f7f409cce3acf6c7dab07dd79 introduced a behaviour change where dwarf_finish_line was not called anymore when ending a sequence of machine instructions. This patch restores the original behaviour. gdb/ChangeLog: * dwarf2read.c (dwarf_record_line): Call dwarf_record_line if end_sequence is true.
2015-06-10Code cleanup: Use explicit NULL comparisonJan Kratochvil2-1/+7
gdb/ChangeLog 2015-06-10 Jan Kratochvil <jan.kratochvil@redhat.com> Code cleanup. * solib-target.c (library_list_start_list): Use explicit NULL comparison.
2015-06-10Fix gdbserver <library-list> and its #FIXED version="1.0"Jan Kratochvil4-7/+25
While reimplementing <library-list/> I found from expat-2.0.1-11.fc15.x86_64: warning: while parsing target library list (at line 1): Required attribute "version" of <library-list-svr4> not specified I believe the same bug has to apply for existing FSF gdbserver but I do not have any <library-list/> platform to test it (I did not try to build MinGW). features/library-list.dtd: <!ATTLIST library-list version CDATA #FIXED "1.0"> http://www.xml.com/pub/a/98/10/guide0.html?page=3 says: In this case, the attribute is not required, but if it occurs, it must have the specified value. Which would suggest gdbserver is right but solib-target.c is wrong. One could also make gdbserver explicit for the version (if those 14 bytes are not of a concern). gdb/ChangeLog 2015-06-10 Jan Kratochvil <jan.kratochvil@redhat.com> * solib-target.c (library_list_start_list): Do not dereference variable version in its initialization. Make the VERSION check handle NULL. (library_list_attributes): Make "version" GDB_XML_AF_OPTIONAL. gdb/gdbserver/ChangeLog 2015-06-10 Jan Kratochvil <jan.kratochvil@redhat.com> * server.c (handle_qxfer_libraries): Set `version' attribute for <library-list>.
2015-06-10Announce new container-awareness features for GNU/Linux systemsGary Benson2-0/+13
This commit announces the newly added ability to directly access executable and shared library files when attaching to processes running in containers on GNU/Linux systems. gdb/ChangeLog: * NEWS: Announce support for direct access of executable and shared library files when attaching to inferiors in containers on GNU/Linux systems.
2015-06-10Implement vFile:setfs in gdbserverGary Benson6-4/+117
This commit implements the "vFile:setfs" packet in gdbserver. gdb/gdbserver/ChangeLog: * target.h (struct target_ops) <multifs_open>: New field. <multifs_unlink>: Likewise. <multifs_readlink>: Likewise. * linux-low.c (nat/linux-namespaces.h): New include. (linux_target_ops): Initialize the_target->multifs_open, the_target->multifs_unlink and the_target->multifs_readlink. * hostio.h (hostio_handle_new_gdb_connection): New declaration. * hostio.c (hostio_fs_pid): New static variable. (hostio_handle_new_gdb_connection): New function. (handle_setfs): Likewise. (handle_open): Use the_target->multifs_open as appropriate. (handle_unlink): Use the_target->multifs_unlink as appropriate. (handle_readlink): Use the_target->multifs_readlink as appropriate. (handle_vFile): Handle vFile:setfs packets. * server.c (handle_query): Call hostio_handle_new_gdb_connection after target_handle_new_gdb_connection.
2015-06-10Implement multiple-filesystem support for remote targetsGary Benson5-0/+100
This commit allows GDB to access executables and shared libraries on remote targets where the remote stub does not share a common filesystem with the inferior(s). A new packet "vFile:setfs" is added to the remote protocol and the three remote hostio functions with filename arguments are modified to send "vFile:setfs" packets as necessary. gdb/ChangeLog: * remote.c (struct remote_state) <fs_pid>: New field. (new_remote_state): Initialize the above. (PACKET_vFile_setfs): New enum value. (remote_hostio_set_filesystem): New function. (remote_hostio_open): Call the above. (remote_hostio_unlink): Likewise. (remote_hostio_readlink): Likewise. (_initialize_remote): Register new "set/show remote hostio-setfs-packet" command. * NEWS: Announce new vFile:setfs packet. gdb/doc/ChangeLog: * gdb.texinfo (Remote Configuration): Document the "set/show remote hostio-setfs-packet" command. (Host I/O Packets): Document the vFile:setfs packet.
2015-06-10Implement mount namespace support for native Linux targetsGary Benson5-0/+143
This commit allows GDB to access executables and shared libraries on native Linux targets where GDB and the inferior have different mount namespaces. gdb/ChangeLog: * linux-nat.c (nat/linux-namespaces.h): New include. (fileio.h): Likewise. (linux_nat_filesystem_is_local): New function. (linux_nat_fileio_pid_of): Likewise. (linux_nat_fileio_open): Likewise. (linux_nat_fileio_readlink): Likewise. (linux_nat_fileio_unlink): Likewise. (linux_nat_add_target): Initialize to_filesystem_is_local, to_fileio_open, to_fileio_readlink and to_fileio_unlink. (_initialize_linux_nat): New "set/show debug linux-namespaces" commands. * NEWS: Mention new "set/show debug linux-namespaces" commands. gdb/doc/ChangeLog: * gdb.texinfo (Debugging Output): Document the "set/show debug linux-namespaces" command.
2015-06-10Add "inferior" argument to some target_fileio functionsGary Benson7-88/+179
This commit adds a new argument to all target_fileio functions with filename arguments to allow the desired inferior to be specified. This allows GDB to support systems where processes do not necessarily share a common filesystem. gdb/ChangeLog: * target.h (struct inferior): New forward declaration. (struct target_ops) <to_filesystem_is_local>: Update comment. (struct target_ops) <to_fileio_open>: New argument inf. Update comment. All implementations updated. (struct target_ops) <to_fileio_unlink>: Likewise. (struct target_ops) <to_fileio_readlink>: Likewise. (target_filesystem_is_local): Update comment. (target_fileio_open): New argument inf. Update comment. (target_fileio_unlink): Likewise. (target_fileio_readlink): Likewise. (target_fileio_read_alloc): Likewise. (target_fileio_read_stralloc): Likewise. * target.c (target_fileio_open): New argument inf. Pass inf to implementation. Update debug printing. (target_fileio_unlink): Likewise. (target_fileio_readlink): Likewise. (target_fileio_read_alloc_1): New argument inf. Pass inf to target_fileio_open. (target_fileio_read_alloc): New argument inf. Pass inf to target_fileio_read_alloc_1. (target_fileio_read_stralloc): Likewise. * gdb_bfd.c (inferior.h): New include. (gdb_bfd_iovec_fileio_open): Replace unused "open_closure" argument with new argument "inferior". Pass inferior to target_fileio_open. (gdb_bfd_open): Supply inferior argument to gdb_bfd_iovec_fileio_open. * linux-tdep.c (linux_info_proc): Supply inf argument to relevant target_fileio calls. (linux_find_memory_regions_full): Likewise. (linux_fill_prpsinfo): Likewise. * remote.c (remote_filesystem_is_local): Supply inf argument to remote_hostio_open. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_file_delete): Supply inf argument to remote_hostio_unlink.
2015-06-10Comment and whitespace changesGary Benson4-61/+63
Comments on the various implementations of target fileio functions duplicate information documented in target.h. This commit replaces the duplicated documentation with breadcrumbs, and inserts blank lines to separate comments from the functions they describe where necessary. gdb/ChangeLog: * inf-child.c (inf_child_fileio_open): Replace comment. (inf_child_fileio_pwrite): Likewise. (inf_child_fileio_pread): Likewise. (inf_child_fileio_fstat): Insert blank line before comment. (inf_child_fileio_close): Replace comment. (inf_child_fileio_unlink): Likewise. (inf_child_fileio_readlink): Likewise. * remote.c (remote_hostio_open): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_pwrite): Likewise. (remote_hostio_close): Likewise. (remote_hostio_unlink): Likewise. (remote_hostio_readlink): Likewise. (remote_hostio_fstat): Likewise. (remote_filesystem_is_local): Likewise. * target.c (target_fileio_open): Likewise. (target_fileio_pwrite): Likewise. (target_fileio_pread): Likewise. (target_fileio_fstat): Insert blank line before comment. (target_fileio_close): Replace comment. (target_fileio_unlink): Likewise. (target_fileio_readlink): Likewise. (target_fileio_read_alloc): Likewise. (target_fileio_read_stralloc): Likewise.
2015-06-10Remove linux_proc_pid_get_nsGary Benson4-35/+10
This commit removes linux_proc_pid_get_ns, and updates its only caller to use linux_ns_same instead. gdb/ChangeLog: * linux-thread-db.c (nat/linux-namespaces.h): New include. (check_pid_namespace_match): Use linux_ns_same rather than linux_proc_pid_get_ns to spot PID namespace mismatches. * nat/linux-procfs.h (linux_proc_pid_get_ns): Remove. * nat/linux-procfs.c (linux_proc_pid_get_ns): Likewise.
2015-06-10Introduce nat/linux-namespaces.[ch]Gary Benson31-26/+1205
This commit introduces new shared files nat/linux-namespaces.[ch] containing code to support Linux namespaces that will be used by both GDB and gdbserver. gdb/ChangeLog: * configure.ac (AC_CHECK_FUNCS): Add setns. * config.in: Regenerate. * configure: Likewise. * nat/linux-namespaces.h: New file. * nat/linux-namespaces.c: Likewise. * Makefile.in (HFILES_NO_SRCDIR): Add nat/linux-namespaces.h. (linux-namespaces.o): New rule. * config/aarch64/linux.mh (NATDEPFILES): Add linux-namespaces.o. * config/alpha/alpha-linux.mh (NATDEPFILES): Likewise. * config/arm/linux.mh (NATDEPFILES): Likewise. * config/i386/linux.mh (NATDEPFILES): Likewise. * config/i386/linux64.mh (NATDEPFILES): Likewise. * config/ia64/linux.mh (NATDEPFILES): Likewise. * config/m32r/linux.mh (NATDEPFILES): Likewise. * config/m68k/linux.mh (NATDEPFILES): Likewise. * config/mips/linux.mh (NATDEPFILES): Likewise. * config/pa/linux.mh (NATDEPFILES): Likewise. * config/powerpc/linux.mh (NATDEPFILES): Likewise. * config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise. * config/powerpc/spu-linux.mh (NATDEPFILES): Likewise. * config/s390/linux.mh (NATDEPFILES): Likewise. * config/sparc/linux.mh (NATDEPFILES): Likewise. * config/sparc/linux64.mh (NATDEPFILES): Likewise. * config/tilegx/linux.mh (NATDEPFILES): Likewise. * config/xtensa/linux.mh (NATDEPFILES): Likewise. gdb/gdbserver/ChangeLog: * configure.ac (AC_CHECK_FUNCS): Add setns. * config.in: Regenerate. * configure: Likewise. * Makefile.in (SFILES): Add nat/linux-namespaces.c. (linux-namespaces.o): New rule. * configure.srv (srv_linux_obj): Add linux-namespaces.o.
2015-06-10Move make_cleanup_close to common codeGary Benson5-18/+35
This commit moves the function make_cleanup_close from gdb/utils.[ch] to gdb/common/filestuff.[ch] to make it usable from common code. gdb/ChangeLog: * utils.h (make_cleanup_close): Moved to common/filestuff.h. * utils.c (do_close_cleanup): Moved to common/filestuff.c. (make_cleanup_close): Likewise. * common/filestuff.h (make_cleanup_close): Moved from utils.h. * common/filestuff.c (do_close_cleanup): Moved from utils.c. (make_cleanup_close): Likewise.
2015-06-10windows-nat: Also ignore ERROR_INVALID_HANDLE from SuspendThread()Jon Turney2-2/+10
Discussed somewhat in the thread at https://cygwin.com/ml/gdb-patches/2013-06/msg00680.html This is pretty straightforward to demonstrate on Cygwin currently: $ cat main.c int main() { return 0; } $ gcc -g -O0 main.c -o main $ ./gdb ./main [...] (gdb) r Starting program: /wip/binutils-gdb/build.x86_64/gdb/main warning: SuspendThread (tid=0x1cf0) failed. (winerr 6) [Inferior 1 (process 976) exited normally] with this patch applied: $ ./gdb ./main [...] (gdb) r Starting program: /wip/binutils-gdb/build.x86_64/gdb/main [Inferior 1 (process 4852) exited normally] gdb/ChangeLog: 2015-06-03 Jon Turney <jon.turney@dronecode.org.uk> * windows-nat.c (thread_rec): Also ignore ERROR_INVALID_HANDLE from SuspendThread(). Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2015-06-10windows-nat: Trim a trailing '\n' from OutputDebugString before echoing itJon Turney2-1/+12
For cosmetic purposes, trim a trailing '\n' from OutputDebugString before echoing it, as warning() will add a '\n', anyhow. gdb/ChangeLog: 2015-06-03 Jon Turney <jon.turney@dronecode.org.uk> * windows-nat.c (handle_output_debug_string): Trim trailing '\n' from OutputDebugString. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2015-06-10Missing Changelogs for last commitsWalfred Tedeschi3-0/+54
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>
2015-06-10Add support for bound table in the Intel MPX context.Walfred Tedeschi5-1/+465
Intel(R) Memory protection bound information are located in register to be tested using the MPX new instructions. Since the number of bound registers are limited a table is used to provide storage for bounds during run-time. In order to investigate the contents of the MPX bound table two new commands are added to GDB. "show mpx bound" and "set mpx bound" are used to display and set values on the MPX bound table. 2015-04-20 Walfred Tedeschi <walfred.tedeschi@intel.com> Mircea Gherzan <mircea.gherzan@intel.com> * i386-tdep.c (MPX_BASE_MASK, MPX_BD_MASK, MPX_BT_MASK, MPX_BD_MASK_32, MPX_BT_MASK_32): New macros. (i386_mpx_set_bounds): New function that implements the command "set-mpx-bound". (i386_mpx_enabled) Helper function to test MPX availability. (i386_mpx_bd_base) Helper function to calculate the base directory address. (i386_mpx_get_bt_entry) Helper function to access a bound table entry. (i386_mpx_print_bounds) Effectively display bound information. (_initialize_i386_tdep): Qdd new commands to commands "set mpx" and "show mpx". (_initialize_i386_tdep): Add "bound" to the commands "show mpx" and "set mpx" commands. (mpx_set_cmdlist and mpx_show_cmdlist): list for the new prefixed "set mpx" and "show mpx" commands. * NEWS: List new commands for MPX support. testsuite: * gdb.arch/i386-mpx-map.c: New file. * gdb.arch/i386-mpx-map.exp: New File. doc: * gdb.texinfo (i386): Add documentation about "show mpx bound" and "set mpx bound".
2015-06-10Obvious indentation fixes on test sample and test file for MPX registers.Walfred Tedeschi2-10/+10
2015-06-08 Walfred Tedeschi <walfred.tedeschi@intel.com> gdb/testsuite: * gdb.arch/i386-mpx.c (have_mpx): Indentation fixed. * gdb.arch/i386-mpx.exp: Indentation fixed.
2015-06-10Improve test for processor feature om MPX registers test.Walfred Tedeschi2-13/+19
Skips the MPX register test in case target is not Intel. Improves the test for MPX feature making MPX and AVX512 tests more similar in terms of initialization. Indentation was improved on sample file and final return added to have_mpx. On test file identation was improved and gdb_send was exchanged by gdb_test_multiple. 2015-06-08 Walfred Tedeschi <walfred.tedeschi@intel.com> gdb/testsuite * gdb.arch/i386-mpx.c: Added final return to the have_mpx function and improved indentation. * gdb.arch/i386-mpx.exp: Exchanging gdb_send and gdb_expect for gdb_test_multiple. Added additional tests to skip the test.
2015-06-10Fix MPX and AVX512 tests for path changes.Walfred Tedeschi4-4/+4
Changes on the path for i386-cpuid.h file lead to failure in compiling tests for AVX512 and MPX. 2015-06-08 Walfred Tedeschi <walfred.tedeschi@intel.com> gdb/testsuite * gdb.arch/i386-avx512.c: Change path in include file. * gdb.arch/i386-avx512.exp: Change include dir path compilation flag. * gdb.arch/i386-mpx.c: Change path in include file. * gdb.arch/i386-mpx.exp: Change include dir path compilation flag.
2015-06-09Don't assume File-I/O mode bits match the host's formatGary Benson6-7/+75
inf_child_fileio_open and its gdbserver equivalent both assume that the mode_t bits defined in gdb/fileio.h are the same as those used by the open system call, but there is no mechanism to ensure this is the case. This commit adds a conversion function to handle systems where the File-I/O definitions do not align with the host's. gdb/ChangeLog: * common/fileio.h (fileio_to_host_mode): New declaration. * common/fileio.c (fileio_to_host_mode): New Function. * inf-child.c (inf_child_fileio_open): Process mode argument with fileio_to_host_mode. gdb/gdbserver/ChangeLog: * hostio.c (handle_open): Process mode argument with fileio_to_host_mode.
2015-06-09Fix preprocessor conditionalGary Benson2-1/+6
This commit fixes a typo in common/fileio.c where S_IWGRP was misspelled as S_IWRGRP in a preprocessor conditional, causing Host-I/O "vFile:fstat:" and File-I/O "Fstat" and "Ffstat" responses to always indicate files were not group-writable regardless of their actual status.
2015-06-05Move vgdb special case into remote_filesystem_is_localGary Benson3-24/+59
Valgrind GDB (vgdb) presents itself as a remote target but works on the local filesystem. gdb_bfd_open contained a special case to make vgdb work with "target:" sysroots, but the implementation meant that GDB would fall back to the local filesystem if *any* to_fileio_open method failed with ENOSYS for *any* reason. This commit moves the vgdb special case to remote_filesystem_is_local to allow the fallback to be restricted only to the specific case that remote file transfer is unsupported. This commit also adds a warning which is displayed the first time the fallback is used. gdb/ChangeLog: * gdb_bfd.c (gdb_bfd_open): Move vgdb special case to... * remote.c (remote_filesystem_is_local): ...here.
2015-06-04compile-print.exp: xfail->kfail for '@' GDB array operatorJan Kratochvil2-2/+7
Patch implementing '@' GDB array operator in GCC has been rejected: https://gcc.gnu.org/ml/gcc-patches/2015-06/msg00414.html and so there is now a GDB tracker to implement it just in GDB: https://sourceware.org/bugzilla/show_bug.cgi?id=18489 gdb/testsuite/ChangeLog 2015-06-04 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.compile/compile-print.exp (compile print *vararray@3) (compile print *vararrayp@3): Change xfail to kfail compile/18489.
2015-06-04Regenerate gdbarch.c to sync with gdbarch.shYao Qi2-3/+7
When I do something else, I find that gdbarch.c isn't sync'ed with gdbarch.sh. This patch just move some statements on stack_frame_destroyed_p some lines below. gdb: 2015-06-04 Yao Qi <yao.qi@linaro.org> * gdbarch.c: Regenerate it.
2015-06-03compile: Use also inferior munmapJan Kratochvil12-3/+185
Currently inferior memory is allocated by inferior mmap() but it is never deallocated; despite the injected objfile incl. its symbols is freed. This was intentional so that one can do for example: inferior: char *str = "foo"; GDB: (gdb) compile code str = "bar"; I believe later patches will be needed to introduce full control over keeping vs. discarding the injected module as being discussed in: compile: objfiles lifetime UI https://sourceware.org/ml/gdb/2015-04/msg00051.html Message-ID: <20150429135735.GA16974@host1.jankratochvil.net> https://sourceware.org/ml/gdb/2015-05/msg00007.html As decided by Phil it is better not to leak inferior pages as users can workaround the issue above for example by: (gdb) compile code str = strdup ("bar"); I have checked that in fact gdb/doc/ (written by Phil) already expects the injected code will be unmapped so that does not need to be changed: compile code int ff = 5; p = &ff; In this example, @code{p} would point to @code{ff} when the @code{compile} command is executing the source code provided to it. However, as variables in the (example) program persist with their assigned values, the variable @code{p} would point to an invalid location when the command exists. gdb/ChangeLog 2015-04-28 Jan Kratochvil <jan.kratochvil@redhat.com> * arch-utils.c (default_infcall_munmap): New. * arch-utils.h (default_infcall_munmap): New declaration. * compile/compile-object-load.c (struct munmap_list, munmap_list_add) (munmap_list_free, munmap_listp_free_cleanup): New. (struct setup_sections_data): Add field munmap_list_headp. (setup_sections): Call munmap_list_add. (compile_object_load): New variable munmap_list_head, initialize setup_sections_data.munmap_list_headp, return munmap_list_head. * compile/compile-object-load.h (struct munmap_list): New declaration. (struct compile_module): Add field munmap_list_head. (munmap_list_free): New declaration. * compile/compile-object-run.c (struct do_module_cleanup): Add field munmap_list_head. (do_module_cleanup): Call munmap_list_free. (compile_object_run): Pass munmap_list_head to do_module_cleanup. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (infcall_munmap): New. * linux-tdep.c (linux_infcall_munmap): New. (linux_init_abi): Install it. gdb/testsuite/ChangeLog 2015-04-28 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.compile/compile.exp (keep jit in memory): Rename to ... (do not keep jit in memory): ... this. (expect 5): Change it to ... (expect no 5): ... this.
2015-06-02Fix =thread-exited not showing up when detaching (PR 15564)Simon Marchi4-1/+46
I sent a patch in 2013 for this (incorrectly named =thread-created): https://cygwin.com/ml/gdb-patches/2013-06/msg00129.html Tom Tromey was ok with the change, but suggested to add a test as well. Then I forgot about this patch until today. So here it is again, with the corresponding test. The problem is that the =thread-exited event does not appear when detaching from a local process. It does appear with remote though. It's not a really big deal, but I'd like it to be consistent. Tested with local and remote Linux on my Ubuntu 14.04. gdb/ChangeLog: PR gdb/15564 * inferior.c (detach_inferior): Call exit_inferior_1 with silent = 0. gdb/testsuite/ChangeLog: PR gdb/15564 * gdb.mi/mi-detach.exp: New file.
2015-06-02Include linux-nat.h in i386-linux-nat.cYao Qi2-0/+5
This commit fixes a build failure on i386-linux. gdb: 2015-06-02 Yao Qi <yao.qi@linaro.org> * i386-linux-nat.c: Include linux-nat.h.
2015-06-01PR symtab/18392Jan Kratochvil7-4/+703
Initially there is some chain (let's say the longest one but that doe snot matter). Consequently its elements from the middle are being removed and there remains only some few unambiguous top and bottom ones. The original idea why the comparison should be sharp ("<") was that if there are multiple chains like (0xaddr show jmp instruction address): main(0x100) -> a(0x200) -> d(0x400) main(0x100) -> a(0x200) -> c(0x300) -> d(0x400) then - such situation cannot exist - if two jmp instructions in "a" have the same address they must also jump to the same address (*). (*) jump to a computed address would be never considered for the DWARF tail-call records. So there could be: main(0x100) -> a(0x200) -> d(0x400) main(0x100) -> a(0x270) -> c(0x300) -> d(0x400) But then "a" frame itself is ambiguous and it must not be displayed. I did not realize that there can be self-tail-call: main(0x100) -> a(0x200) -> d(0x400) main(0x100) -> a(0x280) -> a(0x200) -> d(0x400) which intersects to: main(0x100) -> <???>? -> a(0x200) -> d(0x400) And so if the first chain was chosen the main(0x100) -> a(0x200) -> d(0x400) then the final intersection has callers+callees==length. > for example, if CALLERS is 3 and > CALLEES is 2, what does the chain look like? main(0x100) -> x(0x150) -> y(0x200) -> <???>? -> a(0x200) -> d(0x400) And if LENGTH is 7 then: call_site[0] = main(0x100) call_site[1] = x(0x150) call_site[2] = y(0x200) call_site[3] = garbage call_site[4] = garbage call_site[5] = a(0x200) call_site[6] = d(0x400) gdb/ChangeLog 2015-06-01 Andreas Schwab <schwab@linux-m68k.org> Jan Kratochvil <jan.kratochvil@redhat.com> PR symtab/18392 * dwarf2-frame-tailcall.c (pretended_chain_levels): Correct assertion. * dwarf2loc.c (chain_candidate): Likewise. gdb/testsuite/ChangeLog 2015-06-01 Jan Kratochvil <jan.kratochvil@redhat.com> PR symtab/18392 * gdb.arch/amd64-tailcall-self.S: New file. * gdb.arch/amd64-tailcall-self.c: New file. * gdb.arch/amd64-tailcall-self.exp: New file.
2015-06-01Fetch and store VFP registers by PTRACE_{G,S}ETREGSETYao Qi2-3/+37
This patch is to use PTRACE_{G,S}ETREGSET to fetch and store VFP registers if kernel supports. gdb: 2015-06-01 Yao Qi <yao.qi@linaro.org> * arm-linux-nat.c (fetch_vfp_regs): Use PTRACE_GETREGSET. (store_vfp_regs): Use PTRACE_SETREGSET.
2015-06-01Fetch and store FP registers by PTRACE_{G,S}ETREGSETYao Qi2-10/+84
If kernel supports PTRACE_GETREGSET, GDB uses PTRACE_{G,S}ETREGSET to fetch and store FP registers. gdb: 2015-06-01 Yao Qi <yao.qi@linaro.org> * arm-linux-nat.c (fetch_fpregister): Use PTRACE_GETREGSET. (fetch_fpregs): Likewise. * arm-linux-nat.c (store_fpregister): Use PTRACE_SETREGSET. (store_fpregs): Likewise.
2015-06-01Fetch and store GP registers by PTRACE_{G,S}ETREGSETYao Qi2-10/+82
If kernel supports PTRACE_GETREGSET, GDB uses PTRACE_{G,S}ETREGSET to fetch and store GP registers. gdb: 2015-06-01 Yao Qi <yao.qi@linaro.org> * arm-linux-nat.c (fetch_register): Use PTRACE_GETREGSET. (fetch_regs): Likewise. (store_regs): Use PTRACE_SETREGSET. (store_register): Likewise.
2015-06-01Check whether kernel supports PTRACE_GETREGSETYao Qi2-0/+21
gdb: 2015-06-01 Yao Qi <yao.qi@linaro.org> * arm-linux-nat.c (arm_linux_read_description): Check whether kernel supports PTRACE_GETREGSET.
2015-06-01Move have_ptrace_getregset to linux-nat.cYao Qi5-4/+14
I'll let arm-linux-nat.c to use PTRACE_GETREGSET if kernel supports, so this patch is to move have_ptrace_getregset from x86-linux-nat.c to linux-nat.c. gdb: 2015-06-01 Yao Qi <yao.qi@linaro.org> * x86-linux-nat.c (have_ptrace_getregset): Move it to ... * linux-nat.c: ... here. * x86-linux-nat.h (have_ptrace_getregset): Move the declaration to ... * linux-nat.h: ... here.
2015-06-01Move PTRACE_GETREGSET and PTRACE_SETREGSET to nat/linux-ptrace.hYao Qi10-33/+27
Macros PTRACE_GETREGSET and PTRACE_SETREGSET are defined locally in some places in GDB and GDBserver. This patch is to move them to nat/linux-ptrace.h to avoid duplication. gdb: 2015-06-01 Yao Qi <yao.qi@linaro.org> * amd64-linux-nat.c: Include "nat/linux-ptrace.h". * i386-linux-nat.c: Likewise. * nat/linux-ptrace.h (PTRACE_GETREGSET, PTRACE_SETREGSET): Define. * s390-linux-nat.c: Include "nat/linux-ptrace.h". (PTRACE_GETREGSET, PTRACE_SETREGSET): Remove. * x86-linux-nat.c: Include "nat/linux-ptrace.h". * x86-linux-nat.h (PTRACE_GETREGSET, PTRACE_SETREGSET): Remove. gdb/gdbserver: 2015-06-01 Yao Qi <yao.qi@linaro.org> * linux-s390-low.c (PTRACE_GETREGSET, PTRACE_SETREGSET): Remove. * linux-x86-low.c: Likewise.
2015-05-30Unbreak DJGPP build of GDB.Eli Zaretskii2-2/+10
gdb/ * go32-nat.c (go32_xfer_memory): Fix the return value to be compatible to what read_child and write_child return. This unbreaks that DJGPP build of GDB which was broken since v7.7.
2015-05-29Add myself to the Write After Approval list.Martin Galvan2-0/+5
2015-05-29PR gdb/18464: Do not crash on unrecognized GNU .note.ABI-tag valuesRoland McGrath2-45/+49
Diagnosis of unexpected input (in this case, in an executable file) should not crash as if it were a bug in GDB. gdb/ PR gdb/18464 * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Use warning rather than internal_error for an unrecognized value.
2015-05-29xtensa: fix access to the last pseudo registerMax Filippov2-8/+6
Currently access to the last pseudo register is aliased to a1. This is done by little snippets in the beginning of xtensa_pseudo_register_read and xtensa_pseudo_register_write that used to do such aliasing for FP register since bdb4c075a29dd086f0868b394b488b1c94666be6, but then FP_ALIAS was expanded into gdbarch_num_regs (current_gdbarch) + gdbarch_num_pseudo_regs (current_gdbarch) (one register past the last pseudo register) in 304fe2552d6e0821e8fdb7575f8e7ba6607a076d, which then was changed to the last pseudo register in 94a0e877111421d300d26b858bd3a0a27078d1e8. Drop these snippets. 2015-05-29 Max Filippov <jcmvbkbc@gmail.com> gdb/ * xtensa-tdep.c (xtensa_pseudo_register_read) (xtensa_pseudo_register_write): Don't alias last pseudo register to a1.
2015-05-28Disable exec-dependent follow vfork tests for remoteDon Breazeal2-12/+22
The native-extended-gdbserver target now supports fork events and follow fork, but it does not yet support exec events. Some of the tests in gdb.base/foll-vfork.exp depend on exec events. This patch disables those tests for remote targets. We can re-enable these once the exec event support goes in. gdb/testsuite/ * gdb.base/foll-vfork.exp (main): Disable exec-dependent tests for remote targets by checking is_target_gdbserver.
2015-05-28Initialize last_resume_kind for remote fork childDon Breazeal2-1/+10
This patch fixes some intermittent test failures in gdb.base/foll-vfork.exp where a vfork child would be (incorrectly) resumed when handling the vfork event. In this case the result was a subsequent event reported to the client side as a SIGTRAP delivered to the as-yet-unknown child thread. The new thread was resumed (incorrectly) in linux-low.c when resume_stopped_resumed_lwps was called from linux_wait_for_event_filtered after the vfork event had been handled in handle_extended_wait. Gdbserver/linux-low.c's add_thread function creates threads with last_resume_kind == resume_continue by default. This field is used by resume_stopped_resumed_lwps to decide whether to perform the resume: static void resume_stopped_resumed_lwps (struct inferior_list_entry *entry) { struct thread_info *thread = (struct thread_info *) entry; struct lwp_info *lp = get_thread_lwp (thread); if (lp->stopped && !lp->status_pending_p && thread->last_resume_kind != resume_stop && thread->last_status.kind == TARGET_WAITKIND_IGNORE) { So the fix is to make sure to set thread->last_resume_kind to resume_stop. Here we do that for new fork children in gdbserver/linux-low.c:handle_extended_wait. In addition, it seemed prudent to initialize lwp_info.status_pending_p for the new fork child. I also rearranged the initialization code so that all of the lwp_info initialization was together, rather than intermixed with thread_info and process_info initialization. Tested native, native-gdbserver, native-extended-gdbserver on x86_64 GNU/Linux. gdb/gdbserver/ * linux-low.c (handle_extended_wait): Initialize thread_info.last_resume_kind for new fork children.
2015-05-28Make remote follow fork 'Detaching' message match nativeDon Breazeal2-2/+14
This patch fixes a couple of failures in gdb.base/foll-vfork.exp for extended-remote targets. The failures were the result of the verbose/debug "Detaching..." messages in infrun.c:follow_fork_inferior not matching what was expected in the extended-remote case. The path modifies the ptids used in the messages to ensure that they print "process nnn" instead of (possibly) "Thread nnn.nnn". The detach is a process-wide operation, so we need to use a process- style ptid regardless of what type of ptid target_pid_to_str returns. Tested on x86_64 GNU/Linux, native, remote, extended-remote. gdb/ * infrun.c (follow_fork_inferior): Ensure the use of process-style ptids (pid,0,0) in verbose/debug "Detaching" messages.
2015-05-28* dwarf2read.c (record_line_ftype): Remove, duplicate.Doug Evans2-5/+4
gdb/Changelog: * dwarf2read.c (record_line_ftype): Remove, duplicate.
2015-05-28Remove global variable arm_linux_has_wmmx_registers in arm-linux-nat.cYao Qi4-12/+23
This patch is to remove the global variable arm_linux_has_wmmx_registers in arm-linux-nat.c, and add a new field have_wmmx_registers in 'struct gdbarch_tdep'. gdb: 2015-05-28 Yao Qi <yao.qi@linaro.org> * arm-linux-nat.c (arm_linux_has_wmmx_registers): Remove. (arm_linux_fetch_inferior_registers): Use tdep->have_wmmx_registers instead of arm_linux_has_wmmx_registers. (arm_linux_store_inferior_registers): Likewise. (arm_linux_read_description): Don't set arm_linux_has_wmmx_registers. * arm-tdep.c (arm_gdbarch_init): Set tdep->have_wmmx_registers according target descriptions. * arm-tdep.h (struct gdbarch_tdep) <have_wmmx_registers>: New field.
2015-05-28Remove global variable arm_linux_vfp_register_count in arm-linux-nat.cYao Qi5-30/+48
This patch is to remove the global variable arm_linux_vfp_register_count from arm-linux-nat.c. This global variable is set when native gdb looks for the right target description according HWCAP. However, 'struct gdbarch_tdep' has already had a field have_vfp_registers, which is a boolean about whether target has vfp registers or not. This patch converts this boolean field to a numeric counter to replace global variable arm_linux_vfp_register_count. gdb: 2015-05-28 Yao Qi <yao.qi@linaro.org> * arm-linux-nat.c (arm_linux_vfp_register_count): Remove. (fetch_vfp_regs): Use vfp_register_count from gdbarch_tdep instead of arm_linux_vfp_register_count. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. (arm_linux_read_description): Don't set arm_linux_vfp_register_count. * arm-linux-tdep.c (arm_linux_iterate_over_regset_sections): Adjust. * arm-tdep.c (arm_gdbarch_init): Add assert on vfp_register_count. * arm-tdep.h (struct gdbarch_tdep) <have_vfp_registers>: Rename field to vfp_register_count. All users updated.
2015-05-28Do arm_abi detection for ELFOSABI_GNU binariesKyle Huey2-1/+6
On ARM systems, gdb must determine which style of breakpoint to use (see the comments at the beginning of gdb/arm-linux-tdep.c). In arm_gdbarch_init we only attempt to extract the eabi version from the ELF binary if it is a ELFOSABI_NONE binary. If the binary is ELFOSABI_GNU instead, we end up defaulting to the old style OABI syscall breakpoint instruction. On a Linux kernel built without CONFIG_OABI_COMPAT, this triggers a SIGILL in ld when attempting to execute any ELFOSABI_GNU program. (e.g. https://github.com/raspberrypi/linux/issues/766) gdb/ 2015-05-28 Kyle Huey <me@kylehuey.com> (tiny patch) * gdb/arm-tdep.c (arm_gdbarch_init): Perform arm_abi detection on ELFOSABI_GNU binaries.