2
我正在使用Ubuntu 12.04並使用gdb調試下面的代碼。每次撥打clone()
時我都會收到以下內部錯誤。使用克隆時出現GDB內部錯誤()
34 pid = clone(entryPt,(char*)pStack+stackSize,SIGCHLD|CLONE_FS|CLONE_FILES|CLONE_VM,&arg);
(gdb) n
/build/buildd/gdb-7.4-2012.04/gdb/linux-thread-db.c:418: internal-error: thread_get_info_callback: Assertion `inout->thread_info != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
這裏是代碼段。
int taskSpawn(char* name, int priority, int option, int stackSize, FUNCPTR entryPt, int arg)
{
TblEntry *Task_Entry;
int Handle, q_idx, old_idx, old_priority;
void *pStack;
pid_t pid = 0; // to be modified.
struct _Task *new_TCB, *old_TCB;
/* Get a free entry */
Handle = _CreateHandle(&Task_Entry);
if(Handle == -1)
return -1; // fail to spawn task.
pStack = malloc(stackSize);
// Call clone().
#ifdef __linux
pid = clone(entryPt,
(char*)pStack+stackSize,
SIGCHLD|CLONE_FS|CLONE_FILES|CLONE_VM,
&arg);
kill(pid, SIGSTOP);
printf("clone returns %d\n", pid);
if(pid < 0)
{
exit(0);
}
#endif
return 0;
}
爲什麼clone()
給我這個錯誤?
預先感謝您。
您可能還想顯示'entryPt()'。 – alk
FUNCPTR只是'int'。調用者將一個函數名稱傳遞爲'entryPt'。 – inherithandle
如果「*'FUNCPTR'只是'int' *」,可能是崩潰的原因,因爲它應該是'int(*)(void *)'。也可能是,它不是'clone()',而是'entryPt()',因爲它是由'clone()'開始的。然而,當你從我們這裏隱藏'entryPt()'時,這只是一個猜測。 – alk