public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Multi-Task Procs in the SourceWindow
@ 2006-10-04 16:15 Mike Cvet
  2006-10-10  1:47 ` Yao Qi
  2006-10-16 11:52 ` Mark Wielaard
  0 siblings, 2 replies; 9+ messages in thread
From: Mike Cvet @ 2006-10-04 16:15 UTC (permalink / raw)
  To: frysk

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

I've just committed a large patch which allows the SourceWindow to
handle processes with multiple threads. That is, it properly blocks and
unblocks them, and if the source code is available, should display the
source from each thread and highlight the appropriate lines properly.

Thanks to Tom's idea, it uses a TreeView widget to list each thread and
their respective frames on the call stack.

I'm pretty sure that bugs exist! If you have some free time and want to
check it out, I've attached an example test program. Please assign any
breakage to me.

- Mike

[-- Attachment #2: tester2.c --]
[-- Type: text/x-csrc, Size: 832 bytes --]

// gcc -g -o test -lpthread tester2.c

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>


pthread_t tester_thread;

pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;

void
*do_it ()
{
  int t = 34543;
  while (t > 0)
    t--;

  fprintf (stderr,"tester_thread: looping\n");

  while (1);
    
  return NULL;
}

void
bak ()
{
  while (1)
    {
      fprintf (stderr,"main: looping\n");
      while (1);
    }
}

void 
baz ()
{
  int a;
  int b = 0;
  bak ();
}

void 
bar ()
{
  close (-1);
  close (-1);
  baz ();
  /*Comment */
}

void
foo ()
{
  bar ();
}


int main (char **argv, int argc)
{
  pthread_attr_t attr;
  pthread_attr_init (&attr);
  pthread_create (&tester_thread, &attr, do_it, NULL);

  /* This is a comment */
  foo ();
  int t = 30;

  exit (0);
}






^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multi-Task Procs in the SourceWindow
  2006-10-04 16:15 Multi-Task Procs in the SourceWindow Mike Cvet
@ 2006-10-10  1:47 ` Yao Qi
  2006-10-10 19:13   ` Andrew Cagney
  2006-10-10 20:26   ` Mike Cvet
  2006-10-16 11:52 ` Mark Wielaard
  1 sibling, 2 replies; 9+ messages in thread
From: Yao Qi @ 2006-10-10  1:47 UTC (permalink / raw)
  To: frysk

On Wed, Oct 04, 2006 at 12:18:00PM -0400, Mike Cvet wrote:
> I've just committed a large patch which allows the SourceWindow to
> handle processes with multiple threads. That is, it properly blocks and
> unblocks them, and if the source code is available, should display the
> source from each thread and highlight the appropriate lines properly.
> 
> Thanks to Tom's idea, it uses a TreeView widget to list each thread and
> their respective frames on the call stack.
> 
> I'm pretty sure that bugs exist! If you have some free time and want to
> check it out, I've attached an example test program. Please assign any
> breakage to me.
Hi, Mike,
I run it with the example in the attachment, and the SourceWindow
works fine to me(on x86 rawhide).  Thanks!

Here are some points that we could improve,
1) If we click one frame in StackWindow, appropriate lines are
highlighted, but the SourceWindow do *not* adjust the content in it to
display the highlighted lines, and always display source code from
line #1.  Could we make SourceWindow to refresh, and display the
highlighted lines in the middle of SourceWindows, when we click on frame?

2) When I click one frame, there are multiple lines are highlighted.
For example, If I click "baz" in StackWindow, line #42, #50, and #57
are highlighted at the same time.  Is it expected?  IMO, we could only
highlight the *current* frame, instead of call tree, which has been
displayed in StackWindow.

3) Multiple source file is not support.
If I put do_it() in tester1.c, and compile the test like this,
$ gcc -g tester1.c tester2.c -o test -lpthread

and then fire frysk, we could find do_it() in StackWindow, and the
line number is #11(the correct line number), but line #11 in tester2.c
is highlighted, instead of line #11 in teser1.c.

