* threads and target-function-calls
@ 2003-01-08 1:00 Michael Snyder
2003-01-08 1:08 ` Daniel Jacobowitz
2003-01-08 16:18 ` Andrew Cagney
0 siblings, 2 replies; 12+ messages in thread
From: Michael Snyder @ 2003-01-08 1:00 UTC (permalink / raw)
To: gdb-patches
Hey folks,
Did you know that (at least on x86 linux), if you have a multi-thread
program and you execute a target function call, all the threads get to
run? Doesn't that seem like a bad thing? Wouldn't we really rather
only run the thread that is executing the target function call?
Michael
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-08 1:00 threads and target-function-calls Michael Snyder
@ 2003-01-08 1:08 ` Daniel Jacobowitz
2003-01-08 2:49 ` Dan Mosedale
2003-01-09 0:48 ` Michael Snyder
2003-01-08 16:18 ` Andrew Cagney
1 sibling, 2 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2003-01-08 1:08 UTC (permalink / raw)
To: gdb-patches
On Tue, Jan 07, 2003 at 05:00:25PM -0800, Michael Snyder wrote:
> Hey folks,
>
> Did you know that (at least on x86 linux), if you have a multi-thread
> program and you execute a target function call, all the threads get to
> run? Doesn't that seem like a bad thing? Wouldn't we really rather
> only run the thread that is executing the target function call?
Eeeeek! I think I agree with you here; that's the logical behavior.
It never occured to me to try.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-08 1:08 ` Daniel Jacobowitz
@ 2003-01-08 2:49 ` Dan Mosedale
2003-01-08 3:27 ` Daniel Jacobowitz
2003-01-09 0:48 ` Michael Snyder
1 sibling, 1 reply; 12+ messages in thread
From: Dan Mosedale @ 2003-01-08 2:49 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
Daniel Jacobowitz wrote:
>On Tue, Jan 07, 2003 at 05:00:25PM -0800, Michael Snyder wrote:
>
>
>>Hey folks,
>>
>>Did you know that (at least on x86 linux), if you have a multi-thread
>>program and you execute a target function call, all the threads get to
>>run? Doesn't that seem like a bad thing? Wouldn't we really rather
>>only run the thread that is executing the target function call?
>>
>>
>
>Eeeeek! I think I agree with you here; that's the logical behavior.
>It never occured to me to try.
>
What happens if the target function wants to interact with another
thread? e.g. wait on a mutex being held by another thread?
Dan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-08 2:49 ` Dan Mosedale
@ 2003-01-08 3:27 ` Daniel Jacobowitz
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2003-01-08 3:27 UTC (permalink / raw)
To: Dan Mosedale; +Cc: gdb-patches
On Tue, Jan 07, 2003 at 06:49:27PM -0800, Dan Mosedale wrote:
> Daniel Jacobowitz wrote:
>
> >On Tue, Jan 07, 2003 at 05:00:25PM -0800, Michael Snyder wrote:
> >
> >
> >>Hey folks,
> >>
> >>Did you know that (at least on x86 linux), if you have a multi-thread
> >>program and you execute a target function call, all the threads get to
> >>run? Doesn't that seem like a bad thing? Wouldn't we really rather
> >>only run the thread that is executing the target function call?
> >>
> >>
> >
> >Eeeeek! I think I agree with you here; that's the logical behavior.
> >It never occured to me to try.
> >
> What happens if the target function wants to interact with another
> thread? e.g. wait on a mutex being held by another thread?
It'll deadlock; the user will Control-C; then he can either use
"return" to cancel the call, or free the mutex himself, or whatever.
Letting all threads just resume what they were doing doesn't seem to
make sense in general...
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-08 1:08 ` Daniel Jacobowitz
2003-01-08 2:49 ` Dan Mosedale
@ 2003-01-09 0:48 ` Michael Snyder
2003-01-09 1:51 ` Daniel Jacobowitz
1 sibling, 1 reply; 12+ messages in thread
From: Michael Snyder @ 2003-01-09 0:48 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
Daniel Jacobowitz wrote:
>
> On Tue, Jan 07, 2003 at 05:00:25PM -0800, Michael Snyder wrote:
> > Hey folks,
> >
> > Did you know that (at least on x86 linux), if you have a multi-thread
> > program and you execute a target function call, all the threads get to
> > run? Doesn't that seem like a bad thing? Wouldn't we really rather
> > only run the thread that is executing the target function call?
>
> Eeeeek! I think I agree with you here; that's the logical behavior.
> It never occured to me to try.
I just happened to have "debug lin-lwp" turned on.
Perhaps we need to think about what "target function call"
actually means in the presence of threads that can interact
with each other.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-09 0:48 ` Michael Snyder
@ 2003-01-09 1:51 ` Daniel Jacobowitz
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2003-01-09 1:51 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
On Wed, Jan 08, 2003 at 04:48:35PM -0800, Michael Snyder wrote:
> Daniel Jacobowitz wrote:
> >
> > On Tue, Jan 07, 2003 at 05:00:25PM -0800, Michael Snyder wrote:
> > > Hey folks,
> > >
> > > Did you know that (at least on x86 linux), if you have a multi-thread
> > > program and you execute a target function call, all the threads get to
> > > run? Doesn't that seem like a bad thing? Wouldn't we really rather
> > > only run the thread that is executing the target function call?
> >
> > Eeeeek! I think I agree with you here; that's the logical behavior.
> > It never occured to me to try.
>
> I just happened to have "debug lin-lwp" turned on.
>
> Perhaps we need to think about what "target function call"
> actually means in the presence of threads that can interact
> with each other.
Yeah. My biggest concern is an interface one. What the heck _should_
happen? And how do we present it to the user?
[On an interesting side note, another debugger developer mentioned to
me that their product supports conditional breakpoints by inserting
code into the inferior. That'd be nice to do some day... but we don't
really have the architecture for it right now...]
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-08 1:00 threads and target-function-calls Michael Snyder
2003-01-08 1:08 ` Daniel Jacobowitz
@ 2003-01-08 16:18 ` Andrew Cagney
2003-01-08 16:32 ` Daniel Jacobowitz
2003-01-09 0:47 ` Michael Snyder
1 sibling, 2 replies; 12+ messages in thread
From: Andrew Cagney @ 2003-01-08 16:18 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
> Hey folks,
>
> Did you know that (at least on x86 linux), if you have a multi-thread
> program and you execute a target function call, all the threads get to
> run? Doesn't that seem like a bad thing? Wouldn't we really rather
> only run the thread that is executing the target function call?
Ha! That's just the start. Doing nested inferior function calls on
alternative threads scrables the dummy frame cache:
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=468
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-08 16:18 ` Andrew Cagney
@ 2003-01-08 16:32 ` Daniel Jacobowitz
2003-01-09 0:47 ` Michael Snyder
1 sibling, 0 replies; 12+ messages in thread
From: Daniel Jacobowitz @ 2003-01-08 16:32 UTC (permalink / raw)
To: gdb-patches
On Wed, Jan 08, 2003 at 11:17:45AM -0500, Andrew Cagney wrote:
> >Hey folks,
> >
> >Did you know that (at least on x86 linux), if you have a multi-thread
> >program and you execute a target function call, all the threads get to
> >run? Doesn't that seem like a bad thing? Wouldn't we really rather
> >only run the thread that is executing the target function call?
>
> Ha! That's just the start. Doing nested inferior function calls on
> alternative threads scrables the dummy frame cache:
> http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=468
Oh, lord. That's going to take some serious fixing.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-08 16:18 ` Andrew Cagney
2003-01-08 16:32 ` Daniel Jacobowitz
@ 2003-01-09 0:47 ` Michael Snyder
2003-01-09 0:56 ` Michael Snyder
1 sibling, 1 reply; 12+ messages in thread
From: Michael Snyder @ 2003-01-09 0:47 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew Cagney wrote:
>
> > Hey folks,
> >
> > Did you know that (at least on x86 linux), if you have a multi-thread
> > program and you execute a target function call, all the threads get to
> > run? Doesn't that seem like a bad thing? Wouldn't we really rather
> > only run the thread that is executing the target function call?
>
> Ha! That's just the start. Doing nested inferior function calls on
> alternative threads scrables the dummy frame cache:
> http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=468
But... that's just sick. ;-(
Wait -- you can't do that. It isn't meaningful to change threads
and then continue/whatever. It assumes gdb has more control over
scheduling than it actually has.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-09 0:47 ` Michael Snyder
@ 2003-01-09 0:56 ` Michael Snyder
2003-01-09 1:05 ` Andrew Cagney
0 siblings, 1 reply; 12+ messages in thread
From: Michael Snyder @ 2003-01-09 0:56 UTC (permalink / raw)
To: Andrew Cagney, gdb-patches
Michael Snyder wrote:
>
> Andrew Cagney wrote:
> >
> > > Hey folks,
> > >
> > > Did you know that (at least on x86 linux), if you have a multi-thread
> > > program and you execute a target function call, all the threads get to
> > > run? Doesn't that seem like a bad thing? Wouldn't we really rather
> > > only run the thread that is executing the target function call?
> >
> > Ha! That's just the start. Doing nested inferior function calls on
> > alternative threads scrables the dummy frame cache:
> > http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=468
>
> But... that's just sick. ;-(
> Wait -- you can't do that. It isn't meaningful to change threads
> and then continue/whatever. It assumes gdb has more control over
> scheduling than it actually has.
Oh, I think I misunderstood. You have in mind this:
(gdb) print foo()
[switching thread to xyz]
Breakpoint 2 in foo ()
(gdb) print bar()
not this:
(gdb) print foo ()
breakpoint 2 in foo()
(gdb) thread xyz
(gdb) print bar()
right?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-09 0:56 ` Michael Snyder
@ 2003-01-09 1:05 ` Andrew Cagney
2003-01-15 19:39 ` Michael Snyder
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Cagney @ 2003-01-09 1:05 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
> Michael Snyder wrote:
>
>>
>> Andrew Cagney wrote:
>
>> >
>
>> > > Hey folks,
>> > >
>> > > Did you know that (at least on x86 linux), if you have a multi-thread
>> > > program and you execute a target function call, all the threads get to
>> > > run? Doesn't that seem like a bad thing? Wouldn't we really rather
>> > > only run the thread that is executing the target function call?
>
>> >
>> > Ha! That's just the start. Doing nested inferior function calls on
>> > alternative threads scrables the dummy frame cache:
>> > http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=468
>
>>
>> But... that's just sick. ;-(
>> Wait -- you can't do that. It isn't meaningful to change threads
>> and then continue/whatever. It assumes gdb has more control over
>> scheduling than it actually has.
>
>
> Oh, I think I misunderstood. You have in mind this:
> (gdb) print foo()
> [switching thread to xyz]
> Breakpoint 2 in foo ()
> (gdb) print bar()
>
> not this:
> (gdb) print foo ()
> breakpoint 2 in foo()
> (gdb) thread xyz
> (gdb) print bar()
>
> right?
Either. Or even things like:
(gdb) print foo()
[new thread xyx]
Thread xyz hit breakpoint 2 in foo()
(gdb) print bar()
(there was talk of trying to only allow one thread to run).
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: threads and target-function-calls
2003-01-09 1:05 ` Andrew Cagney
@ 2003-01-15 19:39 ` Michael Snyder
0 siblings, 0 replies; 12+ messages in thread
From: Michael Snyder @ 2003-01-15 19:39 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew Cagney wrote:
>
> > Michael Snyder wrote:
> >
> >>
> >> Andrew Cagney wrote:
> >
> >> >
> >
> >> > > Hey folks,
> >> > >
> >> > > Did you know that (at least on x86 linux), if you have a multi-thread
> >> > > program and you execute a target function call, all the threads get to
> >> > > run? Doesn't that seem like a bad thing? Wouldn't we really rather
> >> > > only run the thread that is executing the target function call?
> >
> >> >
> >> > Ha! That's just the start. Doing nested inferior function calls on
> >> > alternative threads scrables the dummy frame cache:
> >> > http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=468
> >
> >>
> >> But... that's just sick. ;-(
> >> Wait -- you can't do that. It isn't meaningful to change threads
> >> and then continue/whatever. It assumes gdb has more control over
> >> scheduling than it actually has.
> >
> >
> > Oh, I think I misunderstood. You have in mind this:
> > (gdb) print foo()
> > [switching thread to xyz]
> > Breakpoint 2 in foo ()
> > (gdb) print bar()
> >
> > not this:
> > (gdb) print foo ()
> > breakpoint 2 in foo()
> > (gdb) thread xyz
> > (gdb) print bar()
> >
> > right?
>
> Either.
OK, well, the second should not be a concern, because
prepare_to_proceed is supposed to switch us back to the
event thread before we resume.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2003-01-15 19:39 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-08 1:00 threads and target-function-calls Michael Snyder
2003-01-08 1:08 ` Daniel Jacobowitz
2003-01-08 2:49 ` Dan Mosedale
2003-01-08 3:27 ` Daniel Jacobowitz
2003-01-09 0:48 ` Michael Snyder
2003-01-09 1:51 ` Daniel Jacobowitz
2003-01-08 16:18 ` Andrew Cagney
2003-01-08 16:32 ` Daniel Jacobowitz
2003-01-09 0:47 ` Michael Snyder
2003-01-09 0:56 ` Michael Snyder
2003-01-09 1:05 ` Andrew Cagney
2003-01-15 19:39 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox