BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Feature request: Thread Names in Debugger

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical
View previous topic :: View next topic  
Author Message
Roddy Pratt
Guest





PostPosted: Sun Aug 22, 2004 10:14 am    Post subject: Feature request: Thread Names in Debugger Reply with quote



Win32 kernel doesn't hold names for threads. This makes multi-threaded
debugging extremely painful, as you have to flail about trying to work out-
and remember - which thread ID is which.

A very simple 'manual' way could be to provide a call like
AssociateThreadName(ThreadID, Name), which would construct a table which the
debugger could then use to lookup thread names.

Maybe a Diamondback feature, pleeease?

- Roddy


Back to top
Martin James
Guest





PostPosted: Sun Aug 22, 2004 1:16 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote



Quote:
Win32 kernel doesn't hold names for threads. This makes multi-threaded
debugging extremely painful, as you have to flail about trying to work
out-
and remember - which thread ID is which.


I would like this too. It would be even better it Microsoft allowed general
cataloging of system objects by name, as is already available for some
specific objects. Why Billy decided that only some objects could have names
is beyond me.

Rgds,
Martin



Back to top
Captain Jake
Guest





PostPosted: Sun Aug 22, 2004 1:30 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote



"Roddy Pratt" <roddy (AT) rascular (DOT) spamspamspam.com> wrote

Quote:
A very simple 'manual' way could be to provide a call like
AssociateThreadName(ThreadID, Name), which would construct a table which
the
debugger could then use to lookup thread names.

Maybe a Diamondback feature, pleeease?

You can get thread naming now in regular Win32 Delphi. I forget which
component/class I saw that can do this, but off the top of my head I seem to
think it is the TIdThread class in Indy 10. Either that or the thread stuff
in JVCL 3.

--

Read Jake's Blog at http://blogs.slcdug.org/jjacobson/
Or Get the RSS Feed at http://blogs.slcdug.org/jjacobson/Rss.aspx

Everything contained in this post that is not quoted from others, is merely
an opinion. It may be a well-informed opinion motivated by an uncanny grasp
of facts and amazingly well-formulated theories, but it remains opinion
nevertheless. I speak for nobody but myself, and even then I may get it
wrong from time to time.




Back to top
Palle Meinert
Guest





PostPosted: Sun Aug 22, 2004 3:33 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

Quote:
Win32 kernel doesn't hold names for threads. This makes multi-threaded
debugging extremely painful, as you have to flail about trying to work
out-
and remember - which thread ID is which.