-- 
Yao Qi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multi-Task Procs in the SourceWindow
  2006-10-10  1:47 ` Yao Qi
@ 2006-10-10 19:13   ` Andrew Cagney
  2006-10-10 19:46     ` Rick Moseley
  2006-10-10 20:26   ` Mike Cvet
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Cagney @ 2006-10-10 19:13 UTC (permalink / raw)
  To: frysk

Yao Qi wrote:
> On Wed, Oct 04, 2006 at 12:18:00PM -0400, Mike Cvet wrote:
>   
>> I've just committed a large patch which allows the SourceWindow to
>> handle processes with multiple threads. That is, it properly blocks and
>> unblocks them, and if the source code is available, should display the
>> source from each thread and highlight the appropriate lines properly.
>>
>> Thanks to Tom's idea, it uses a TreeView widget to list each thread and
>> their respective frames on the call stack.
>>
>> I'm pretty sure that bugs exist! If you have some free time and want to
>> check it out, I've attached an example test program. Please assign any
>> breakage to me.
>>     
> Hi, Mike,
> I run it with the example in the attachment, and the SourceWindow
> works fine to me(on x86 rawhide).  Thanks!
>
> Here are some points that we could improve,
> 1) If we click one frame in StackWindow, appropriate lines are
> highlighted, but the SourceWindow do *not* adjust the content in it to
> display the highlighted lines, and always display source code from
> line #1.  Could we make SourceWindow to refresh, and display the
> highlighted lines in the middle of SourceWindows, when we click on frame?
>
>   
Yes, bug :-)
> 2) When I click one frame, there are multiple lines are highlighted.
> For example, If I click "baz" in StackWindow, line #42, #50, and #57
> are highlighted at the same time.  Is it expected?  IMO, we could only
> highlight the *current* frame, instead of call tree, which has been
> displayed in StackWindow.
>
>   
Yes, agreed.
> 3) Multiple source file is not support.
> If I put do_it() in tester1.c, and compile the test like this,
> $ gcc -g tester1.c tester2.c -o test -lpthread
>
> and then fire frysk, we could find do_it() in StackWindow, and the
> line number is #11(the correct line number), but line #11 in tester2.c
> is highlighted, instead of line #11 in teser1.c.
>
>   

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multi-Task Procs in the SourceWindow
  2006-10-10 19:13   ` Andrew Cagney
@ 2006-10-10 19:46     ` Rick Moseley
  0 siblings, 0 replies; 9+ messages in thread
From: Rick Moseley @ 2006-10-10 19:46 UTC (permalink / raw)
  To: frysk

Andrew Cagney wrote:
> Yao Qi wrote:
>> On Wed, Oct 04, 2006 at 12:18:00PM -0400, Mike Cvet wrote:
>>  
>>> I've just committed a large patch which allows the SourceWindow to
>>> handle processes with multiple threads. That is, it properly blocks and
>>> unblocks them, and if the source code is available, should display the
>>> source from each thread and highlight the appropriate lines properly.
>>>
>>> Thanks to Tom's idea, it uses a TreeView widget to list each thread and
>>> their respective frames on the call stack.
>>>
>>> I'm pretty sure that bugs exist! If you have some free time and want to
>>> check it out, I've attached an example test program. Please assign any
>>> breakage to me.
>>>     
>> Hi, Mike,
>> I run it with the example in the attachment, and the SourceWindow
>> works fine to me(on x86 rawhide).  Thanks!
>>
>> Here are some points that we could improve,
>> 1) If we click one frame in StackWindow, appropriate lines are
>> highlighted, but the SourceWindow do *not* adjust the content in it to
>> display the highlighted lines, and always display source code from
>> line #1.  Could we make SourceWindow to refresh, and display the
>> highlighted lines in the middle of SourceWindows, when we click on 
>> frame?
>>
>>   
> Yes, bug :-)
>> 2) When I click one frame, there are multiple lines are highlighted.
>> For example, If I click "baz" in StackWindow, line #42, #50, and #57
>> are highlighted at the same time.  Is it expected?  IMO, we could only
>> highlight the *current* frame, instead of call tree, which has been
>> displayed in StackWindow.
>>
>>   
> Yes, agreed.
>> 3) Multiple source file is not support.
>> If I put do_it() in tester1.c, and compile the test like this,
>> $ gcc -g tester1.c tester2.c -o test -lpthread
>>
>> and then fire frysk, we could find do_it() in StackWindow, and the
>> line number is #11(the correct line number), but line #11 in tester2.c
>> is highlighted, instead of line #11 in teser1.c.
There are other issues with the stack frame window already reported in 
bz #3327.  I have added your suggestions/bugs on to that bug and added 
Yao to the CC list.

