Re: Regression for gdb.trace/backtrace.exp [Re: [PATCH 0/4 v3] Add support for static and SystemTap probes]

Sergio Durigan Junior
2012-04-28T23:59:37Z

On Saturday, April 28 2012, Jan Kratochvil wrote:

> On Mon, 23 Apr 2012 06:53:11 +0200, Sergio Durigan Junior wrote:
>> Regtested on Fedora x86_64, no regressions. Comments are welcome.
>
> -PASS: gdb.trace/backtrace.exp: run trace experiment
> +ERROR: Process no longer exists
> 1786 loc->probe->pops->set_semaphore (loc->probe, loc->gdbarch);
> (gdb) p loc->probe
> $1 = (struct probe *) 0x0
>
> It happens only with gdbserver.

Thanks for catching this. I forgot to check if there is a probe before
setting/clearing the semaphore. This code fixes the problem. I am
committing it under the obvious rule.

Again, thanks for catching.

--
Sergio

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.14185
diff -u -p -r1.14185 ChangeLog
--- gdb/ChangeLog 28 Apr 2012 23:22:11 -0000 1.14185
+++ gdb/ChangeLog 28 Apr 2012 23:58:31 -0000
@@ -1,3 +1,8 @@
+2012-04-28 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * tracepoint.c (start_tracing, stop_tracing): Checking for NULL
+ probes, fixing a regression inserted by my previous patchset.
+
2012-04-28 Doug Evans <dje@google.com>

Initial support for Fission. http://gcc.gnu.org/wiki/DebugFission
Index: gdb/tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.253
diff -u -p -r1.253 tracepoint.c
--- gdb/tracepoint.c 27 Apr 2012 20:47:56 -0000 1.253
+++ gdb/tracepoint.c 28 Apr 2012 23:58:31 -0000
@@ -1783,7 +1783,8 @@ start_tracing (char *notes)
t->number_on_target = b->number;

for (loc = b->loc; loc; loc = loc->next)
- loc->probe->pops->set_semaphore (loc->probe, loc->gdbarch);
+ if (loc->probe != NULL)
+ loc->probe->pops->set_semaphore (loc->probe, loc->gdbarch);
}
VEC_free (breakpoint_p, tp_vec);

@@ -1878,7 +1879,8 @@ stop_tracing (char *note)
but we don't really care if this semaphore goes out of sync.
That's why we are decrementing it here, but not taking care
in other places. */
- loc->probe->pops->clear_semaphore (loc->probe, loc->gdbarch);
+ if (loc->probe != NULL)
+ loc->probe->pops->clear_semaphore (loc->probe, loc->gdbarch);
}
}