In BCB, selecting the "Thread Object" from the repository will ask whether
to name the thread, and I think Delphi will be no different (at least prior
to Cool.



/Palle



Back to top
Andre Kaufmann
Guest





PostPosted: Sun Aug 22, 2004 6:27 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

"Roddy Pratt" <roddy (AT) rascular (DOT) spamspamspam.com> wrote

Quote:
Win32 kernel doesn't hold names for threads. This makes multi-threaded

Not quite correct.
For example most C++ debuggers will set the thread name to the name of
the function the thread has been started by.
So there is a possibility to set the thread name already.
In Win32 there isnīt a simple API and the thread name has to be set
indirectly by using an undocumented Win32 exception to modify
the thread info.

For .NET threads you may simply call SetThreadName.

Andre




Back to top
Marc Rohloff [TeamB]
Guest





PostPosted: Sun Aug 22, 2004 10:09 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

On Sun, 22 Aug 2004 11:14:37 +0100, Roddy Pratt wrote:

Quote:
A very simple 'manual' way could be to provide a call like
AssociateThreadName(ThreadID, Name), which would construct a table which the
debugger could then use to lookup thread names.

Maybe a Diamondback feature, pleeease?

Probably a bit late for that but why don't you log it in
QualityCentral (qc.borland.com)

--
Marc Rohloff [TeamB]
marc rohloff at myrealbox dot com

Back to top
Peter Zolja
Guest





PostPosted: Sun Aug 22, 2004 10:43 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

Quote:
A very simple 'manual' way could be to provide a call like
AssociateThreadName(ThreadID, Name), which would construct a table which
the
debugger could then use to lookup thread names.

If you use the wizard to create a Thread Object it will let you specify a
name for the thread, a name that shows up in the debugger - it adds code
that "associates" a name with a thread. Isn't this what you want?



Back to top
Martin James
Guest





PostPosted: Sun Aug 22, 2004 11:03 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote


Quote:
If you use the wizard to create a Thread Object it will let you specify a
name for the thread, a name that shows up in the debugger - it adds code
that "associates" a name with a thread. Isn't this what you want?

Mhh - I haven't used that wizard for a long time. What happens if you use
it to create a maned thread unit & then create 10 threads?

Rgds,
Martin



Back to top
Peter Zolja
Guest





PostPosted: Mon Aug 23, 2004 1:42 am    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote


Quote:
Mhh - I haven't used that wizard for a long time. What happens if you use
it to create a maned thread unit & then create 10 threads?

By default it creates the code that allows you to assign a name for the
thread. The default behavior is pretty "static", but with a few changes you
can make it more flexible. For example:

Change the header to this:

type
TMyThread = class(TThread)
private
FMyName: string;
procedure SetName;
protected
procedure Execute; override;
public
property CustomName:string read FMyName write FMyName;
end;

and then change one line in SetName:

//ThreadNameInfo.FName := 'Abc';
ThreadNameInfo.FName := PAnsiChar(FMyName);

so, now you can assign a name for the thread at runtime; and each instance
can have a different custom name. If you want to be able to change the name
of the thread once you started the thread, you may have to change how you
write to FMyName -- just keep in mind that the SetName procedure will change
the name of the thread that ran the procedure, so just calling
ThreadInstance.CustomName := 'new name' for a different thread may not give
you what you expect...



Back to top
TOndrej
Guest





PostPosted: Mon Aug 23, 2004 7:35 am    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

Quote:
Win32 kernel doesn't hold names for threads. This makes multi-threaded
debugging extremely painful, as you have to flail about trying to work out-
and remember - which thread ID is which.

http://cc.borland.com/ccweb.exe/listing?id=16302

HTH
TOndrej

Back to top
Colin Wilson
Guest





PostPosted: Mon Aug 23, 2004 11:05 am    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

Roddy Pratt wrote:

Quote:
Win32 kernel doesn't hold names for threads. This makes
multi-threaded debugging extremely painful, as you have to flail
about trying to work out- and remember - which thread ID is which.

A very simple 'manual' way could be to provide a call like
AssociateThreadName(ThreadID, Name), which would construct a table
which the debugger could then use to lookup thread names.

Maybe a Diamondback feature, pleeease?

- Roddy

Madshi's Mad Exception Handling stuff gives you this. Mind you, it
would be a nice feature for D9 itself.

--
Colin - using XanaNews HTTP Transport
e-mail :colin (AT) wilsonc (DOT) demon.co.uk
web: http://www.wilsonc.demon.co.uk/delphi.htm

Posted with XanaNews 1.16.4.2

Back to top
Roddy Pratt
Guest





PostPosted: Mon Aug 23, 2004 11:09 am    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

"TOndrej" <tondrej (AT) plonk (DOT) net> wrote

Quote:
http://cc.borland.com/ccweb.exe/listing?id=16302

HTH

It does -Thanks!

As my threads are not TThread descendants, this is likely the best answer.
I'll see if I can make it fly with BCB5...

- Roddy



Back to top
Andre Kaufmann
Guest





PostPosted: Mon Aug 23, 2004 6:04 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

For BCB you can use the SetThreadName function on the following MSDN page:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp


At least it does for BCB 6 in combination with Win2K / XP

Andre



"Roddy Pratt" <roddy at rascular dot com> wrote

Quote:
"TOndrej" <tondrej (AT) plonk (DOT) net> wrote in message
news:41299d9c (AT) newsgroups (DOT) borland.com...
http://cc.borland.com/ccweb.exe/listing?id=16302

HTH

It does -Thanks!

As my threads are not TThread descendants, this is likely the best answer.
I'll see if I can make it fly with BCB5...

- Roddy





Back to top
Roddy Pratt
Guest





PostPosted: Wed Sep 08, 2004 7:16 pm    Post subject: Re: Feature request: Thread Names in Debugger Reply with quote

"Andre Kaufmann" <##andre_no_spam_.kaufmann_ (AT) t-online (DOT) de##> wrote in message
Quote:
For BCB you can use the SetThreadName function on the following MSDN page:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp

At least it does for BCB 6 in combination with Win2K / XP


But not for BCB5. I guess the integrated debugger doesn't support that
"RaiseException" thing.

Well, at least I've got one good reason to upgrade!

- Roddy



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.