Rick
>>
>>   
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multi-Task Procs in the SourceWindow
  2006-10-10  1:47 ` Yao Qi
  2006-10-10 19:13   ` Andrew Cagney
@ 2006-10-10 20:26   ` Mike Cvet
  2006-10-16 11:59     ` Mark Wielaard
  1 sibling, 1 reply; 9+ messages in thread
From: Mike Cvet @ 2006-10-10 20:26 UTC (permalink / raw)
  To: Yao Qi; +Cc: frysk

On Tue, 2006-10-10 at 09:46 +0800, Yao Qi wrote:
> On Wed, Oct 04, 2006 at 12:18:00PM -0400, Mike Cvet wrote:
> > I've just committed a large patch which allows the SourceWindow to
> > handle processes with multiple threads. That is, it properly blocks and
> > unblocks them, and if the source code is available, should display the
> > source from each thread and highlight the appropriate lines properly.
> > 
> > Thanks to Tom's idea, it uses a TreeView widget to list each thread and
> > their respective frames on the call stack.
> > 
> > I'm pretty sure that bugs exist! If you have some free time and want to
> > check it out, I've attached an example test program. Please assign any
> > breakage to me.
> Hi, Mike,
> I run it with the example in the attachment, and the SourceWindow
> works fine to me(on x86 rawhide).  Thanks!
> 
> Here are some points that we could improve,
> 1) If we click one frame in StackWindow, appropriate lines are
> highlighted, but the SourceWindow do *not* adjust the content in it to
> display the highlighted lines, and always display source code from
> line #1.  Could we make SourceWindow to refresh, and display the
> highlighted lines in the middle of SourceWindows, when we click on frame?

I've been meaning to get around to this one.

> 
> 2) When I click one frame, there are multiple lines are highlighted.
> For example, If I click "baz" in StackWindow, line #42, #50, and #57
> are highlighted at the same time.  Is it expected?  IMO, we could only
> highlight the *current* frame, instead of call tree, which has been
> displayed in StackWindow.

Yeah, I was wondering about this one myself. I *could* see usefulness
for this, but more often than not its probably confusing. I'll get rid
of it for now

> 
> 3) Multiple source file is not support.
> If I put do_it() in tester1.c, and compile the test like this,
> $ gcc -g tester1.c tester2.c -o test -lpthread
> 
> and then fire frysk, we could find do_it() in StackWindow, and the
> line number is #11(the correct line number), but line #11 in tester2.c
> is highlighted, instead of line #11 in teser1.c.
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multi-Task Procs in the SourceWindow
  2006-10-04 16:15 Multi-Task Procs in the SourceWindow Mike Cvet
  2006-10-10  1:47 ` Yao Qi
@ 2006-10-16 11:52 ` Mark Wielaard
  2006-10-16 13:43   ` Mike Cvet
  1 sibling, 1 reply; 9+ messages in thread
From: Mark Wielaard @ 2006-10-16 11:52 UTC (permalink / raw)
  To: Mike Cvet; +Cc: frysk

Hi Mike,

On Wed, 2006-10-04 at 12:18 -0400, Mike Cvet wrote:
> I've just committed a large patch which allows the SourceWindow to
> handle processes with multiple threads. That is, it properly blocks and
> unblocks them, and if the source code is available, should display the
> source from each thread and highlight the appropriate lines properly.
> 
> Thanks to Tom's idea, it uses a TreeView widget to list each thread and
> their respective frames on the call stack.
> 
> I'm pretty sure that bugs exist! If you have some free time and want to
> check it out, I've attached an example test program.

Finally played with this. Very cool!

The TreeView for the stacks is nice and compact. But I was wondering how
to present stepping in this view (the InstructionObserver should give
you the basics for the asm-step operation). Do we need a step-one-thread
vs step-all-threads button? Or would that just add to the confusion?

Cheers,

Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multi-Task Procs in the SourceWindow
  2006-10-10 20:26   ` Mike Cvet
