gdb/dap - Getting thread names

Renamed thread_name according to convention (_ first)

When testing firefox tests, it is apparent that
_get_threads returns threads with name field = None.

I had initially thought that this was due to Firefox setting the names
using /proc/pid/task/tid/comm, by writing directly to the proc fs the
names, but apparently GDB seems to catch this, because I re-wrote
the basic-dap.exp/c to do this specifically and it saw the changes.

So I couldn't determine right now, what operation of name change that
GDB does not pick up, but with this patch, GDB will pick up the thread
names for an applications that set the name of a thread in ways that
aren't obvious.
This commit is contained in:
Simon Farre 2023-06-12 21:32:46 +02:00
parent 74d39f70cd
commit f1a614dc8f

View File

@ -18,6 +18,12 @@ import gdb
from .server import request
from .startup import send_gdb_with_response, in_gdb_thread
def _thread_name(thr):
if thr.name is not None:
return thr.name
if thr.details is not None:
return thr.details
return None
# A helper function to construct the list of threads.
@in_gdb_thread
@ -27,7 +33,7 @@ def _get_threads():
one_result = {
"id": thr.global_num,
}
name = thr.name
name = _thread_name(thr)
if name is not None:
one_result["name"] = name
result.append(one_result)