How to change executing thread in gdb?
Asked Answered
C

1

10

I'm currently debugging kernel code using KGDB. Whenever I break in I naturally jump to the interrupt handler for kgdb. Under GDB I ran the following command.

info threads 

and the output would be

7    Thread 7 (rcu_sched) 0x0000000000000000 in irq_stack_union ()

6    Thread 5 (kworker/0:0H) 0x0000000000000000 in irq_stack_union ()

5    Thread 3 (ksoftirqd/0) 0x0000000000000000 in irq_stack_union ()

4    Thread 2 (kthreadd) 0x0000000000000000 in irq_stack_union ()

3    Thread 1 (init)   0x0000000000000000 in irq_stack_union ()

2    Thread 3754 (Xorg) 0x0000000000000000 in irq_stack_union ()

* 1    Thread 4294967294 (shadowCPU0) kgdb_breakpoint ()

    at kernel/debug/debug_core.c:1042

I would then jump through the code expecting to end up in a different thread (I'm interested in Xorg) however after i step through the code the next executing thread becomes cpu idle.

info thread

* 1    Thread 4294967294 (shadowCPU0) cpu_idle_loop () at kernel/cpu/idle.c:116

How can I switch my debug context to Xorg or any other thread, additionally what does irq_stack_union () mean. Thread is idle pending interrupts?

Canea answered 1/2, 2015 at 0:58 Comment(0)
P
11

According to the offical documentation is is just thread threadno https://sourceware.org/gdb/onlinedocs/gdb/Threads.html

Picayune answered 1/2, 2015 at 1:6 Comment(2)
I've tried this, though this seems to change context for viewing thread info only. Whenever I start stepping it would go back to cpu idle.Canea
Did you check this out? sourceware.org/gdb/current/onlinedocs/gdb/…Picayune

© 2022 - 2024 — McMap. All rights reserved.