From cd66ae6bf0c774f7b520301ffa031b0b4de0b15a Mon Sep 17 00:00:00 2001 From: klugier Date: Sat, 17 Nov 2018 16:42:46 +0000 Subject: [PATCH] IDE: GDB debugger backend now displayes threads name when information is available. git-svn-id: svn://ultimatepp.org/upp/trunk@12549 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Debuggers/Gdb.cpp | 43 +++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/uppsrc/ide/Debuggers/Gdb.cpp b/uppsrc/ide/Debuggers/Gdb.cpp index c537f1d1f..aac76ae99 100644 --- a/uppsrc/ide/Debuggers/Gdb.cpp +++ b/uppsrc/ide/Debuggers/Gdb.cpp @@ -292,24 +292,41 @@ String Gdb::ObtainThreadsInfo() String s = ss.GetLine(); CParser p(s); try { - bool active = p.Char('*'); - if(p.IsNumber()) { - int id = p.ReadInt(); - AttrText text(String() << "Thread " << id); - if(active) { - active_thread = id; - text.Bold(); + bool is_active = p.Char('*'); + if(!p.IsNumber()) + continue; + + int id = p.ReadInt(); + + String name; + while (!p.IsEof()) { + if (p.IsString()) { + name = p.ReadString(); + break; } - if(main) { - text.Underline(); - main = false; - } - threads.Add(id, text); + + p.SkipTerm(); } + + AttrText text(String() << "Thread " << id); + if (!name.IsEmpty()) + text.Set(text.ToString() << " (" << name << ")"); + if(is_active) { + active_thread = id; + text.Bold(); + } + if(main) { + text.Underline(); + main = false; + } + threads.Add(id, text); threads.GoBegin(); } - catch(CParser::Error) {} + catch(CParser::Error e) { + Loge() << METHOD_NAME << e; + } } + if(active_thread >= 0) threads <<= active_thread; if(threads.GetCount() == 0) {