aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2013-12-23Reorganize extension language auto-loading docs.Doug Evans2-246/+289
* gdb.texinfo (Auto-loading): Move menu up. Move discussion of auto-loaded objfile scripts and .debug_gdb_scripts section to their corresponding section in Extending GDB. (Extending GDB): Move menu up. New menu item "Auto-loading extensions". (Sequences): New menu item "Auto-loading sequences". (Auto-loading sequences): New node. (Python): Rename section from Scripting GDB to Extending GDB. (Python Auto-loading): Update xref, refer to "Auto-loading extensions". Move docs on ways to auto-load extensions to ... (Auto-loading extensions): ... here. New node.
2013-12-232013-12-17 Sterling Augustine <saugustine@google.com>Sterling Augustine2-1/+6
* linespec.c (add_sal_to_sals): Use "<unknown>" when a symbol isn't found.
2013-12-23Some cleanups on stap-probe.cSergio Durigan Junior2-39/+54
This patch does some basic cleanups on the SystemTap SDT probes API. It removes spurious newlines, brackets, reindents some code, and do explicit checks for NULL, NUL, and 0 where applicable. 2013-12-23 Sergio Durigan JUnior <sergiodj@redhat.com> * stap-probe.c (struct stap_probe) <args_parsed>: Add comment. (stap_is_generic_prefix): Delete extra brackets. Reindent. (stap_parse_register_operand): Remove spurious newlines. Simplify code to parse special token. (stap_parse_argument_conditionally): Add gdb_assert. (stap_parse_argument_1): Likewise. Explicitly check for NULL and NUL. (stap_parse_probe_arguments): Likewise. (handle_stap_probe): Likewise. Reindent code. (get_stap_base_address): Explicitly check for NULL. (stap_get_probes): Likewise. Reindent code. (stap_relocate): Explicitly check for 0. (stap_gen_info_probes_table_values): Likewise.
2013-12-23Move GDB/MI commands related to support-query to their own @node.Joel Brobecker2-141/+165
A number of commands provide the capability to query the debugger about support for various features, and one of them in particular (-list-features), is expected to grow as new features get added. -list-target-features should also grow a bit over time, but probably slower. These commands deserve their own section and @node. gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI): Add "GDB/MI Support Commands" entry in menu. (GDB/MI Variable Objects): Adjust reference to "-list-features" command, now in a new node. (GDB/MI Support Commands): New node, with its contents being extracted from the "GDB/MI Miscellaneous Commands" node. A small paragraph introducing the section is also added at the start. (GDB/MI Miscellaneous Commands): Delete the description of the -info-gdb-mi-command, -list-features and -list-target-features commands, now hosted in the "GDB/MI Support Commands" node.
2013-12-202013-12-20 Chung-Lin Tang <cltang@codesourcery.com>Chung-Lin Tang2-44/+12
* nios2-linux-tdep.c (nios2_linux_sigreturn_init): Remove. (nios2_linux_sigreturn_tramp_frame): Remove. (nios2_linux_rt_sigreturn_tramp_frame): Update rt_sigreturn syscall number. (nios2_linux_syscall_next_pc): Likewise. Remove sigreturn case. (nios2_linux_init_abi): Remove registration of nios2_linux_sigreturn_tramp_frame.
2013-12-19Mask out PREFIX_ADDR when adding prefix to opcodeH.J. Lu2-1/+8
PREFIX_ADDR isn't a prefix to opcode. This patch masks out PREFIX_ADDR when adding prefix to opcode. PR gdb/16305 * i386-tdep.c (i386_process_record): Mask out PREFIX_ADDR when adding prefix to opcode.
2013-12-19Properly decode MODRM byte for 64-bitH.J. Lu2-2/+8
64-bit mode doesn't use 16-bit address. We should always check SIB byte for address in 64-bit mode. PR gdb/16304 * i386-tdep.c (i386_record_lea_modrm_addr): Don't use 16-bit address in 64-bit mode.
2013-12-19Zero-extend address from 32-bit to 64-bit for ADDR32 prefixH.J. Lu2-0/+13
When there is ADDR32 prefix in 64-bit mode, we should zero-extend address from 32-bit to 64-bit. PR gdb/16304 * i386-tdep.c (i386_record_lea_modrm_addr): Zero-extend 32-bit address to 64-bit in 64-bit mode.
2013-12-19Add amd64_x32_linux_record_tdep and amd64_x32_sysH.J. Lu3-57/+807
X32 Linux system calls are diffferent from amd64 Linux system calls in system call numbers as well as parameter types/values. This patch adds amd64_x32_linux_record_tdep and amd64_x32_syscall for x32. PR gdb/16304 * amd64-linux-tdep.c (amd64_canonicalize_syscall): Handle x32 system calls. (amd64_x32_linux_record_tdep): New. (amd64_linux_syscall_record_common): New function. (amd64_linux_syscall_record): Call amd64_linux_syscall_record_common with amd64_linux_record_tdep. (amd64_x32_linux_syscall_record): Call amd64_linux_syscall_record_common with amd64_x32_linux_record_tdep. (amd64_linux_init_abi_common): Move amd64_linux_record_tdep initialization and tdep->i386_syscall_record setup to ... (amd64_linux_init_abi): Here. (amd64_x32_linux_init_abi): Initialize amd64_x32_linux_record_tdep. Set tdep->i386_syscall_record to amd64_x32_linux_syscall_record. * amd64-linux-tdep.h (amd64_x32_syscall): New enum.
2013-12-19Extend SystemTap SDT probe argument parserSergio Durigan Junior11-208/+513
This patch extends the current generic parser for SystemTap SDT probe arguments. It can be almost considered a cleanup, but the main point of it is actually to allow the generic parser to accept multiple prefixes and suffixes for the its operands (i.e., integers, register names, and register indirection). I have chosen to implement this as a list of const strings, and declare this list as "static" inside each target's method used to initialize gdbarch. This patch is actually a preparation for an upcoming patch for ARM, which implements the support for multiple integer prefixes (as defined by ARM's asm spec). And AArch64 will also need this, for the same reason. This patch was regtested on all architectures that it touches (i.e., i386, x86_64, ARM, PPC/PPC64, s390x and IA-64). No regressions were found. 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> * amd64-tdep.c (amd64_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix, stap_integer_suffix) (stap_register_prefix, stap_register_suffix) (stap_register_indirection_prefix) (stap_register_indirection_suffix): Declare as "const char *const *" instead of "const char *". Adjust printing function. Rename all of the variables to the plural. (pstring_list): New function. * i386-tdep.c (i386_elf_init_abi): Declare SystemTap SDT probe argument prefixes and suffixes. Initialize gdbarch with them. * ia64-linux-tdep.c (ia64_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * stap-probe.c (stap_is_generic_prefix): New function. (stap_is_register_prefix): Likewise. (stap_is_register_indirection_prefix): Likewise. (stap_is_integer_prefix): Likewise. (stap_generic_check_suffix): Likewise. (stap_check_integer_suffix): Likewise. (stap_check_register_suffix): Likewise. (stap_check_register_indirection_suffix): Likewise. (stap_parse_register_operand): Remove unecessary declarations for variables holding prefix and suffix information. Use the new functions listed above for checking for prefixes and suffixes. (stap_parse_single_operand): Likewise.
2013-12-19Fix PR breakpoints/16297: catch syscall with syscall 0Gabriel Krisman Bertazi5-9/+43
Code rationale ============== by: Gabriel Krisman Bertazi This is a fix for bug 16297. The problem occurs when the user attempts to catch any syscall 0 (such as syscall read on Linux/x86_64). GDB was not able to catch the syscall and was missing the breakpoint. Now, breakpoint_hit_catch_syscall returns immediately when it finds the correct syscall number, avoiding a following check for the end of the search vector, that returns a no hit if the syscall number was zero. Testcase rationale ================== by: Sergio Durigan Junior This testcase is a little difficult to write. By doing a quick inspection at the Linux source, one can see that, in many targets, the syscall number 0 is restart_syscall, which is forbidden to be called from userspace. Therefore, on many targets, there's just no way to test this safely. My decision was to take the simpler route and just adds the "read" syscall on the default test. Its number on x86_64 is zero, which is "good enough" since many people here do their tests on x86_64 anyway and it is a popular architecture. However, there was another little gotcha. When using "read" passing 0 as the third parameter (i.e., asking it to read 0 bytes), current libc implementations could choose not to effectively call the syscall. Therefore, the best solution was to create a temporary pipe, write 1 byte into it, and then read this byte from it. gdb/ChangeLog 2013-12-19 Gabriel Krisman Bertazi <gabriel@krisman.be> PR breakpoints/16297 * breakpoint.c (breakpoint_hit_catch_syscall): Return immediately when expected syscall is hit. gdb/testsuite/ChangeLog 2013-12-19 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/16297 * gdb.base/catch-syscall.c (read_syscall, pipe_syscall) (write_syscall): New variables. (main): Create a pipe, write 1 byte in it, and read 1 byte from it. * gdb.base/catch-syscall.exp (all_syscalls): Include "pipe, "write" and "read" syscalls. (fill_all_syscalls_numbers): Improve the way to obtain syscalls numbers.
2013-12-19don't allocate serial_opsTom Tromey5-182/+226
Now that struct serial_ops is const everywhere, we can easily turn the instances into globals. This patch implements this idea. On the one hand I think this is nicer since it makes a bit more data readonly and slightly reduces allocations. On the other hand it reduces readability somewhat. If the readability is a concern to anyone I was thinking I could write a macro that conditionally uses GCC's designated initializer extension. Tested by rebuilding on x86-64 Fedora 18, both natively and using the mingw cross tools. 2013-12-19 Tom Tromey <tromey@redhat.com> * ser-unix.c (hardwire_ops): New global. (_initialize_ser_hardwire): Use it. * ser-tcp.c (tcp_ops): New global. (_initialize_ser_tcp): Use it. * ser-pipe.c (pipe_ops): New global. (_initialize_ser_pipe): Use it. * ser-mingw.c (hardwire_ops, tty_ops, pipe_ops, tcp_ops): New globals. (_initialize_ser_windows): Use them.
2013-12-19make serial_ops constTom Tromey8-24/+36
I noticed that the serial_ops vtable is not const, but really it ought to be. This patch constifies it, removing the only mutable field in the process. Tested by rebuilding on x86-64 Fedora 18, both natively and using the mingw cross tools. 2013-12-19 Tom Tromey <tromey@redhat.com> * serial.c (serial_ops_p): New typedef. (serial_ops_list): Now a VEC. (serial_interface_lookup): Return const. Use VEC_iterate. (serial_add_interface): Make parameter const. (serial_open): Update. (serial_fdopen_ops): Make 'ops' const. (serial_pipe): Update. * ser-tcp.c (_initialize_ser_tcp): Update. * ser-pipe.c (_initialize_ser_pipe): Update. * ser-unix.c (_initialize_ser_hardwire): Update. * ser-mingw.c (_initialize_ser_windows): Update. * ser-go32.c (dos_ops): Now const. Update. * serial.h (struct serial) <ops>: Now const. (struct serial_ops) <next>: Remove. (serial_add_interface): Make parameter const.
2013-12-19fortran: enable ptype/whatis for modules.Keven Boell7-4/+62
Added new domain MODULE_DOMAIN for fortran modules to avoid issues with sharing namespaces (e.g. when a variable currently in scope has the same name as a module). (gdb) ptype modname old> No symbol "modname" in current context. new> type = module modname This fixes PR 15209 and also addresses the issue with sharing namespaces: https://sourceware.org/ml/gdb-patches/2013-02/msg00643.html 2013-11-19 Keven Boell <keven.boell@intel.com> Sanimir Agovic <sanimir.agovic@intel.com> * cp-namespace.c (cp_lookup_nested_symbol): Enable nested lookups for fortran modules. * dwarf2read.c (read_module): Add fortran module to the symbol table. (add_partial_symbol, add_partial_module): Add fortran module to the partial symbol table. (new_symbol_full): Create full symbol for fortran module. * f-exp.y (yylex): Add new module domain to be parsed. * symtab.h: New domain for fortran modules. testsuite/ * gdb.fortran/module.exp: Completion matches fortran module names as well. ptype/whatis on modules return a proper type. Add new check for having the correct scope.
2013-12-19fortran: enable ptype/whatis for user defined types.Keven Boell4-12/+102
(gdb) ptype type old> No symbol "type" in current context. new> type = Type type integer(kind=4) :: t_i End Type type 2013-11-19 Sanimir Agovic <sanimir.agovic@intel.com> Keven Boell <keven.boell@intel.com> * f-exp.y (yylex): Add domain array to enable lookup in multiple domains. Loop over lookup domains and try to find requested symbol. Add STRUCT_DOMAIN to lookup domains to be able to query for user defined types. testsuite/ * gdb.fortran/type.f90: New file. * gdb.fortran/whatis_type.f90: New file.
2013-12-18Improve and fix catch-syscall.expSergio Durigan Junior3-98/+91
While fixing another bug, I found that the current gdb.base/catch-syscall.exp is kind of messy, could use some improvements, and is not correctly testing some things. I've made the following patch to address all the issues I found. On the organization side, it does a cleanup and removes unecessary imports of gdb_prompt, uses prepare_for_testing and clean_restart where needed, and fixes some comments. The testcase was also not correctly testing catching syscalls using only numbers, or catching many syscalls at once. I fixed that. The patch also uses a new method for obtaining the syscalls numbers: it relies on the C source file to get them, via <sys/syscall.h> and SYS_* macros. This makes the .exp file simpler because there is no need to include target conditionals there. I tested this on x86_64 Fedora 18. gdb/testsuite/ChangeLog: 2013-12-18 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.base/catch-syscall.c: Include <sys/syscall.h>. (close_syscall, chroot_syscall, exit_group_syscall): New variables. * gdb.base/catch-syscall.exp: Replace gdb_compile by prepare_for_testing. Call fill_all_syscalls_numbers before starting. Replace gdb_exit, gdb_start, gdb_reinitialize_dir and gdb_load by clean_restart. (check_info_bp_any_syscall, check_info_bp_specific_syscall) (check_info_bp_many_syscalls): Remove global gdb_prompt. (check_call_to_syscall): Likewise. Add global decimal. Improve testing regex. (check_return_from_syscall): Likewise. (check_continue, insert_catch_syscall_with_arg): Remove global gdb_prompt. (insert_catch_syscall_with_many_args): Likewise. Add global decimal. Fix $filter_str. Improve testing regex. (check_for_program_end): Remove global gdb_prompt. (test_catch_syscall_without_args): Likewise. Add global decimal. Improve testing regex. (test_catch_syscall_with_args, test_catch_syscall_with_many_args) (test_catch_syscall_with_wrong_args) (test_catch_syscall_restarting_inferior) (test_catch_syscall_fail_nodatadir): Remove global gdb_prompt. (do_syscall_tests): Likewise. Remove global srcdir. (test_catch_syscall_without_args_noxml): Remove global gdb_prompt. Add global last_syscall_number. Test for the exact syscall number to be caught. (test_catch_syscall_with_args_noxml): Remove global gdb_prompt. Add global all_syscalls_numbers. Test each syscall number to be caught, instead of only testing "close". (test_catch_syscall_with_wrong_args_noxml): Remove global gdb_prompt. (do_syscall_tests_without_xml): Likewise. Remove global srcdir. Remove stale comment. (fill_all_syscalls_numbers): Add global last_syscall_number. Fill the correct syscall numbers using information from the inferior.
2013-12-18gdb/Yufeng Zhang4-2/+18
* aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Set iov.iov_len with the real length in use. gdb/gdbserver/ * linux-aarch64-low.c (aarch64_linux_set_debug_regs): Set iov.iov_len with the real length in use.
2013-12-18Add target_xfer_partial_ftypeYao Qi10-60/+38
This patch adds a typedef target_xfer_partial_ftype. When we change the signature of xfer_partial functions (for example, adding a new parameter), we don't have to modify all of their declarations. This patch also updates the type of parameters of target_xfer_partial from "void *" to "gdb_byte *". gdb: 2013-12-18 Yao Qi <yao@codesourcery.com> * target.h (target_xfer_partial_ftype): New typedef. (target_xfer_partial): Update declaration. * auxv.h (memory_xfer_auxv): Likewise. * ia64-hpux-nat.c (super_xfer_partial): Likewise. * ia64-linux-nat.c (super_xfer_partial): Likewise. * linux-nat.c (super_xfer_partial): Likewise. * procfs.c (procfs_xfer_partial): Likewise. * record-full.c (record_full_beneath_to_xfer_partial): (tmp_to_xfer_partial): Likewise. * sparc-nat.c (inf_ptrace_xfer_partial): Likewise. * target.c (default_xfer_partial): Likewise. (current_xfer_partial): Likewise. (target_xfer_partial): Change parameter type to 'gdb_byte *'.
2013-12-18Replace sprintf with xsnprintfYao Qi2-4/+12
gdb: 2013-12-18 Yao Qi <yao@codesourcery.com> * linux-nat.c (linux_proc_xfer_partial): Call xsnprintf instead of sprintf. (linux_nat_detach, linux_child_pid_to_exec_file): Likewise. (linux_proc_pending_signals): Likewise.
2013-12-18Fix the format of one ChangeLog entryYao Qi1-2/+2
I notice that two lines of a recent changelog entry are not prefixed with tab. They are prefixed with a space and a tab. This patch is to remove the space. gdb: 2013-12-18 Yao Qi <yao@codesourcery.com> * ChangeLog: Fix the format of one entry.
2013-12-18ARI fix in value.c::value_entirely_unavailableJoel Brobecker2-2/+7
gdb/ChangeLog: * value.c (value_entirely_unavailable): ARI fix: Move trailing binary operator to the next line. No actual code change.
2013-12-17"tfind" across unavailable-stack frames.Pedro Alves8-50/+139
Like when stepping, the current stack frame location is expected to be printed as result of tfind command, if that results in moving to a different function. In tfind_1 we see: if (from_tty && (has_stack_frames () || traceframe_number >= 0)) { enum print_what print_what; /* NOTE: in imitation of the step command, try to determine whether we have made a transition from one function to another. If so, we'll print the "stack frame" (ie. the new function and it's arguments) -- otherwise we'll just show the new source line. */ if (frame_id_eq (old_frame_id, get_frame_id (get_current_frame ()))) print_what = SRC_LINE; else print_what = SRC_AND_LOC; print_stack_frame (get_selected_frame (NULL), 1, print_what, 1); do_displays (); } However, when we haven't collected any registers in the tracepoint (collect $regs), that doesn't actually work: (gdb) tstart (gdb) info tracepoints Num Type Disp Enb Address What 1 tracepoint keep y 0x080483b7 in func0 at ../.././../git/gdb/testsuite/gdb.trace/circ.c:28 collect testload installed on target 2 tracepoint keep y 0x080483bc in func1 at ../.././../git/gdb/testsuite/gdb.trace/circ.c:32 collect testload installed on target (gdb) c Continuing. Breakpoint 3, end () at ../.././../git/gdb/testsuite/gdb.trace/circ.c:72 72 } (gdb) tstop (gdb) tfind start Found trace frame 0, tracepoint 1 #0 func0 () at ../.././../git/gdb/testsuite/gdb.trace/circ.c:28 28 } (gdb) tfind Found trace frame 1, tracepoint 2 32 } (gdb) When we don't have info about the stack available (UNWIND_UNAVAILABLE), frames end up with outer_frame_id as frame ID. And in the scenario above, the issue is that both frames before and after the second tfind (the frames for func0 an func1) have the same id (outer_frame_id), so the frame_id_eq check returns false, even though the frames were of different functions. GDB knows that, because the PC is inferred from the tracepoint's address, even if no registers were collected. To fix this, this patch adds support for frame ids with a valid code address, but <unavailable> stack address, and then makes the unwinders use that instead of the catch-all outer_frame_id for such frames. The frame_id_eq check in tfind_1 then automatically does the right thing as expected. I tested with --directory=gdb.trace/ , before/after the patch, and compared the resulting gdb.logs, then adjusted the tests to expect the extra output that came out. Turns out that was only circ.exp, the original test that actually brought this issue to light. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2013-12-17 Pedro Alves <palves@redhat.com> * frame.h (enum frame_id_stack_status): New enum. (struct frame_id) <stack_addr>: Adjust comment. <stack_addr_p>: Delete field, replaced with ... <stack_status>: ... this new field. (frame_id_build_unavailable_stack): Declare. * frame.c (frame_addr_hash, fprint_field, outer_frame_id) (frame_id_build_special): Adjust. (frame_id_build_unavailable_stack): New function. (frame_id_build, frame_id_build_wild): Adjust. (frame_id_p, frame_id_eq, frame_id_inner): Adjust to take into account frames with unavailable stack. * amd64-tdep.c (amd64_frame_this_id) (amd64_sigtramp_frame_this_id, amd64_epilogue_frame_this_id): Use frame_id_build_unavailable_stack. * dwarf2-frame.c (dwarf2_frame_this_id): Likewise. * i386-tdep.c (i386_frame_this_id, i386_epilogue_frame_this_id) (i386_sigtramp_frame_this_id): Likewise. gdb/testsuite/ 2013-12-17 Pedro Alves <palves@redhat.com> * gdb.trace/circ.exp: Expect frame info to be printed when switching between frames with unavailable stack, but different functions.
2013-12-17Convert the unavailable vector to be bit, not byte, based.Andrew Burgess7-22/+625
https://sourceware.org/ml/gdb-patches/2013-12/msg00144.html The vector of unavailable parts of a value is currently byte based. Given that we can model a value down to the bit level, we can potentially loose information with the current implementation. After this patch we model the unavailable information in bits. gdb/ChangeLog * dwarf2loc.c (read_pieced_value): Mark bits, not bytes unavailable, use correct bit length. * value.c (struct value): Extend comment on unavailable to indicate that it is bit based. (value_bits_available): New function. (value_bytes_available): Call value_bits_available. (value_entirely_available): Check against the bit length, not byte length. (mark_value_bits_unavailable): New function. (mark_value_bytes_unavailable): Move contents to mark_value_bits_unavailable, call to same. (memcmp_with_bit_offsets): New function. (value_available_contents_bits_eq): New function, takes the functionality from value_available_contents_eq but uses memcmp_with_bit_offsets now, and is bit not byte based. (value_available_contents_eq): Move implementation into value_available_contents_bits_eq, call to same. (value_contents_copy_raw): Work on bits, not bytes. (unpack_value_bits_as_long_1): Check availability in bits, not bytes. * value.h (value_bits_available): Declare new function. (mark_value_bits_unavailable): Declare new function. gdb/testsuite/ChangeLog * gdb.trace/unavailable-dwarf-piece.c: New file. * gdb.trace/unavailable-dwarf-piece.exp: New file.
2013-12-16 Fix compilation error for cygwin native build.Pierre Muller2-3/+19
* windows-nat.c (windows_ensure_ntdll_loaded) [__USEWIDE]: Call wcstombs.
2013-12-16PR 16329: remote debugging broken on Solaris.Pedro Alves2-0/+10
Like on GNU/Linux (linux-thread-db.c), the Solaris solaris-threads target (handles libthread_db.so) shouldn't be pushed when remote debugging. This uses the same predicate used by linux-thread-db.c. gdb/ 2013-12-16 Pedro Alves <palves@redhat.com> PR 16329 * sol-thread.c (check_for_thread_db): If the target can't run or isn't a core, return without pushing.
2013-12-15Revert "Do not overwrite so_list's so_name in solib_map_sections"Joel Brobecker4-0/+43
This reverts commit 07293be44859c607a36c313e51bec2dcdcd3c243, as it causes an unintended change of behavior with GDB/MI's =library-loaded events: The host-name="<path>" part of the event is now showing the target-side path instead of the host-side path. This revert affects Darwin and AIX systems, however, where the BFD is either artificial or icomplete, leading to the outputt of "info shared" not containing the information we'd like. For instance, on Darwin, we would see: (top-gdb) info shared From To Syms Read Shared Object Library 0x00007fff8d060de4 0x00007fff8d09ce1f Yes (*) i386:x86-64 0x00007fff8af08b10 0x00007fff8b1c6f73 Yes (*) i386:x86-64 To compensate for that, we overwrite the filename of the associated bfd. gdb/ChangeLog: Revert the following commit: * solib.c (solib_map_sections): Remove code overwriting SO->SO_NAME with the bfd's filename. Make the following changes required after the revert above: * solib-aix.c (solib_aix_bfd_open): Set the filename of the returned bfd to a copy of the synthetic pathname. * solib-darwin.c (darwin_bfd_open): Set the filename of the returned bfd to a copy of PATHNAME.
2013-12-15Perf test case: skip-prologueYao Qi4-0/+165
This patch add a perf test case on skip-prologue by inserting breakpoints on two functions many times, in order to exercise skip-prologue. gdb/testsuite: 2013-12-15 Yao Qi <yao@codesourcery.com> * gdb.perf/skip-prologue.c: New. * gdb.perf/skip-prologue.exp: New. * gdb.perf/skip-prologue.py: New.
2013-12-13nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missingJoel Brobecker4-0/+107
This is the gdbserver-equivalent of the change made in GDB to handle the case, in x64 windows version 2012, where the kernel produces a LOAD_DLL_DEBUG_EVENT where the name of the associated DLL cannot be determined at that time, and thus has to be processed later. The visible symptom is that ntdll.dll is missing from the list of shared libraries known to be mapped by the inferior, with other side-effects such as failure to unwind through code provided by that DLL (such as exception handling routines). gdb/gdbserver/ChangeLog: * Makefile.in (safe-ctype.o, lbasename.o): New rules. * configure.srv: Add safe-ctype.o and lbasename.o to srv_tgtobj for all targets that use win32-low.c. * win32-low.c (win32_ensure_ntdll_loaded): New function. (do_initial_child_stuff): Add call to win32_ensure_ntdll_loaded.
2013-12-13Do the target-waiting within do_initial_child_stuff on Windows.Pedro Alves3-15/+66
This is a preparatory patch that achieves two goals: . Makes the initial event handling more similar to GDB's; . Opens the door for implementing post-inititial-handling operations. At the moment, this is only done on Windows, where the post-initial-handling is going to be needed (in the context of Windows 2012). And because we're close to creating the gdb 7.7 branch, making that change for all platforms is a little more risk that we'd like. So the change is currently implemented on Windows. gdb/gdbserver/ChangeLog: * target.c (mywait): Set OURSTATUS->KIND to TARGET_WAITKIND_STOPPED if equal to TARGET_WAITKIND_LOADED. * win32-low.c (cached_status): New static global. (win32_wait): Add declaration. (do_initial_child_stuff): Flush all initial pending debug events up to the initial breakpoint. (win32_wait): If CACHED_STATUS was set, return that instead of doing a real wait. Remove the code resuming the execution of the inferior after receiving a TARGET_WAITKIND_LOADED event during the initial phase. Also remove the code changing OURSTATUS->KIND from TARGET_WAITKIND_LOADED to TARGET_WAITKIND_STOPPED.
2013-12-13wrong dimension found in ada-lang.c:ada_array_bound_from_typeJoel Brobecker8-6/+181
This function has the following code: elt_type = type; for (i = n; i > 1; i--) elt_type = TYPE_TARGET_TYPE (type); For multi-dimension arrays, the code above tries to find the array type corresponding to the dimension we're trying to inspect. The problem is that, past the second dimension, the loop does nothing other than repeat the first iteration. There is a little thinko where it got the TYPE_TARGET_TYPE of TYPE instead of ELT_TYPE! To my surprise, I was unable to produce an Ada exemple that demonstrated the problem. That's because the examples I created all trigger a parallel ___XA type which we then use in place of the ELT_TYPE in order to determine the bounds - see the code that immediately follows our loop above: index_type_desc = ada_find_parallel_type (type, "___XA"); ada_fixup_array_indexes_type (index_type_desc); if (index_type_desc != NULL) [...] So, in order to avoid depending on an Ada example where the compiler can potentially decide one way or the other, I decided to use an artificial example, written in C. With ... int multi[1][2][3]; ... forcing the language to Ada, and trying to print the 'last, we get: (gdb) p multi'last(1) $1 = 0 (gdb) p multi'last(2) $2 = 1 (gdb) p multi'last(3) $3 = 1 <<<--- This should be 2! Additionally, I noticed that a couple of check_typedef's were missing. This patch adds them. And since the variable in question only gets used within an "else" block, I moved the variable declaration and use inside that block - making it clear what the scope of the variable is. gdb/ChangeLog: * ada-lang.c (ada_array_bound_from_type): Move the declaration and assignment of variable "elt_type" inside the else block where it is used. Add two missing check_typedef calls. Fix bug where we got TYPE's TYPE_TARGET_TYPE, where in fact we really wanted to get ELT_TYPE's TYPE_TARGET_TYPE. gdb/testsuite/ChangeLog: * gdb.ada/arraydim: New testcase.
2013-12-13Small style violation fix in ada_array_bound_from_typeJoel Brobecker2-1/+6
gdb/ChangeLog: * ada-lang.c (ada_array_bound_from_type): Remove unwanted space between 'struct type *' and 'arr_type'.
2013-12-122013-12-12 Siva Chandra Reddy <sivachandra@google.com>Siva Chandra10-3/+251
PR python/16113 * NEWS (Python Scripting): Add entry for the new feature and the new attribute of gdb.Field objects. * python/py-type.c (gdbpy_is_field): New function (convert_field): Add 'parent_type' attribute to gdb.Field objects. * python/py-value.c (valpy_getitem): Allow subscript value to be a gdb.Field object. (value_has_field): New function (get_field_flag): New function * python/python-internal.h (gdbpy_is_field): Add declaration. testsuite/ * gdb.python/py-value-cc.cc: Improve test case. * gdb.python/py-value-cc.exp: Add new tests to test usage of gdb.Field objects as subscripts on gdb.Value objects. doc/ * gdb.texinfo (Values From Inferior): Add a note about using gdb.Field objects as subscripts on gdb.Value objects. (Types In Python): Add description about the new attribute "parent_type" of gdb.Field objects.
2013-12-12Add @cindex for section documenting the -list-features GDB/MI command.Joel Brobecker2-0/+6
gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Miscellaneous Commands): Add @cindex entry for section docuumenting the -list-features GDB/MI command.
2013-12-12breakpoint.c:insert_bp_location: Constify local.Pedro Alves2-3/+8
gdb/ 2013-12-12 Pedro Alves <palves@redhat.com> * breakpoint.c (insert_bp_location): Make 'hw_bp_err_string' local const, and remove casts.
2013-12-12Eliminate UNSUPPORTED_ERROR.Pedro Alves5-24/+32
I have a case that could use an exception for "unsupported feature". I found UNSUPPORTED_ERROR, but looking deeper, I think as is, reusing it for other things would be fragile. E.g., if the Python script sourced by source_script_from_stream triggers any other missing functionality that would result in UNSUPPORTED_ERROR being propagated out to source_script_from_stream, that would confuse the error for Python not being built into GDB. This patch thus redoes things a little. Instead of using an exception for the "No Python" scenario, check whether Python is configured in before actually trying to source the file. It adds a new function instead of using #ifdef HAVE_PYTHON directly, as that is better at avoiding bitrot, as both Python and !Python paths are visible to the compiler this way. Tested on Fedora 17, with and without Python. gdb/ 2013-12-12 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (source_script_from_stream) Use have_python instead of catching UNSUPPORTED_ERROR. * exceptions.h (UNSUPPORTED_ERROR): Delete. * python/python.c (source_python_script) [!HAVE_PYTHON]: Internal error if called. * python/python.h (have_python): New static inline function.
2013-12-11 * dwarf2read.c (lookup_dwo_cutu): Include name of dwp file inDoug Evans2-5/+24
"can't find DWO" warning.
2013-12-10Sanitize access to gdbarch on the SDT probe API (and fix ARM bug)Sergio Durigan Junior6-29/+71
This patch sanitizes the access to gdbarch made by various functions of the SDT probe API. Before this patch, gdbarch was being accessed via the probe's objfile; however, this proved to cause a bug on 32-bit ARM targets because during the parsing of the probe's arguments the code needed to access some pseudo-registers of the architecture, and this information is not fully correct on the objfile's gdbarch. Basically, the approach taken was to instead pass the current/selected frame to the parsing and evaluation functions, so that they can extract the gdbarch directly from the frame. It solved the ARM bug reported above, and also contributed to make the API cleaner. Tested on x86_64 and 32-bit ARM. 2013-12-11 Sergio Durigan Junior <sergiodj@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Pass selected frame to get_probe_argument_count and evaluate_probe_argument. * probe.c (get_probe_argument_count): Adjust declaration to accept frame. Pass frame to probe_ops's get_probe_argument_count. (evaluate_probe_argument): Likewise, for evaluate_probe_argument. (probe_safe_evaluate_at_pc): Pass frame to get_probe_argument_count and evaluate_probe_argument. * probe.h (struct probe_ops) <get_probe_argument_count, evaluate_probe_argument>: Adjust declarations to accept frame. (get_probe_argument_count, evaluate_probe_argument): Likewise. * solib-svr4.c (solib_event_probe_action): Get current frame. Pass it to get_probe_argument_count. (svr4_handle_solib_event): Get current frame. Pass it to get_probe_argument_count and evaluate_probe_argument. * stap-probe.c (stap_parse_probe_arguments): Adjust declaration to accept gdbarch. Do not obtain it from the probe's objfile. (stap_get_probe_argument_count): Adjust declaration to accept frame. Obtain gdbarch from the frame. Call generic can_evaluate_probe_arguments. Pass gdbarch to stap_parse_probe_arguments. (stap_get_arg): Adjust declaration to accept gdbarch. Pass it to stap_parse_probe_arguments. (stap_evaluate_probe_argument): Adjust declaration to accept frame. Obtain gdbarch from the frame. Pass gdbarch to stap_get_arg. (stap_compile_to_ax): Pass agent_expr's gdbarch to stap_get_arg. (compute_probe_arg): Obtain gdbarch from frame. Pass frame to get_probe_argument_count and evaluate_probe_argument.
2013-12-11Fix a bug in matching notifications.Yao Qi2-6/+14
Due to copy-n-paste, the problem caused PR remote/15974 also exists in gdbserver. This patch fixes it in the same way. Patch to fix remote/15974 can be found: https://sourceware.org/ml/gdb-patches/2013-12/msg00014.html gdb/gdbserver: 2013-12-11 Yao Qi <yao@codesourcery.com> * notif.c (handle_notif_ack): Return 0 if no notification matches.
2013-12-10add missing PR# to previous entryDoug Evans1-0/+1
2013-12-10PR 16286Doug Evans5-3/+60
* c-lang.c (c_get_string): Ignore the declared size of the object if a specific length is requested. testsuite/ * gdb.python/py-value.c: #include stdlib.h, string.h. (str): New struct. (main): New local xstr. * gdb.python/py-value.exp (test_value_in_inferior): Add test to fetch a value as a string with a length beyond the declared length of the array.
2013-12-10Delete interp_exec_p.Doug Evans4-16/+10
* interps.h (interp_exec_p): Delete. * interps.c (interp_exec_p): Delete. (interp_exec): Update. Assert interp->procs->exec_proc != NULL. * mi/mi-interp.c (mi_cmd_interpreter_exec): Update.
2013-12-10Add call to get_compiler_info to gdb_compile_shlib.Andrew Burgess2-2/+14
https://sourceware.org/ml/gdb-patches/2013-12/msg00374.html gdb/testsuite/ChangeLog * lib/gdb.exp (gdb_compile_shlib): Add call to get_compiler_info, update comment.
2013-12-10Use target_read_code in skip_prologue (amd64)Yao Qi2-4/+13
gdb: 2013-12-10 Yao Qi <yao@codesourcery.com> * amd64-tdep.c (amd64_analyze_stack_align): Call target_read_code instead of target_read_memory. (amd64_analyze_prologue): Call read_code_unsigned_integer instead of read_memory_unsigned_integer. Call read_code instead of read_memory. (amd64_skip_xmm_prologue): Likewise.
2013-12-10Use target_read_code in skip_prologue (i386)Yao Qi4-34/+106
GDB is able to cache memory accesses requested in target_read_code, so target_read_code is more efficient than general target_read_memory. This patch uses target_read_code and its variants to read target memory in the functions related to i386_skip_prologue. It improves the performance when doing 'b foo' (foo is a function) in remote debugging. Nowadays, when we set a breakpoint on function f1, GDB will fetch the code in f1 to determine the start of the function body (say skip the prologue), it requests read from target many times. With this patch applied, the number of RSP 'm' packets are reduced. gdb: 2013-12-10 Yao Qi <yao@codesourcery.com> * corefile.c (read_code): New function. (read_code_integer): New function. (read_code_unsigned_integer): New function. * gdbcore.h (read_code): Declare. (read_code_integer): Declare. (read_code_unsigned_integer): Declare. * i386-tdep.c (i386_follow_jump): Call target_read_code instead of target_read_memory. Call read_code_unsigned_integer instead of read_memory_unsigned_integer. (i386_analyze_struct_return): Likewise. (i386_skip_probe): Likewise. (i386_analyze_stack_align): Likewise. (i386_match_pattern): Likewise. (i386_skip_noop): Likewise. (i386_analyze_frame_setup): Likewise. (i386_analyze_register_saves): Likewise. (i386_skip_prologue): Likewise. (i386_skip_main_prologue): Likewise. (i386_frame_cache_1): Likewise.
2013-12-10Invalidate target cache before starting to handle event.Yao Qi2-0/+33
gdb: 2013-12-10 Yao Qi <yao@codesourcery.com> * infrun.c: Include "target-dcache.h". (prepare_for_detach): Call target_dcache_invalidate. (wait_for_inferior): Likewise. (fetch_inferior_event): Likewise. (infrun_thread_stop_requested_callback): Likewise. Set overlay_cache_invalid to 1.
2013-12-10Set language for Ada minimal symbols.Joel Brobecker4-0/+53
This helps with the following issue: Given an Ada program defining a global variable: package Pck is Watch : Integer := 1974; end Pck; When printing the address of this variable, GDB also tries to print the associated symbol name: (gdb) p watch'address $1 = (access integer) 0x6139d8 <pck__watch> ^^ || The problem is that GDB prints the variable's linkage name, instead of its natural name. This is because the language of the associated minimal symbol never really gets set. This patch adds handling for Ada symbols in symbol_find_demangled_name. After this patch, we now get: (gdb) p watch'address $1 = (access integer) 0x6139d8 <pck.watch> ^ | gdb/ChangeLog: * symtab.c (symbol_find_demangled_name): Add handling of Ada symbols. gdb/testsuite/ChangeLog: * gdb.ada/int_deref.exp: Add test verifying that we print the decoded symbol name when printing the address of Ada symbols.
2013-12-10GDB/MI: Document support for -exec-run --start in -list-featuresJoel Brobecker7-1/+31
This adds "exec-run-start-option" in the output of the -list-features commands, allowing front-ends to easily determine whether -exec-run supports the --start option. gdb/ChangeLog: * mi/mi-main.c (mi_cmd_list_features): add "exec-run-start-option". * NEWS: Expand the entry documenting the new -exec-run --start option to mention the corresponding new entry in the output of "-list-features". gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new "exec-run-start-option" entry in the output of the "-list-features" command. gdb/testsuite/ChangeLog: * gdb.mi/mi-start.exp: Add test verifying that -list-features contains "exec-run-start-option".
2013-12-10nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missingJoel Brobecker2-0/+93
We observed on Windows 2012 that we were unable to unwind past exception handlers. For instance, with any Ada program raising an exception that does not get handled: % gnatmake -g a -bargs -shared % gdb a (gdb) start (gdb) catch exception unhandled Catchpoint 2: unhandled Ada exceptions (gdb) c Catchpoint 2, unhandled CONSTRAINT_ERROR at <__gnat_unhandled_exception> ( e=0x645ff820 <constraint_error>) at s-excdeb.adb:53 53 s-excdeb.adb: No such file or directory. At this point, we can already see that something went wrong, since the frame selected by the debugger corresponds to a runtime function rather than the function in the user code that caused the exception to be raised (in our case procedure A). This is further confirmed by the fact that we are unable to unwind all the way to procedure A: (gdb) bt #0 <__gnat_unhandled_exception> (e=0x645ff820 <constraint_error>) at s-excdeb.adb:53 #1 0x000000006444e9a3 in <__gnat_notify_unhandled_exception> (excep=0x284d2 +0) at a-exextr.adb:144 #2 0x00000000645f106a in __gnat_personality_imp () from C:\[...]\libgnat-7.3.dll #3 0x000000006144d1b7 in _GCC_specific_handler (ms_exc=0x242fab0, this_frame=0x242fe60, ms_orig_context=0x242f5c0, ms_disp=0x242ef70, gcc_per=0x645f0960 <__gnat_personality_imp>) at ../../../src/libgcc/unwind-seh.c:289 #4 0x00000000645f1211 in __gnat_personality_seh0 () from C:\[...]\libgnat-7.3.dll #5 0x000007fad3879f4d in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) It turns out that the unwinder has been doing its job flawlessly up until frame #5. The address in frame #5 is correct, but GDB is not able to associate it with any symbol or unwind record. And this is because this address is inside ntdll.dll, and when we received the LOAD_DLL_DEBUG_EVENT for that DLL, the system was not able to tell us the name of the library, thus causing us to silently ignoring the event. Because GDB does not know about ntdll.dll, it is unable to access the unwind information from it. And because the function at that address does not use a frame pointer, the unwinding becomes impossible. This patch helps recovering ntdll.dll at the end of the "run/attach" phase, simply by trying to locate that specific DLL again. In terms of our medium to long term planning, it seems to me that we should be able to simplify the code by ignoring LOAD_DLL_DEBUG_EVENT during the startup phase, and modify windows_ensure_ntdll_loaded to then detect and report all shared libraries after we've finished inferior creation. But for a change just before 7.7 branch creation, I thought it was safest to just handle ntdll.dll specifically. This is less intrusive, and ntdll is the only DLL affected by the problem I know so far. gdb/ChangeLog: * windows-nat.c (handle_load_dll): Add comments. (windows_ensure_ntdll_loaded): New function. (do_initial_windows_stuff): Use windows_ensure_ntdll_loaded. Add FIXME comment.
2013-12-08Fix gdb/ChangeLog date in last entry.Joel Brobecker1-1/+1
2013-12-08Use gdb_produce_sourceYao Qi2-51/+61
We added a new proc gdb_produce_source recently, and it can be used more widely in lib/gdb.exp to generate source file. gdb/testsuite: 2013-12-08 Yao Qi <yao@codesourcery.com> * lib/gdb.exp (support_complex_tests): Use gdb_produce_source. (is_elf_target, is_ilp32_target, is_ilp64_target): Likewise. (is_64_target, is_amd64_regs_target): Likewise. (skip_altivec_tests, skip_vsx_tests, skip_btrace_tests): Likewise.