Re: ttrace: Protocal error

John David Anglin
2008-08-09T18:49:03Z

[-- Attachment #1: Type: text/plain, Size: 1661 bytes --]

On Sat, 09 Aug 2008, Pedro Alves wrote:

> If you were really in a TARGET_WAITKIND_SYSCALL_ENTRY, this would be
> at least the second resume after the lwp exit.
> Maybe I am reading the backtrace wrong though. If you have the patience,
> showing what GDB outputs when you do a "run" after setting
> "set debug infrun 1" would help.

Attached.

Ignoring protocol errors seems to work. Used the following. Note
there is a conflict with your change.

Index: inf-ttrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ttrace.c,v
retrieving revision 1.30
diff -u -3 -p -r1.30 inf-ttrace.c
--- inf-ttrace.c 9 Jul 2008 22:23:05 -0000 1.30
+++ inf-ttrace.c 9 Aug 2008 18:35:51 -0000
@@ -787,12 +804,16 @@ inf_ttrace_kill (void)
static int
inf_ttrace_resume_callback (struct thread_info *info, void *arg)
{
- if (!ptid_equal (info->ptid, inferior_ptid))
+ /* There is a race condition in detecting when a thread is stopped.
+ So, we need to resume "dying" threads and ignore protocol errors
+ that occur from resuming threads that aren't stopped. */
+ if (!ptid_equal (info->ptid, inferior_ptid) && !is_exited (info->ptid))
{
pid_t pid = ptid_get_pid (info->ptid);
lwpid_t lwpid = ptid_get_lwp (info->ptid);

- if (ttrace (TT_LWP_CONTINUE, pid, lwpid, TT_NOPC, 0, 0) == -1)
+ if (ttrace (TT_LWP_CONTINUE, pid, lwpid, TT_NOPC, 0, 0) == -1
+ && errno != EPROTO)
perror_with_name (("ttrace"));
}

Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)

[-- Attachment #2: vla6.dbg.2 --]
[-- Type: text/plain, Size: 1427 bytes --]

(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /mnt/gnu/gcc/objdir/hppa2.0w-hp-hpux11.11/libgomp/testsuite/vla6.x3g
infrun: wait_for_inferior (treat_exec_as_sigtrap=1)
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x91d0
infrun: quietly stopped
infrun: stop_stepping
infrun: resume (step=0, signal=0), stepping_over_breakpoint=0
infrun: wait_for_inferior (treat_exec_as_sigtrap=1)
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x19f8
infrun: quietly stopped
infrun: stop_stepping
warning: Private mapping of shared library text was not specified
by the executable; setting a breakpoint in a shared library which
is not privately mapped will not work. See the HP-UX 11i v3 chatr
manpage for methods to privately map shared library text.
infrun: proceed (addr=0xffffffff, signal=0, step=0)
infrun: resume (step=0, signal=0), stepping_over_breakpoint=0
infrun: wait_for_inferior (treat_exec_as_sigtrap=0)
[New process 5170, lwp 7674424]
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_SPURIOUS
infrun: resume (step=0, signal=0), stepping_over_breakpoint=0
infrun: prepare_to_wait
[process 5170, lwp 7674424 exited]
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_SPURIOUS
infrun: resume (step=0, signal=0), stepping_over_breakpoint=0
0xc00268dc in ?? ()
ttrace: Protocol error.