The GDB 7.8 features are: * Python Scripting - You can now access frame registers from Python scripts. - New attribute 'producer' for gdb.Symtab objects. * New Python-based convenience functions: - $_caller_is(name [, number_of_frames]) - $_caller_matches(regexp [, number_of_frames]) - $_any_caller_is(name [, number_of_frames]) - $_any_caller_matches(regexp [, number_of_frames]) * New commands - queue-signal signal-name-or-number Queue a signal to be delivered to the thread when it is resumed. * On resume, GDB now always passes the signal the program had stopped for to the thread the signal was sent to, even if the user changed threads before resuming. Previously GDB would often (but not always) deliver the signal to the thread that happens to be current at resume time. * Conversely, the "signal" command now consistently delivers the requested signal to the current thread. GDB now asks for confirmation if the program had stopped for a signal and the user switched threads meanwhile. * "breakpoint always-inserted" modes "off" and "auto" merged. Now, when 'breakpoint always-inserted mode' is set to "off", GDB won't remove breakpoints from the target until all threads stop, even in non-stop mode. The "auto" mode has been removed, and "off" is now the default mode. * MI changes - The -list-thread-groups command outputs an exit-code field for inferiors that have exited. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
153 lines
5.3 KiB
Diff
153 lines
5.3 KiB
Diff
Index: gdb-7.8.90.20150125/gdb/linux-nat.c
|
|
===================================================================
|
|
--- gdb-7.8.90.20150125.orig/gdb/linux-nat.c 2015-01-25 08:42:49.381408899 +0100
|
|
+++ gdb-7.8.90.20150125/gdb/linux-nat.c 2015-01-25 08:43:16.378525322 +0100
|
|
@@ -174,6 +174,9 @@ blocked. */
|
|
static struct target_ops *linux_ops;
|
|
static struct target_ops linux_ops_saved;
|
|
|
|
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
|
|
+static pid_t pid_was_stopped;
|
|
+
|
|
/* The method to call, if any, when a new thread is attached. */
|
|
static void (*linux_nat_new_thread) (struct lwp_info *);
|
|
|
|
@@ -924,6 +927,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
|
|
if (debug_linux_nat)
|
|
fprintf_unfiltered (gdb_stdlog,
|
|
"LNPAW: Attaching to a stopped process\n");
|
|
+ pid_was_stopped = ptid_get_pid (ptid);
|
|
|
|
/* The process is definitely stopped. It is in a job control
|
|
stop, unless the kernel predates the TASK_STOPPED /
|
|
@@ -1424,6 +1428,9 @@ get_pending_status (struct lwp_info *lp,
|
|
gdb_signal_to_string (signo));
|
|
}
|
|
|
|
+ if (*status == 0 && ptid_get_pid (lp->ptid) == pid_was_stopped)
|
|
+ *status = W_STOPCODE (SIGSTOP);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -1537,6 +1544,8 @@ linux_nat_detach (struct target_ops *ops
|
|
}
|
|
else
|
|
linux_ops->to_detach (ops, args, from_tty);
|
|
+
|
|
+ pid_was_stopped = 0;
|
|
}
|
|
|
|
/* Resume execution of the inferior process. If STEP is nonzero,
|
|
@@ -1741,6 +1750,14 @@ linux_nat_resume (struct target_ops *ops
|
|
return;
|
|
}
|
|
|
|
+ /* At this point, we are going to resume the inferior and if we
|
|
+ have attached to a stopped process, we no longer should leave
|
|
+ it as stopped if the user detaches. PTID variable has PID set to LWP
|
|
+ while we need to check the real PID here. */
|
|
+
|
|
+ if (!step && lp && pid_was_stopped == ptid_get_pid (lp->ptid))
|
|
+ pid_was_stopped = 0;
|
|
+
|
|
if (resume_many)
|
|
iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
|
|
|
|
@@ -3723,6 +3740,8 @@ linux_nat_mourn_inferior (struct target_
|
|
|
|
/* Let the arch-specific native code know this process is gone. */
|
|
linux_nat_forget_process (pid);
|
|
+
|
|
+ pid_was_stopped = 0;
|
|
}
|
|
|
|
/* Convert a native/host siginfo object, into/from the siginfo in the
|
|
Index: gdb-7.8.90.20150125/gdb/testsuite/gdb.threads/attach-stopped.exp
|
|
===================================================================
|
|
--- gdb-7.8.90.20150125.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2015-01-25 08:42:49.382408903 +0100
|
|
+++ gdb-7.8.90.20150125/gdb/testsuite/gdb.threads/attach-stopped.exp 2015-01-25 08:43:16.379525327 +0100
|
|
@@ -61,7 +61,65 @@ proc corefunc { threadtype } {
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
gdb_load ${binfile}
|
|
|
|
- # Verify that we can attach to the stopped process.
|
|
+ # Verify that we can attach to the process by first giving its
|
|
+ # executable name via the file command, and using attach with the
|
|
+ # process ID.
|
|
+
|
|
+ set test "$threadtype: set file, before attach1 to stopped process"
|
|
+ gdb_test_multiple "file $binfile" "$test" {
|
|
+ -re "Load new symbol table from.*y or n. $" {
|
|
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
|
|
+ "$test (re-read)"
|
|
+ }
|
|
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
|
|
+ pass "$test"
|
|
+ }
|
|
+ }
|
|
+
|
|
+ set test "$threadtype: attach1 to stopped, after setting file"
|
|
+ gdb_test_multiple "attach $testpid" "$test" {
|
|
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
|
|
+ pass "$test"
|
|
+ }
|
|
+ }
|
|
+
|
|
+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
|
|
+ if {[string equal $threadtype threaded]} {
|
|
+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
|
|
+ } else {
|
|
+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
|
|
+ }
|
|
+
|
|
+ # Exit and detach the process.
|
|
+
|
|
+ gdb_exit
|
|
+
|
|
+ # Avoid some race:
|
|
+ sleep 2
|
|
+
|
|
+ if [catch {open /proc/${testpid}/status r} fileid] {
|
|
+ set line2 "NOTFOUND"
|
|
+ } else {
|
|
+ gets $fileid line1;
|
|
+ gets $fileid line2;
|
|
+ close $fileid;
|
|
+ }
|
|
+
|
|
+ set test "$threadtype: attach1, exit leaves process stopped"
|
|
+ if {[string match "*(stopped)*" $line2]} {
|
|
+ pass $test
|
|
+ } else {
|
|
+ fail $test
|
|
+ }
|
|
+
|
|
+ # At this point, the process should still be stopped
|
|
+
|
|
+ gdb_start
|
|
+ gdb_reinitialize_dir $srcdir/$subdir
|
|
+ gdb_load ${binfile}
|
|
+
|
|
+ # Verify that we can attach to the process just by giving the
|
|
+ # process ID.
|
|
|
|
set test "$threadtype: attach2 to stopped, after setting file"
|
|
gdb_test_multiple "attach $testpid" "$test" {
|
|
Index: gdb-7.8.90.20150125/gdb/infrun.c
|
|
===================================================================
|
|
--- gdb-7.8.90.20150125.orig/gdb/infrun.c 2015-01-25 08:42:49.385408916 +0100
|
|
+++ gdb-7.8.90.20150125/gdb/infrun.c 2015-01-25 08:43:16.381525335 +0100
|
|
@@ -600,6 +600,11 @@ holding the child stopped. Try \"set de
|
|
child_pid);
|
|
}
|
|
|
|
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
|
|
+ In this point of code it cannot be 1 as we would not get FORK
|
|
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
|
|
+ We would have to first TARGET_STOP and WAITPID it as with running
|
|
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
|
|
target_detach (NULL, 0);
|
|
}
|
|
|