Add qGetTLSAddr
This commit is contained in:
parent
47a9c1b576
commit
39ca23d609
@ -39,3 +39,4 @@ GDB_DECLARE_QUERY_HANDLER(fThreadInfo);
|
||||
GDB_DECLARE_QUERY_HANDLER(sThreadInfo);
|
||||
GDB_DECLARE_QUERY_HANDLER(ThreadEvents);
|
||||
GDB_DECLARE_QUERY_HANDLER(ThreadExtraInfo);
|
||||
GDB_DECLARE_QUERY_HANDLER(GetTLSAddr);
|
||||
|
@ -59,6 +59,7 @@ static const struct
|
||||
GDB_QUERY_HANDLER_LIST_ITEM(sThreadInfo, READ),
|
||||
GDB_QUERY_HANDLER_LIST_ITEM(ThreadEvents, WRITE),
|
||||
GDB_QUERY_HANDLER_LIST_ITEM(ThreadExtraInfo, READ),
|
||||
GDB_QUERY_HANDLER_LIST_ITEM(GetTLSAddr, READ),
|
||||
GDB_QUERY_HANDLER_LIST_ITEM_3("C", CurrentThreadId, READ),
|
||||
GDB_QUERY_HANDLER_LIST_ITEM_3("Search", SearchMemory, READ),
|
||||
GDB_QUERY_HANDLER_LIST_ITEM(CatchSyscalls, WRITE),
|
||||
|
@ -302,3 +302,27 @@ GDB_DECLARE_QUERY_HANDLER(ThreadExtraInfo)
|
||||
|
||||
return GDB_SendHexPacket(ctx, buf, (u32)n);
|
||||
}
|
||||
|
||||
GDB_DECLARE_QUERY_HANDLER(GetTLSAddr)
|
||||
{
|
||||
u32 lst[3];
|
||||
if(GDB_ParseHexIntegerList(lst, ctx->commandData, 3, 0) == NULL)
|
||||
return GDB_ReplyErrno(ctx, EILSEQ);
|
||||
|
||||
// We don't care about the 'lm' parameter...
|
||||
u32 id = lst[0];
|
||||
u32 offset = lst[1];
|
||||
|
||||
u32 tls = 0;
|
||||
|
||||
for(u32 i = 0; i < MAX_DEBUG_THREAD; i++)
|
||||
{
|
||||
if(ctx->threadInfos[i].id == id)
|
||||
tls = ctx->threadInfos[i].tls;
|
||||
}
|
||||
|
||||
if(tls == 0)
|
||||
return GDB_ReplyErrno(ctx, EINVAL);
|
||||
|
||||
return GDB_SendFormattedPacket(ctx, "%08x", tls + offset);
|
||||
}
|
||||
|
Reference in New Issue
Block a user