@ 2006-10-16 11:59     ` Mark Wielaard
  2006-10-16 13:45       ` Mike Cvet
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Wielaard @ 2006-10-16 11:59 UTC (permalink / raw)
  To: Mike Cvet; +Cc: Yao Qi, frysk

On Tue, 2006-10-10 at 16:26 -0400, Mike Cvet wrote:
> On Tue, 2006-10-10 at 09:46 +0800, Yao Qi wrote:
> > 2) When I click one frame, there are multiple lines are highlighted.
> > For example, If I click "baz" in StackWindow, line #42, #50, and #57
> > are highlighted at the same time.  Is it expected?  IMO, we could only
> > highlight the *current* frame, instead of call tree, which has been
> > displayed in StackWindow.
> 
> Yeah, I was wondering about this one myself. I *could* see usefulness
> for this, but more often than not its probably confusing. I'll get rid
> of it for now

It would be cool to show arrows to visualize the whole call stack in the
current source file. But that is probably not trivial to implement. But
maybe highlight the current selected frame brightly, and highlight the
other frames in the call stack dimmed out/grayed?

Cheers,

Mark

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multi-Task Procs in the SourceWindow
  2006-10-16 11:52 ` Mark Wielaard
@ 2006-10-16 13:43   ` Mike Cvet
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Cvet @ 2006-10-16 13:43 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: frysk

On Mon, 2006-10-16 at 13:51 +0200, Mark Wielaard wrote:
> Finally played with this. Very cool!
> 

Thanks!

> The TreeView for the stacks is nice and compact. But I was wondering how
> to present stepping in this view (the InstructionObserver should give
> you the basics for the asm-step operation). Do we need a step-one-thread
> vs step-all-threads button? Or would that just add to the confusion?

Nope, that's exactly right - I'm trying to figure out the best way to
handle independent step-process and step-thread interfaces. In addition
to the run-process functionality the source window has I'll also need to
make a run-thread interface. 

- Mike

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multi-Task Procs in the SourceWindow
  2006-10-16 11:59     ` Mark Wielaard
@ 2006-10-16 13:45       ` Mike Cvet
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Cvet @ 2006-10-16 13:45 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Yao Qi, frysk

On Mon, 2006-10-16 at 13:58 +0200, Mark Wielaard wrote:
> 
> It would be cool to show arrows to visualize the whole call stack in the
> current source file. But that is probably not trivial to implement. But
> maybe highlight the current selected frame brightly, and highlight the
> other frames in the call stack dimmed out/grayed?

Funny you should mention this - this exact idea has come up in
discussions up here in .to about what to do with the outer frames.
Shading, numbering, different colours...

I'm personally a fan of placing a number in the margin of that frame's
currently executing line matching the number of the frame itself.
Working on figuring out how to do this though.

- Mike

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-10-16 13:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-04 16:15 Multi-Task Procs in the SourceWindow Mike Cvet
2006-10-10  1:47 ` Yao Qi
2006-10-10 19:13   ` Andrew Cagney
2006-10-10 19:46     ` Rick Moseley
2006-10-10 20:26   ` Mike Cvet
2006-10-16 11:59     ` Mark Wielaard
2006-10-16 13:45       ` Mike Cvet
2006-10-16 11:52 ` Mark Wielaard
2006-10-16 13:43   ` Mike Cvet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).