You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Describe the bug
When remote debugging a program running in Qiling, the Qiling gdbserver seems not to handle the single step instruction from gdb client. Every time I perform the si command in my gdb client, Qiling gdbserver send SIGTERM causing my debugged program to terminate.
Expected behavior
Qiling gdbserver not sending SIGTERM each time performing the si command when remote debugging.
Dig in gdbserver Qiling implementation
I digged in the gdbserver implementation and debug with the command printing offered by Qiling gdbserver and this function seems weird to me, file : qiling/debugger/gdb/gdb.py
defhandle_s(subcmd: str) ->Reply:
"""Perform a single step. """self.gdb.resume_emu(steps=1)
# if emulation has been stopped, signal program termination# ===== these two lines seems weird to me because the condition is always True ===# This is what send the SIGTERM all the time ifself.ql.emu_stateisQL_STATE.STOPPED:
returnf'S{SIGTERM:02x}'# ====================================================================# otherwise, this is just single steppingreturnf'S{SIGTRAP:02x}'
Wonder if it's normal or it's a bug or this condition is useful in a particular case that is not related to my implementation. I've tested to comment these two lines and everything works perfectly fine after that. I think it also causes other bugs with breakpoint but not so sure and didn't have the time to verify this point.
Additional context
I worked with the dev branch.
Just a really simple code, I work on cortex-m3 and this code works perfectly fine without debugging.
I use arm-none-eabi-gdb as gdb client (from the toolchain used to cross compile toto.elf) with my program and it has symbols debug.
I know that mcu's haven't been really tested with gdb and Qiling but I just crafted two xml files for cortex-m placed at : qiling/debugger/gdb/xml/cortex-m.
arm-m-profile.xml :
<?xml version="1.0"?>
<!-- Copyright (C) 2010-2020 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. -->
<!DOCTYPEfeature SYSTEM "gdb-target.dtd">
<featurename="org.gnu.gdb.arm.m-profile">
<regname="r0"bitsize="32"regnum="0"/>
<regname="r1"bitsize="32"/>
<regname="r2"bitsize="32"/>
<regname="r3"bitsize="32"/>
<regname="r4"bitsize="32"/>
<regname="r5"bitsize="32"/>
<regname="r6"bitsize="32"/>
<regname="r7"bitsize="32"/>
<regname="r8"bitsize="32"/>
<regname="r9"bitsize="32"/>
<regname="r10"bitsize="32"/>
<regname="r11"bitsize="32"/>
<regname="r12"bitsize="32"/>
<regname="sp"bitsize="32"type="data_ptr"/>
<regname="lr"bitsize="32"/>
<regname="pc"bitsize="32"type="code_ptr"/>
<regname="xpsr"bitsize="32"regnum="25"/>
</feature>
target.xml :
<?xml version="1.0"?>
<!-- Copyright (C) 2009-2016 Free Software Foundation, Inc. *!Copying and distribution of this file, with or without modification, *!are permitted in any medium without royalty provided the copyright *!notice and this notice are preserved. -->
<!DOCTYPEtarget SYSTEM "gdb-target.dtd">
<targetxmlns:xi="http://www.w3.org/2001/XInclude">
<architecture>arm</architecture>
<xi:includehref="arm-m-profile.xml"/>
</target>
The text was updated successfully, but these errors were encountered:
*Describe the bug
When remote debugging a program running in Qiling, the Qiling gdbserver seems not to handle the single step instruction from gdb client. Every time I perform the si command in my gdb client, Qiling gdbserver send SIGTERM causing my debugged program to terminate.
Sample Code
Expected behavior
Qiling gdbserver not sending SIGTERM each time performing the si command when remote debugging.
Dig in gdbserver Qiling implementation
I digged in the gdbserver implementation and debug with the command printing offered by Qiling gdbserver and this function seems weird to me, file : qiling/debugger/gdb/gdb.py
Wonder if it's normal or it's a bug or this condition is useful in a particular case that is not related to my implementation. I've tested to comment these two lines and everything works perfectly fine after that. I think it also causes other bugs with breakpoint but not so sure and didn't have the time to verify this point.
Additional context
I worked with the dev branch.
Just a really simple code, I work on cortex-m3 and this code works perfectly fine without debugging.
I use arm-none-eabi-gdb as gdb client (from the toolchain used to cross compile toto.elf) with my program and it has symbols debug.
I know that mcu's haven't been really tested with gdb and Qiling but I just crafted two xml files for cortex-m placed at : qiling/debugger/gdb/xml/cortex-m.
arm-m-profile.xml :
target.xml :
The text was updated successfully, but these errors were encountered: