gdb_main: Implemented qfThreadInfo and qsThreadInfo for GDB 11+

This commit is contained in:
dragonmux 2022-07-20 05:39:48 +01:00 committed by Piotr Esden-Tempski
parent 4ba77a60ca
commit b47ee11537
1 changed files with 18 additions and 0 deletions

View File

@ -479,6 +479,22 @@ static void exec_q_c(const char *packet, const size_t length)
gdb_putpacketz("QC1");
}
/*
* qfThreadInfo queries are required in GDB 11 and 12 as these GDBs require the server to support
* threading even when there's only the possiblity for one thread to exist. In this instance,
* we have to tell GDB that there is a single active thread so it doesn't think the "thread" died.
* qsThreadInfo will always follow qfThreadInfo when we reply as we have to specify 'l' at the
* end to terminate the list.. GDB doesn't like this not happening.
*/
static void exec_q_thread_info(const char *packet, const size_t length)
{
(void)length;
if (packet[-11] == 'f')
gdb_putpacketz("m1");
else
gdb_putpacketz("l");
}
static const cmd_executer q_commands[]=
{
{"qRcmd,", exec_q_rcmd},
@ -487,6 +503,8 @@ static const cmd_executer q_commands[]=
{"qXfer:features:read:target.xml:",exec_q_feature_read},
{"qCRC:", exec_q_crc},
{"qC", exec_q_c},
{"qfThreadInfo", exec_q_thread_info},
{"qsThreadInfo", exec_q_thread_info},
{NULL, NULL},
};