aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2013-11-02gdb.cp/derivation.exp: s/perrro/perror/Maciej W. Rozycki2-1/+5
2013-11-01gdb.dwarf2/dwzbuildid.exp: Avoid reserved variable nameMaciej W. Rozycki2-3/+8
* gdb.dwarf2/dwzbuildid.exp: Rename `outdir' variable to `debugdir'.
2013-11-01breakpoint.c: fix libc probe scan when no get_longjmp_target exists.Tiago Stürmer Daitx2-2/+8
As discussed on the GDB ML[1], libc probes for longjmp were not being loaded if a custom <arch>_get_longjmp_target function was not implemented. This is trivially fixed by moving the 'if (!gdbarch_get_longjmp_target_p (gdbarch))' down, just bellow libc probe code and above the per-objfile cache lookup. While the condition could also be removed altogether with no side-effects, it is in fact an optimization to avoid searching for symbols if the arch doesn't provide support for get_longjmp_target(). This has been tested on PPC and PPC64. [1] https://sourceware.org/ml/gdb/2013-10/msg00191.html gdb/ 2013-11-01 Tiago Stürmer Daitx <tdaitx@linux.vnet.ibm.com> * breakpoint.c (create_longjmp_master_breakpoint): Allow libc probe scan even when the arch provides no get_longjmp_target.
2013-10-31infrun.c: use GDB_SIGNAL_0 when hidding signals, not GDB_SIGNAL_TRAP.Pedro Alves2-9/+15
IMO, it doesn't make sense to map random syscall, fork, etc. events to GDB_SIGNAL_TRAP, and possible have the debuggee see that trap. This just seems conceptually wrong to me - these aren't real signals a debuggee would ever see. In fact, when stopped for those events, on Linux, the debuggee isn't in a signal-stop -- there's no way to resume-and-deliver-signal at that point, for example. E.g., when stopped at a fork event: (gdb) catch fork Catchpoint 2 (fork) (gdb) c Continuing. Catchpoint 2 (forked process 4570), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131 131 pid = ARCH_FORK (); (gdb) set debug infrun 1 (gdb) signal SIGTRAP Continuing with signal SIGTRAP. infrun: clear_proceed_status_thread (process 4566) infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0) infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4566] at 0x323d4ba7c4 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 4566 [process 4566], infrun: status->kind = exited, status = 0 infrun: infwait_normal_state infrun: TARGET_WAITKIND_EXITED [Inferior 1 (process 4566) exited normally] infrun: stop_stepping (gdb) Note the signal went nowhere. It was swallowed. Resuming with a SIGTRAP from a syscall event does queue the signal, but doesn't deliver it immediately, like "signal SIGTRAP" from a real signal would. It's still an artificial SIGTRAP: (gdb) catch syscall Catchpoint 2 (any syscall) (gdb) c Continuing. Catchpoint 2 (call to syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131 131 pid = ARCH_FORK (); (gdb) set debug infrun 1 (gdb) signal SIGTRAP Continuing with signal SIGTRAP. infrun: clear_proceed_status_thread (process 4622) infrun: proceed (addr=0xffffffffffffffff, signal=5, step=0) infrun: resume (step=0, signal=5), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 4622 [process 4622], infrun: status->kind = exited syscall infrun: infwait_normal_state infrun: TARGET_WAITKIND_SYSCALL_RETURN infrun: syscall number = '56' infrun: BPSTAT_WHAT_STOP_NOISY infrun: stop_stepping Catchpoint 2 (returned from syscall clone), 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131 131 pid = ARCH_FORK (); (gdb) c Continuing. infrun: clear_proceed_status_thread (process 4622) infrun: proceed (addr=0xffffffffffffffff, signal=144, step=0) infrun: resume (step=0, signal=0), trap_expected=0, current thread [process 4622] at 0x323d4ba7c4 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 4622 [process 4622], infrun: status->kind = stopped, signal = SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x323d4ba7c4 infrun: random signal 5 Program received signal SIGTRAP, Trace/breakpoint trap. infrun: stop_stepping 0x000000323d4ba7c4 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:131 131 pid = ARCH_FORK (); (gdb) In all the above, I used 'signal SIGTRAP' to emulate 'handle SIGTRAP pass'. As described in "keep_going", 'handle SIGTRAP pass' does have its place: /* Do not deliver GDB_SIGNAL_TRAP (except when the user explicitly specifies that such a signal should be delivered to the target program). Typically, that would occur when a user is debugging a target monitor on a simulator: the target monitor sets a breakpoint; the simulator encounters this breakpoint and halts the simulation handing control to GDB; GDB, noting that the stop address doesn't map to any known breakpoint, returns control back to the simulator; the simulator then delivers the hardware equivalent of a GDB_SIGNAL_TRAP to the program being debugged. */ ... and I've made use of that myself when implementing/debugging stubs/monitors. But in these cases, treating these events as SIGTRAP possibly injects signals in the debuggee they'd never see otherwise, because you need to use ptrace to enable these special events, which aren't real signals. There's more. Take this bit of handle_inferior_event, where we determine whether a real signal (TARGET_WAITKIND_STOPPED) was random or not: if (ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP) ecs->random_signal = !((bpstat_explains_signal (ecs->event_thread->control.stop_bpstat, GDB_SIGNAL_TRAP) != BPSTAT_SIGNAL_NO) || stopped_by_watchpoint || ecs->event_thread->control.trap_expected || (ecs->event_thread->control.step_range_end && (ecs->event_thread->control.step_resume_breakpoint == NULL))); else { enum bpstat_signal_value sval; sval = bpstat_explains_signal (ecs->event_thread->control.stop_bpstat, ecs->event_thread->suspend.stop_signal); ecs->random_signal = (sval == BPSTAT_SIGNAL_NO); if (sval == BPSTAT_SIGNAL_HIDE) ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP; } Note that the if (sval == BPSTAT_SIGNAL_HIDE) ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_TRAP; bit is only reacheable for signals != GDB_SIGNAL_TRAP. AFAICS, sval can only be BPSTAT_SIGNAL_HIDE if nothing in the bpstat returns BPSTAT_SIGNAL_PASS. So that excludes a "catch signal" for the signal in question in the bpstat. All other catchpoints that aren't based on breakpoints behind the scenes call process_event_stop_test directly (don't pass through here) (well, almost all: TARGET_WAITKIND_LOADED does have a fall through, but only for STOP_QUIETLY or STOP_QUIETLY_NO_SIGSTOP, which still return before this code is reached). Catchpoints that are implemented as breakpoints behind the scenes can only appear in the bpstat if the signal was GDB_SIGNAL_TRAP (bkpt_breakpoint_hit returns false otherwise). So that leaves a target reporting a hardware watchpoint hit with a signal other than GDB_SIGNAL_TRAP. And even then it looks quite wrong to me to magically convert the signal into a GDB_SIGNAL_TRAP here too -- if the user has set SIGTRAP to "handle pass", the program will see a trap that gdb invented, not one the program would ever see without gdb in the picture. Tested on x86_64 Fedora 17. gdb/ 2013-10-31 Pedro Alves <palves@redhat.com> * infrun.c (handle_syscall_event): Don't set or clear stop_signal. (handle_inferior_event) <TARGET_WAITKIND_FORKED, TARGET_WAITKIND_VFORKED>: Don't set stop_signal to GDB_SIGNAL_TRAP, or clear it. Pass GDB_SIGNAL_0 to bpstat_explains signal, instead of GDB_SIGNAL_TRAP. <bpstat handling>: If the bpstat chain wants the signal to be hidden, then set stop_signal to GDB_SIGNAL_0 instead of GDB_SIGNAL_TRAP.
2013-10-31Extra error message from update_watchpointAndrew Burgess5-6/+48
https://sourceware.org/ml/gdb-patches/2013-10/msg00551.html gdb/ChangeLog * breakpoint.c (update_watchpoint): Update error message and add an additional error message. gdb/testsuite/ChangeLog * gdb.base/watchpoint.exp (test_no_hw_watchpoints): Add additional tests and update expected error message. (test_watch_register_location): New tests. (do_tests): Call test_watch_register_location. * gdb.base/watchpoints.exp: Update expected error message.
2013-10-30S/390: Add missing gdb_prompt in s390-multiarch.expUlrich Weigand2-2/+9
Correct the patterns in the gdb_test_multiple invocation. testsuite/ 2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com> * gdb.arch/s390-multiarch.exp (test_linux_v2): Add $gdb_prompt to the patterns in gdb_test_multiple.
2013-10-30S/390: Rename source files to *-linux-*Ulrich Weigand8-9/+27
As suggested before, rename the S/390-related source files (tdep and nat) such that "-linux-" occurs in the file name, like with other GNU/Linux targets. Since no other operating system is currently supported by GDB on this architecture, this isn't strictly necessary. But the old names sometimes caused GDB contributors to miss these files when performing a change that affects all GNU/Linux targets. The latest such incident was observed here: https://sourceware.org/ml/gdb-patches/2013-09/msg00619.html gdb/ 2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com> * s390-tdep.h: Rename to... * s390-linux-tdep.h: ...here. * s390-tdep.c: Rename to... * s390-linux-tdep.c: ...here. Adjust #include. * s390-nat.c: Rename to... * s390-linux-nat.c: ...here. Adjust #include. * config/s390/s390.mh: Rename to... * config/s390/linux.mh: ...here. Reflect rename s390-nat.o -> s390-linux-nat.o. * configure.host: Reflect host rename "s390" -> "linux". * configure.tgt: Reflect rename s390-tdep.o -> s390-linux-tdep.o. * Makefile.in (ALL_TARGET_OBS): Likewise. (HFILES_NO_SRCDIR): Reflect rename s390-tdep.h -> s390-linux-tdep.h. (ALLDEPFILES): Reflect rename of .c files.
2013-10-30Clean up whitespace in S/390 -tdep and -nat files.Ulrich Weigand4-134/+139
gdb/ 2013-10-30 Andreas Arnez <arnez@linux.vnet.ibm.com> * s390-nat.c: Whitespace cleanup. * s390-tdep.c: Likewise. * s390-tdep.h: Remove empty line at end of file.
2013-10-30linux-tdep.c: Fix "warning: 'siginfo_size' may be used uninitialized..."Maciej W. Rozycki2-1/+6
* linux-tdep.c (linux_corefile_thread_callback): Preinitialize siginfo_size.
2013-10-29undef reg in gdb_curses.hTom Tromey3-5/+13
I tried to build gdb on the AIX machine in the GCC compile farm (gcc111), but it failed in a couple of spots because gdb uses "reg" as a variable name and the AIX <curses.h> defines "reg" to "register". I saw that we already had a workaround for this lurking in utils.c, so I just moved that to gdb_curses.h. This fixed the problem on AIX and still builds on x86-64 Fedora 18. 2013-10-29 Tom Tromey <tromey@redhat.com> * utils.c (reg): Move undefinition... * gdb_curses.h: ... here. Update comment to mention AIX.
2013-10-29ChangeLog entries for the remove-symbol-file commits.Nicolas Blanc3-0/+35
2013-10-29gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables ↵Pedro Alves3-13/+5
defining change-log-default-name. These references to ChangeLog-mi are stale. testsuite/gdb.mi/ChangeLog-mi doesn't exist anymore, since: ... commit 2dd627049d915a78ba15b65ab718d54958d115bf Author: Andrew Cagney <cagney@redhat.com> Date: Sat Jun 23 21:47:09 2001 +0000 Rename gdb.mi/ChangeLog-mi to gdb.mi/ChangeLog. Update everything. ... commit 48efe7049b1c286c702621e2f3e89e4584df2bd2 Author: Andrew Cagney <cagney@redhat.com> Date: Mon Jan 12 15:16:44 2004 +0000 Eliminate the old mi/tui specific ChangeLog files as in ... Added Files: mi/ChangeLog-1999-2003 testsuite/gdb.mi/ChangeLog-1999-2003 tui/ChangeLog-1998-2003 Removed Files: mi/ChangeLog testsuite/gdb.mi/ChangeLog tui/ChangeLog Tested with 'make check RUNTESTFLAGS="--directory=gdb.mi"' on x86_64 Fedora 17. gdb/testsuite/ 2013-10-29 Pedro Alves <palves@redhat.com> * gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variable setting change-log-default-name to ChangeLog-mi.
2013-10-29Print <unavailable> for unavailable registers in info register output.Andrew Burgess4-17/+23
https://sourceware.org/ml/gdb-patches/2013-08/msg00171.html gdb/ChangeLog * infcmd.c (default_print_one_register_info): Use val_print to print all values even optimized out or unavailable ones. Don't try to print a raw form of optimized out or unavailable values. gdb/testsuite/ChangeLog * gdb.trace/unavailable.exp (gdb_unavailable_registers_test): Expect <unavailable> pattern.
2013-10-29Test adding and removing a symbol file at runtime.Nicolas Blanc5-0/+715
This test exercises the commands 'add-symbol-file' and 'remove-symbol-file'. 2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com> gdb/testsuite * gdb.base/sym-file-lib.c: New file. * gdb.base/sym-file-loader.c: New file. * gdb.base/sym-file-loader.h: New file. * gdb.base/sym-file-main.c: New file. * gdb.base/sym-file.exp: New file. Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
2013-10-29Function is_elf_target.Nicolas Blanc1-0/+39
2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com> gdb/testsuite * lib/gdb.exp (is_elf_target): New function. Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
2013-10-29Create target sections for user-added symbol files.Nicolas Blanc3-2/+69
Add the sections of the symbol files that are provided via 'add-symbol-file' to the set of current target sections. User-added sections are removed upon notification of free_objfile when their corresponding object file is deleted. 2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com> * exec.h (add_target_sections_of_objfile): New declaration. * exec.c (add_target_sections_of_objfile): New function. * symfile.c (add_symbol_file_command): Update current target sections. (symfile_free_objfile): New function. (_initialize_symfile): Register observer for free_objfile events. Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
2013-10-29Documentation for the remove-symbol-file command.Nicolas Blanc2-2/+30
2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com> * NEWS: Add description of the remove-symbol-file command. gdb/doc * gdb.texinfo (Commands to Specify Files): Add description of the remove-symbol-file command. Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
2013-10-29New remove-symbol-file command.Nicolas Blanc7-9/+209
New command for removing symbol files added via the add-symbol-file command. 2013-10-29 Nicolas Blanc <nicolas.blanc@intel.com> * breakpoint.c (disable_breakpoints_in_freed_objfile): New function. * objfiles.c (free_objfile): Notify free_objfile. (is_addr_in_objfile): New function. * objfiles.h (is_addr_in_objfile): New declaration. * printcmd.c (clear_dangling_display_expressions): Act upon free_objfile events instead of solib_unloaded events. (_initialize_printcmd): Register observer for free_objfile instead of solib_unloaded notifications. * solib.c (remove_user_added_objfile): New function. * symfile.c (remove_symbol_file_command): New command. (_initialize_symfile): Add remove-symbol-file. gdb/doc * observer.texi: New free_objfile event. Signed-off-by: Nicolas Blanc <nicolas.blanc@intel.com>
2013-10-29Simplify REGISTRY cleanup usagesYao Qi8-39/+30
In registry.c:registry_clear_data, the registered data is iterated and invoke each 'free' function with the data passed: for (registration = data_registry->registrations, i = 0; i < fields->num_data; registration = registration->next, i++) if (fields->data[i] != NULL && registration->data->free != NULL) adaptor (registration->data->free, container, fields->data[i]); we can see that data is passed to function 'free' and data is not NULL. In each usage, we don't have to get the data again through key and do NULL pointer checking. This patch is to simplify them. gdb: 2013-10-29 Yao Qi <yao@codesourcery.com> * auto-load.c (auto_load_pspace_data_cleanup): Get data from parameter 'arg' instead of from program_space_data. * objfiles.c (objfiles_pspace_data_cleanup): Likewise. * solib-darwin.c (darwin_pspace_data_cleanup): Likewise. * solib-dsbt.c (dsbt_pspace_data_cleanup): Likewise. * solib-svr4.c (svr4_pspace_data_cleanup): Likewise. * inflow.c (inflow_inferior_data_cleanup): Get data from parameter 'arg' instead of inferior_data. * registry.h: Add comments.
2013-10-28breakpoint.c:watchpoints_triggered: simplify a tiny bit.Pedro Alves2-1/+6
I was reading this, checking the the possible returns, and this particular path confused a tiny little. Above we do: if (!stopped_by_watchpoint) { ... return 0; } so any return after that always return true. Tested on x86_64 Fedora 17. gdb/ 2013-10-28 Pedro Alves <palves@redhat.com> * breakpoint.c (watchpoints_triggered) <!target_stopped_data_address>: Hardcode return 1.
2013-10-28Fix typo in gdb/testsuite/gdb.arch/thumb2-it.S.Tom de Vries2-1/+5
2013-10-28 Tom de Vries <tom@codesourcery.com> * gdb.arch/thumb2-it.S (it_8): Fix typo.
2013-10-28infrun.c:process_event_stop_test: Reindent.Pedro Alves2-187/+186
gdb/ 2013-10-28 Pedro Alves <palves@redhat.com> * infrun.c (process_event_stop_test): Remove unnecessary scoping level and reindent.
2013-10-28infrun.c:handle_inferior_event: Make process_event_stop_test label a function.Pedro Alves2-15/+37
Now that all ecs->random_signal handing is always done before the 'process_event_stop_test' label, we can easily make that a real function and actually give it a describing comment that somewhat makes sense. Reindenting the new function will be handled in a follow up patch. 2013-10-28 Pedro Alves <palves@redhat.com> * infrun.c (process_event_stop_test): New function, factored out from handle_inferior_event. (handle_inferior_event): 'process_event_stop_test' is now a function instead of a goto label -- adjust.
2013-10-28infrun.c:handle_inferior_event: Move process_event_stop_test goto label.Pedro Alves2-7/+13
We only ever call "goto process_event_stop_test;" right after checking that ecs->random_signal is clear. The code at the process_event_stop_test label looks like: /* For the program's own signals, act according to the signal handling tables. */ if (ecs->random_signal) { ... random signal handling ... return; } else { ... the stop tests that actually matter for the goto callers. } So this moves the label into the else branch. It'll make converting process_event_stop_test into a function a bit clearer. gdb/ 2013-10-28 Pedro Alves <palves@redhat.com> * infrun.c (handle_inferior_event): Move process_event_stop_test goto label to the else branch of the ecs->random_signal check, along with FRAME and GDBARCH re-fetching.
2013-10-28infrun.c:handle_inferior_event: Put all ecs->random_signal tests together.Pedro Alves2-78/+100
I recently added a new ecs->random_signal test after the "switch back to stepped thread" code, and before the stepping tests. Looking at making process_event_stop_test a proper function, I realized it'd be better to keep ecs->random_signal related code together. To do that, I needed to factor out the "switch back to stepped thread" code to a new function, and call it in both the "random signal" and "not random signal" paths. gdb/ 2013-10-28 Pedro Alves <palves@redhat.com> * infrun.c (switch_back_to_stepped_thread): New function, factored out from handle_inferior_event. (handle_inferior_event): Adjust to call switch_back_to_stepped_thread. Call it also at the tail of the random signal handling, and return, instead of also handling random signals just before the stepping tests.
2013-10-28infrun.c:handle_inferior_event: Remove some more dead code.Pedro Alves2-13/+6
'ecs' is always memset before being passed to handle_inferior_event. The stop func is only filled in later in the flow. And since "Remove dead sets/clears of ecs->random signal", nothing ever sets ecs->random_signal before this part is reached either. (Also tested with some added assertions in place.) gdb/ 2013-10-28 Pedro Alves <palves@redhat.com> * infrun.c (clear_stop_func): Delete. (handle_inferior_event): Don't call clear_stop_func and don't clear 'ecs->random_signal'.
2013-10-27Rename field 'lang' to 'lang_ops'.Yao Qi2-15/+25
On 10/25/2013 11:34 AM, Joel Brobecker wrote: > Also, as a followup, I think it would be beneficial if we renamed > field "lang" in the varobj_root into "lang_ops". I think it's more > descriptive, especially since "lang" is used elsewhere with different > meanings (and types). Here is the patch to rename 'lang' to 'lang_ops'. Committed as obvious. gdb: 2013-10-27 Yao Qi <yao@codesourcery.com> * varobj.c (struct varobj_root) <lang>: Rename to 'lang_ops'. (varobj_create, varobj_get_path_expr): Update. (varobj_value_has_mutated, varobj_update): Likewise. (create_child_with_value, new_root_variable): Likewise. (number_of_children, name_of_variable): Likewise. (value_of_child, my_value_of_variable): Likewise. (varobj_value_is_changeable_p): Likewise.
2013-10-25New field la_varobj_ops in struct language_defnYao Qi15-3/+63
This is a follow-up series to move language stuff out of varobj.c. This patch adds a new field la_varobj_ops in struct language_defn so that each language has varobj-related options. Not every language supports varobj, and the operations are identical to operations of c languages. 'struct language_defn' is the ideal place to save all language-related operations. After this patch, some cleanups can be done in patch 2/2, which removes language-related stuff completely from varobj.c. Regression tested on x86_64-linux. gdb: 2013-10-25 Yao Qi <yao@codesourcery.com> * language.h (struct lang_varobj_ops): Declare. (struct language_defn) <la_varobj_ops>: New field. * ada-lang.c: Include "varobj.h" (defn ada_language_defn): Initialize field 'la_varobj_ops' by ada_varobj_ops. * c-lang.c: Include "varobj.h" (c_language_defn): Initialize field 'la_varobj_ops' by c_varobj_ops. (cplus_language_defn): Initialize field 'la_varobj_ops' by cplus_varobj_ops. (asm_language_defn): Initialize field 'la_varobj_ops' by default_varobj_ops. (minimal_language_defn): Likewise. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Likewise. * go-lang.c (go_language_defn): Likewise. * m2-lang.c (m2_language_defn): Likewise. * objc-lang.c (objc_language_defn): Likewise. * opencl-lang.c (opencl_language_defn): Likewise. * p-lang.c (pascal_language_defn): Likewise. * language.c (unknown_language_defn): Likewise. (auto_language_defn): Likewise. (local_language_defn): Likewise. * jv-lang.c (java_language_defn): Initialize field 'la_varobj_ops' by java_varobj_ops. * varobj.c (varobj_create): Update. * varobj.h (default_varobj_ops): Define macro.
2013-10-25testsuite: Fix gdb.base/bang.exp for remote stubs without exitAnton Kolesov2-9/+7
Some remote stubs do not have a proper exit() function implementation. gdb.base/bang.exp was failing on those targets due to timeout. With this patch bang.exp uses already defined library procedures to handle this situation gracefully without breaking native targets. Tested with x86_64 (unix, native-gdbserver) and with arc-*-elf32. gdb/testsuite/ChangeLog: 2013-10-25 Anton Kolesov <Anton.Kolesov@synopsys.com> (tiny change) * gdb.base/bang.exp: Use gdb_continue_to_end to properly support remote stubs where exit() behaviour is unreliable.
2013-10-25Print nonexisting/optimized out static fields gracefully.Pedro Alves8-35/+53
With: struct static_struct { static int aaa; }; struct static_struct sss; int main () { return 0; } We get: (gdb) p sss $1 = {static aaa = <optimized out>} (gdb) p sss.aaa field aaa is nonexistent or has been optimized out Note that the "field aaa ..." message is an error being thrown. GDB is graceful everywhere else when printing optimized out values. IOW it usually prints an <optimized out> value and puts that in the value history. I see no reason for here to be different, more so that when the print the whole "containing" object (well, it's a static field, so it's not really a container), we already print <optimized out>. After the patch: (gdb) p sss $1 = {static aaa = <optimized out>} (gdb) p sss.aaa $2 = <optimized out> The value_entirely_optimized_out checks are there to preserve behavior. Without those, if the static field is a struct/union, GDB would go and print its fields one by one (and print <optimized out> for each). Tested on x86_64 Fedora 17. gdb/ 2013-10-25 Pedro Alves <palves@redhat.com> * cp-valprint.c (cp_print_value_fields): No longer handle a NULL static field value. (cp_print_static_field): If the value is entirely optimized out, print <optimized out> here. * jv-valprint.c (java_print_value_fields): No longer handle a NULL static field value. * p-valprint.c (pascal_object_print_static_field): If the value is entirely optimized out, print <optimized out> here. * valops.c (do_search_struct_field) (value_struct_elt_for_reference): No longer handle a NULL static field value. * value.c (value_static_field): Return an optimized out value instead of NULL. gdb/testsuite/ 2013-10-25 Pedro Alves <palves@redhat.com> * gdb.cp/m-static.exp: Adjust expected output of printing a nonexistent or optimized out static field. Also test printing the the "container" object.
2013-10-25Send qXfer:traceframe-info:read when traceframe is selected.Yao Qi2-0/+10
When I do 'si', I find many 'qXfer:traceframe-info:read' packets are sent, which is not necessary. It slows down the single step. (gdb) si Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes:: Sending packet: $Z0,80483c7,1#b4...Packet received: OK Sending packet: $Z0,4ce5b6b0,1#6e...Packet received: OK Sending packet: $QPassSignals:e;10;14;17;1a;1b;1c;21;24;25;2c;4c;#5f...Packet received: OK Sending packet: $vCont;s:p1b15.1b15;c#20...Packet received: T0505:44efffbf;04:44efffbf;08:d1830408;thread:p1b15.1b15;core:3; Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $mbfffef40,40#c0...Packet received: d183040878efffbf2e840408030000000000a040030000000500000070efffbf07000000010000004984040807000000030000000500000000000000b396e84c Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $z0,80483c7,1#d4...Packet received: OK Sending packet: $z0,4ce5b6b0,1#8e...Packet received: OK Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01 This problem was introduced by this patch (https://sourceware.org/ml/gdb-patches/2013-04/msg00000.html), in which get_traceframe_number is not checked before calling traceframe_available_memory. This patch moves the check to remote_traceframe_info, say, if GDB doesn't have traceframe selected, GDB doesn't need to send qXfer:traceframe-info:read packets. With this patch applied, there is no qXfer:traceframe-info:read sent out and single step is speed up a little bit. Here is the experiment I did: Num of single step Original Patched single-step cpu_time 10000 8.08 7.57 single-step cpu_time 20000 16.23 14.23 single-step cpu_time 30000 24.19 21.59 single-step cpu_time 40000 32.49 28.0 single-step wall_time 10000 14.1974210739 13.2641420364 single-step wall_time 20000 28.5278921127 25.0541369915 single-step wall_time 30000 42.5864038467 38.0038759708 single-step wall_time 40000 57.2107698917 49.2350611687 single-step vmsize 10000 16128 16388 single-step vmsize 20000 16128 16388 single-step vmsize 30000 16260 16520 single-step vmsize 40000 16444 16704 The patch is tested on x86_64-linux. gdb: 2013-10-24 Yao Qi <yao@codesourcery.com> * remote.c (remote_traceframe_info): Return early if traceframe is not selected.
2013-10-25Fix changelog.Yao Qi1-0/+6
gdb/ Add changelog entry for my previous commit.
2013-10-25Remove global traceframe_fun and traceframe_salYao Qi1-6/+2
I happen to see traceframe_fun and traceframe_sal are static variables, which are not necessary to me. They are only used in set_traceframe_context, and they are not stateful. This patch is to remove them. gdb: 2013-10-24 Yao Qi <yao@codesourcery.com> * tracepoint.c (traceframe_fun): Remove. (traceframe_sal): Remove. (set_traceframe_context): Add local variables.
2013-10-25Minor coding style fixes in varobj.hJoel Brobecker2-7/+12
No actual code change, just a minor style fix. gdb/ChangeLog: * varobj.h (struct lang_varobj_ops): Remove spaces between '*' and parameter name.
2013-10-25testsuite: Persistent gdbserver cleanupMaciej W. Rozycki3-0/+24
* lib/gdb.exp (gdb_finish): Send a kill request to `gdbserver' if in the persistent mode. * gdb.trace/disconnected-tracing.exp: Reconnect before completion.
2013-10-25Avoid producing broken non-native core filesMaciej W. Rozycki4-4/+15
gdb/ * linux-tdep.c (linux_corefile_thread_callback): Propagate any failure from register information collection. gdb/testsuite/ * lib/gdb.exp (gdb_gcore_cmd): Also handle a "Target does not support core file generation" reply.
2013-10-25Fix ChangeLog typoMaciej W. Rozycki1-1/+1
2013-10-25linux-tdep.c: Remove unused `num_notes' struct memberMaciej W. Rozycki2-4/+7
* linux-tdep.c (linux_corefile_thread_data): Remove `num_notes' member. (linux_corefile_thread_callback): Update accordingly. (linux_make_corefile_notes): Likewise.
2013-10-25Make STARTUP_WITH_SHELL a runtime toggle -- add new "set/show ↵Pedro Alves11-37/+118
startup-with-shell" option. Occasionaly we hear about people having problems with GDB not being able to start programs (with "run"/"start"). GDB spawns a shell to start the program, and most often, it'll be the case that the problem is actually with the user's shell setup. GDB has code to disable the use of the shell to start programs. That's the STARTUP_WITH_SHELL macro that native targets could set to 0 in their nm.h file (though no target actually uses it nowadays). This patch makes that setting a run-time knob instead. This will be useful to quickly diagnose such shell issues, and might also come in handy at other times (such as when debugging the shell itself, if you don't have a different shell handy). gdb/ 2013-10-24 Pedro Alves <palves@redhat.com> * NEWS (New options): Mention set/show startup-with-shell. * config/alpha/nm-osf3.h (START_INFERIOR_TRAPS_EXPECTED): Set to 2 instead of 3. * fork-child.c (fork_inferior, startup_inferior): Handle 'set startup-with-shell'. (show_startup_with_shell): New function. (_initialize_fork_child): Register the set/show startup-with-shell commands. * inf-ptrace.c (inf_ptrace_create_inferior): Remove comment. * inf-ttrace.c (inf_ttrace_him): Remove comment. * procfs.c (procfs_init_inferior): Remove comment. * infcmd.c (startup_with_shell): New global. * inferior.h (startup_with_shell): Declare global. (STARTUP_WITH_SHELL): Delete. (START_INFERIOR_TRAPS_EXPECTED): Set to 1 by default instead of 2. gdb/doc/ 2013-10-24 Pedro Alves <palves@redhat.com> * gdb.texinfo (Starting): Document set/show startup-with-shell.
2013-10-25infrun debug output: print enum gdb_signal symbol names instead of POSIX ↵Pedro Alves5-9/+40
signal names. The other day while debugging something related to random signals, I got confused with "set debug infrun 1" output, for it said: infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x323d4e8b94 infrun: random signal 20 On GNU/Linux, 20 is SIGTSTP. For some reason, it took me a few minutes to realize that 20 is actually a GDB signal number, not a target signal number (duh!). In any case, I propose making GDB's output clearer here: One way would be to use gdb_signal_to_name, like already used elsewhere: infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x323d4e8b94 infrun: random signal SIGCHLD (20) but I think that might confuse someone too ("20? Why does GDB believe SIGCHLD is 20?"). So I thought of printing the enum string instead: infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x323d4e8b94 infrun: random signal GDB_SIGNAL_CHLD (20) Looking at a more complete infrun debug log, we had actually printed the (POSIX) signal name name a bit before: infrun: target_wait (-1, status) = infrun: 9300 [Thread 0x7ffff7fcb740 (LWP 9300)], infrun: status->kind = stopped, signal = SIGCHLD ... infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x323d4e8b94 infrun: random signal 20 So I'm now thinking that it'd be even better to make infrun output consistently use the enum symbol string, like so: infrun: clear_proceed_status_thread (Thread 0x7ffff7fca700 (LWP 25663)) infrun: clear_proceed_status_thread (Thread 0x7ffff7fcb740 (LWP 25659)) - infrun: proceed (addr=0xffffffffffffffff, signal=144, step=1) + infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT, step=1) - infrun: resume (step=1, signal=0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 25659)] at 0x400700 + infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 25659)] at 0x400700 infrun: wait_for_inferior () infrun: target_wait (-1, status) = infrun: 25659 [Thread 0x7ffff7fcb740 (LWP 25659)], - infrun: status->kind = stopped, signal = SIGCHLD + infrun: status->kind = stopped, signal = GDB_SIGNAL_CHLD infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400700 - infrun: random signal 20 + infrun: random signal (GDB_SIGNAL_CHLD) infrun: random signal, keep going - infrun: resume (step=1, signal=20), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 25659)] at 0x400700 + infrun: resume (step=1, signal=GDB_SIGNAL_CHLD), trap_expected=0, current thread [Thread 0x7ffff7fcb740 (LWP 25659)] at 0x400700 infrun: prepare_to_wait infrun: target_wait (-1, status) = infrun: 25659 [Thread 0x7ffff7fcb740 (LWP 25659)], - infrun: status->kind = stopped, signal = SIGTRAP + infrun: status->kind = stopped, signal = GDB_SIGNAL_TRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x400704 infrun: stepi/nexti infrun: stop_stepping GDB's signal numbers are public and hardcoded (see include/gdb/signals.h), so there's really no need to clutter the output with numeric values in some places while others not. Replacing the magic "144" with GDB_SIGNAL_DEFAULT in "proceed"'s debug output (see above) I think is quite nice. I posit that all this makes it clearer to newcomers that GDB has its own signal numbering (and that there must be some mapping going on). Tested on x86_64 Fedora 17. gdb/ 2013-10-23 Pedro Alves <palves@redhat.com> * common/gdb_signals.h (gdb_signal_to_symbol_string): Declare. * common/signals.c: Include "gdb_assert.h". (signals): New field 'symbol'. (SET): Use the 'symbol' parameter. (gdb_signal_to_symbol_string): New function. * infrun.c (handle_inferior_event) <random signal>: In debug output, print the random signal enum as string in addition to its number. * target/waitstatus.c (target_waitstatus_to_string): Print the signal's enum value as string instead of the (POSIX) signal name.
2013-10-25Fix off-by-one errors in *scanf format strings.Gary Benson2-25/+54
In the first hunk, the format string was off-by-one for cmd, and cmd itself was larger than the maximum size required. cmd was reduced in size and the format string adjusted. In the second hunk, the format string was off-by-one for local_address, remote_address and extra, although the buffers for the two addresses were large enough for this not to matter. The specifiers for the two addresses was corrected, and a number of unused variables including extra were suppressed from parsing. In the third hunk, the format string was off-by-one for name, dependencies and status. This code was rewritten using strtok since dependencies can be arbitrarily long. gdb/ 2013-10-23 Gary Benson <gbenson@redhat.com> PR 16013 * common/linux-osdata.c (command_from_pid): Reduced size of cmd from 32 to 18. Adjusted fscanf format string accordingly. (Avoids leaving cmd unterminated.) (print_sockets): Do not parse tlen, inode, sl, timeout, txq, rxq, trun, retn or extra. (Avoids leaving extra unterminated.) Check that local_address and remote_address will not overflow. (linux_xfer_osdata_modules): Parse lines using strtok to avoid leaving dependencies unterminated. Parse size as "%u" to match definition.
2013-10-25Remove dead sets/clears of ecs->random signal.Pedro Alves2-9/+5
'*ecs' is always memset by handle_inferior_event's callers, so all these clears are unnecessary. There's one place that sets the flag to true, but, afterwards, before ecs->random_signal is ever read, we reach the part of handle_inferior_even that clears ecs->random_signal, among other things: clear_stop_func (ecs); ecs->event_thread->stepping_over_breakpoint = 0; bpstat_clear (&ecs->event_thread->control.stop_bpstat); ecs->event_thread->control.stop_step = 0; stop_print_frame = 1; ecs->random_signal = 0; stopped_by_random_signal = 0; So all these ecs->random_signal accesses are dead code. Tested on x86_64 Fedora 17. gdb/ 2013-10-22 Pedro Alves <palves@redhat.com> * infrun.c (handle_inferior_event) <thread hop>: Don't clear or set ecs->random signal.
2013-10-25Add missing ChangeLog entries for previous commits.Pedro Alves1-0/+23
2013-10-25infrun.c:keep_going: update comments.Pedro Alves1-35/+31
This function still has comments referring back to when it was a goto label in wait_for_inferior, eons ago. Looking closer, actually most of its comments could use a facelift (contents/formatting/typos). That's what this patch does. gdb/ 2013-10-22 Pedro Alves <palves@redhat.com> * infrun.c (keep_going): Update comments.
2013-10-25remote: Map invalid signal numbers to GDB_SIGNAL_UNKNOWN.Pedro Alves1-4/+14
I realized that remote.c is not validating input here. Currently, if a remote stub sends in an invalid signal number (or put another way, if a future stub sends a new signal an old GDB doesn't know about), GDB will do out of bounds accesses in the signal_pass/signal_stop/signal_program arrays. It'll probably be a long while before we add another signal number (and buggy stubs should just be fixed), but can't hurt to be defensive. Tested on x86_64 Fedora 17, native gdbserver. gdb/ 2013-10-22 Pedro Alves <palves@redhat.com> * remote.c (remote_parse_stop_reply) <'T'/'S'/'X' replies>: Map invalid signal numbers to GDB_SIGNAL_UNKNOWN.
2013-10-25Fix up a couple oddities in GDB's signal names and strings.Pedro Alves2-18/+18
- The Mach exception/signals escaped the TARGET_ -> GDB_ prefix change done a while ago, but there's no real reason for that. I grepped for TARGET_EXC and fixed all found, which unsurprisingly, means darwin-nat.c needed fixing. I think the change there is as obvious and trivial as it can get, so I'd be quite surprised if this broke anything there somehow. - GDB_SIGNAL_LAST's description string was unnecessarily inconsistent with the enum name. Built on x86_64 Fedora 17. gdb/ 2013-10-22 Pedro Alves <palves@redhat.com> * include/gdb/signals.def (TARGET_EXC_BAD_ACCESS): Rename to GDB_EXC_BAD_ACCESS. (TARGET_EXC_BAD_INSTRUCTION): Rename to GDB_EXC_BAD_INSTRUCTION. (TARGET_EXC_ARITHMETIC): Rename to GDB_EXC_ARITHMETIC. (TARGET_EXC_EMULATION): Rename to GDB_EXC_EMULATION. (TARGET_EXC_SOFTWARE): Rename to GDB_EXC_SOFTWARE. (TARGET_EXC_BREAKPOINT): Rename to GDB_EXC_BREAKPOINT. (GDB_SIGNAL_LAST): Change description string. * common/signals.c (gdb_signal_from_host, do_gdb_signal_to_host): Adjust to signal renaming. * darwin-nat.c (darwin_decode_message): Likewise.
2013-10-252013-10-22 Jose E. Marchesi <jose.marchesi@oracle.com>Jose E. Marchesi2-0/+5
* MAINTAINERS (Write After Approval): Add myself to the list.
2013-10-25fix ARI for git migrationTom Tromey1-0/+5
This fixes the ARI script for the git migration. * contrib/ari/create-web-ari-in-src.sh: Update for git.
2013-10-25fix CONTRIBUTE for git migrationTom Tromey1-7/+7
This fixes gdb's CONTRIBUTE file for the git migration. * CONTRIBUTE: Update for git.
2013-10-212013-10-21 Jose E. Marchesi <jose.marchesi@oracle.com>Jose E. Marchesi3-3/+16
PR gdb/15986 * gdb.base/run.c (main): gdb_get_line_number tag added for commands.exp. (factorial): Likewise. * gdb.base/commands.exp (watchpoint_command_test): Use gdb_get_line_number in order to determine the locations in run.c where local_var is detected to go out of scope.