Update bbox_threads.cpp

This commit is contained in:
Eao3piq4e 2022-08-03 17:58:44 +08:00
parent 36efc4cbb7
commit 00dd058431
1 changed files with 37 additions and 18 deletions

View File

@ -103,7 +103,7 @@ s32 BBOX_CloneRun(u32 uFlags, s32 (*pFn)(void*), void* pArg, ...)
/*
function name: BBOX_GetTaskNumber
description: When get a path to specific process, this function will return count of threads below it.
arguments: An pointer of type char*, including a path to specific process.
arguments: A pointer of type char*, including a path to specific process.
return value: An integer that indicates the count of threads below specific process.
note: none
date: 2022/8/3
@ -142,9 +142,17 @@ s32 BBOX_GetTaskNumber(char* szTaskPath)
}
/*
* get thread pid
*/
function name: BBOX_GetTaskId
description: When get a path to specific process, this function will return count of threads below it.
arguments: The first argument is a structure pointer named pstTaskInfo,its type is struct TASK_ATTACH_INFO*,
we use it as a structure array to store requisite thread infomation, the next argument destines
the max size of the array that the first argument destines. The last argument is a pointer of type
char*, including a path to specific process.
return value: An integer that indicates the count of threads stored in structure array.
note: none
date: 2022/8/3
contact tel: 18720816902
*/
s32 BBOX_GetTaskId(struct TASK_ATTACH_INFO* pstTaskInfo, s32 iSize, char* szTaskPath)
{
s32 iProc = -1;
@ -227,13 +235,19 @@ errout:
}
/*
* a ptrace debug thread
* in : TASK_ATTACH_INFO - thread information
* iPidCount - count of thread information
* iDoPtraceCheck - check if ptrace success
* return : 0 - success
* err code - failed
*/
function name: BBOX_PtraceAttachPid
description: The function is used to check the process whose id stored in structure array pstTaskInfo work normally.
arguments: The first argument is a structure pointer named pstTaskInfo,its type is struct TASK_ATTACH_INFO*,
it is used as a structure array that has stored requisite thread infomation, the next argument destines
the size of the array that the first argument destines, namely how many elements the array has.
The last argument is an integer to decide if need to check if the trace to destined process
work normally, if normal, corresponding element of array pstTaskInfo's member variable cIsAttached
will change from 0 to 1.
return value: An integer, if function work normally, the value is RET_OK, else is RET_ERR.
note: none
date: 2022/8/3
contact tel: 18720816902
*/
s32 BBOX_PtraceAttachPid(struct TASK_ATTACH_INFO* pstTaskInfo, s32 iPidCount, s32 iDoPtraceCheck)
{
u32 i;
@ -285,13 +299,18 @@ s32 BBOX_PtraceAttachPid(struct TASK_ATTACH_INFO* pstTaskInfo, s32 iPidCount, s3
}
/*
* cancel ptrace debug thread
* in : TASK_ATTACH_INFO - thread information
* iPidCount - count of thread information
* iDoPtraceCheck - check if ptrace success
* return : 0 - success
* err code - failed
*/
function name: BBOX_DetachAllThread
description: The function is used to cancel checking the process whose id stored in structure array pstTaskInfo
work normally, "work normally" means in array pstTaskInfo corresponding element's member
variable cIsAttached's value is 1.
arguments: The first argument is a structure pointer named pstTaskInfo,its type is struct TASK_ATTACH_INFO*,
it is used as a structure array that has stored requisite thread infomation, the next argument destines
the size of the array that the first argument destines, namely how many elements the array has.
return value: void
note: none
date: 2022/8/3
contact tel: 18720816902
*/
void BBOX_DetachAllThread(struct TASK_ATTACH_INFO* pstTaskInfo, s32 iPidCount)
{
u32 i;