Community
Participate
Working Groups
Attached an output which shows how command is unnecessarily executed. In this example, -stack-list-locals and all the following commands like -var-create etc will be send to the back end for an undesirable execution context like 1 in this case. Though GDB has switched to thread 3 due to the creation of new threads, but pending command -stack-list-locals is still sent to the backend for execution context = 1 ************ LAST THREAD ID means what is currently known to the plug-in THREAD ID refers to the execution context that was sent for the command ************ 633,368 12-exec-continue THREAD ID: 1 LAST THREAD ID: 1 SEND: 12-exec-continue RECVD: 12^running RECVD: ~"[New Thread 1078250416 (LWP 29430)]\n" RECVD: ~"[New Thread 1080351664 (LWP 29431)]\n" RECVD: ~"[Switching to Thread 1080351664 (LWP 29431)]\n" RECVD: 12*stopped,reason="breakpoint-hit",bkptno="2",thread-id="3",frame={addr="0x0804876a",func="thread_print",args=[{name="ptr",value="0x8048b06"}],file="../Hello.cpp",fullname="/local/scratch/Eclipse/Workspaces/runtime/dsf_europa/TestFrancois/Hello.cpp",line="22"} 633,434 13-thread-list-ids THREAD ID: null LAST THREAD ID: 3 SEND: 13-thread-list-ids RECVD: 13^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},number-of-threads="3" 633,497 14-stack-list-locals 1 THREAD ID: 1 LAST THREAD ID: 3 SEND: 15-thread-select 1 RECVD: 15^done,new-thread-id="1",frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]} SEND: 14-stack-list-locals 1 RECVD: 14^done,locals=[] Cancelling such commands can save us some trip to the back end Also attaching the doc file containing complete output
Created attachment 81731 [details] Output from GDB Forgot to attach the doc
Problem could arise when -stack-list-locals is called for the thread that was an active thread when step was performed but in the mean time has exited. In such a case where Thread id is unknown to GDB, performing commands on that thread will generate errors from GDB like &"mi_cmd_var_create: unable to create variable object\n" &"Thread ID 2 not known.\n" Also, GDB can end up giving wrong output like for command #31 704,331 29-exec-continue Execution context: 2 LAST THREAD ID: 2 SEND: 29-exec-continue RECVD: 29^running RECVD: ~"[Thread 1078250416 (LWP 23092) exited]\n" RECVD: ~"[Switching to Thread 1080351664 (LWP 23093)]\n" RECVD: 29*stopped,reason="breakpoint-hit",bkptno="2",thread-id="3",frame={addr="0x0804876a",func="thread_print",args=[{name="ptr",value="0x8048b06"}],file="../Hello.cpp",fullname="/local/scratch/Eclipse/Workspaces/runtime/dsf_europa/TestFrancois/Hello.cpp",line="22"} 704,368 30-thread-list-ids Execution context: null LAST THREAD ID: 3 SEND: 30-thread-list-ids RECVD: 30^done,thread-ids={thread-id="3",thread-id="1"},number-of-threads="2" 704,412 31-stack-list-locals 1 Execution context: 2 LAST THREAD ID: 3 704,413 -thread-select 2 SEND: 32-thread-select 2 SEND: 31-stack-list-locals 1 RECVD: &"Thread ID 2 not known.\n" RECVD: 32^error,msg="Thread ID 2 not known." RECVD: 31^done,locals=[{name="cptr",value="0x8048b06 \"Thread 3\""}] 704,857 41-var-create - * cptr Execution context: 2 LAST THREAD ID: 2 SEND: 41-var-create - * cptr RECVD: &"mi_cmd_var_create: unable to create variable object\n" RECVD: 41^error,msg="mi_cmd_var_create: unable to create variable object"