qiling icon indicating copy to clipboard operation
qiling copied to clipboard

Gdbserver can't start correctly when multithread is enabled

Open bet4it opened this issue 4 years ago • 1 comments

When we start gdbserver by:

./qltool run -f examples/rootfs/x8664_linux/bin/x8664_hello --rootfs examples/rootfs/x8664_linux/ -g 127.0.0.1:1234

All things work correctly. We can get this output:

[=]     gdb> Stop at entry point: 0x555555554530
[=]     gdb> Listening on 127.0.0.1:1234

And when we connect by gdb we will stop at 0x555555554530.

But when we enable multithread:

./qltool run -f examples/rootfs/x8664_linux/bin/x8664_hello --rootfs examples/rootfs/x8664_linux/ -g 127.0.0.1:1234 -m

We will get this output:

[=] [Thread 2000]       gdb> Stop at entry point: 0x555555554530
[=] [Thread 2000]       0x7fffb7ee57c1: fstat(fd=0x1, bufptr=0x80000000dc10)
[=] [Thread 2000]       0x7fffb7eec4b7: brk(input=0x0)
[=] [Thread 2000]       0x7fffb7eec4b7: brk(input=0x555555779000)
[=] [Thread 2000]       0x7fffb7ee6152: write(fd=0x1, buf=0x555555758260, count=0xe)
Hello, World!
[=] [Thread 2000]       0x7fffb7ebae04: exit_group(code=0x0)
[=] [Thread 2000]       gdb> Listening on 127.0.0.1:1234

The program exits before gdbserver is started.

bet4it avatar Mar 15 '21 13:03 bet4it

The multithread feature is currently under rework and doesn't work with debuggers.

wtdcode avatar Mar 16 '21 01:03 wtdcode

Good question. Will you be able to test again ?

xwings avatar Oct 06 '22 03:10 xwings