mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
Implement DAP module-removed event
DAP specifies an event that should be sent when a module is removed. This patch implements this. Tested-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
This commit is contained in:
@ -68,6 +68,18 @@ def _new_objfile(event):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@in_gdb_thread
|
||||||
|
def _objfile_removed(event):
|
||||||
|
if is_module(event.objfile):
|
||||||
|
send_event(
|
||||||
|
"module",
|
||||||
|
{
|
||||||
|
"reason": "removed",
|
||||||
|
"module": make_module(event.objfile),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
_suppress_cont = False
|
_suppress_cont = False
|
||||||
|
|
||||||
|
|
||||||
@ -150,3 +162,4 @@ gdb.events.new_thread.connect(_new_thread)
|
|||||||
gdb.events.thread_exited.connect(_thread_exited)
|
gdb.events.thread_exited.connect(_thread_exited)
|
||||||
gdb.events.cont.connect(_cont)
|
gdb.events.cont.connect(_cont)
|
||||||
gdb.events.new_objfile.connect(_new_objfile)
|
gdb.events.new_objfile.connect(_new_objfile)
|
||||||
|
gdb.events.free_objfile.connect(_objfile_removed)
|
||||||
|
@ -36,5 +36,8 @@ main (void)
|
|||||||
func = (int (*)(void (*) (void))) dlsym (handle, "call_me");
|
func = (int (*)(void (*) (void))) dlsym (handle, "call_me");
|
||||||
func (stop);
|
func (stop);
|
||||||
|
|
||||||
|
dlclose (handle);
|
||||||
|
stop ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ if {[dap_launch $testfile] == ""} {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
set obj [dap_check_request_and_response "set breakpoint on two functions" \
|
set obj [dap_check_request_and_response "set breakpoint on stop function" \
|
||||||
setFunctionBreakpoints \
|
setFunctionBreakpoints \
|
||||||
{o breakpoints [a [o name [s stop]]]}]
|
{o breakpoints [a [o name [s stop]]]}]
|
||||||
set fn_bpno [dap_get_breakpoint_number $obj]
|
set fn_bpno [dap_get_breakpoint_number $obj]
|
||||||
@ -53,7 +53,7 @@ dap_wait_for_event_and_check "stopped at function breakpoint" stopped \
|
|||||||
"body reason" breakpoint \
|
"body reason" breakpoint \
|
||||||
"body hitBreakpointIds" $fn_bpno
|
"body hitBreakpointIds" $fn_bpno
|
||||||
|
|
||||||
dap_check_request_and_response "continue to next stop" continue \
|
dap_check_request_and_response "continue to second stop" continue \
|
||||||
{o threadId [i 1]}
|
{o threadId [i 1]}
|
||||||
|
|
||||||
|
|
||||||
@ -78,4 +78,15 @@ set frame_id [dict get [lindex [dict get $bt body stackFrames] 1] moduleId]
|
|||||||
|
|
||||||
gdb_assert {[string match *$libname* $frame_id]} "module.id in stack trace"
|
gdb_assert {[string match *$libname* $frame_id]} "module.id in stack trace"
|
||||||
|
|
||||||
|
|
||||||
|
dap_check_request_and_response "continue to third stop" continue \
|
||||||
|
{o threadId [i 1]}
|
||||||
|
|
||||||
|
dap_wait_for_event_and_check "module removed event" module \
|
||||||
|
"body reason" removed
|
||||||
|
|
||||||
|
dap_wait_for_event_and_check "third stop at function breakpoint" stopped \
|
||||||
|
"body reason" breakpoint \
|
||||||
|
"body hitBreakpointIds" $fn_bpno
|
||||||
|
|
||||||
dap_shutdown
|
dap_shutdown
|
||||||
|
Reference in New Issue
Block a user