mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-26 06:45:25 +00:00
Fix attaching debugger (#3139)
* Fix attaching debugger * Fix deadlock on attach Co-authored-by: wargio <wargio@libero.it>
This commit is contained in:
parent
ef0d69b53a
commit
c0f260ca69
@ -2075,16 +2075,23 @@ void CutterCore::attachDebug(int pid)
|
|||||||
offsetPriorDebugging = getOffset();
|
offsetPriorDebugging = getOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
CORE_LOCK();
|
if (!asyncTask(
|
||||||
setConfig("cfg.debug", true);
|
[&](RzCore *core) {
|
||||||
auto uri = rz_str_newf("dbg://%d", pid);
|
// cannot use setConfig because core is
|
||||||
if (currentlyOpenFile.isEmpty()) {
|
// already locked, which causes a deadlock
|
||||||
rz_core_file_open_load(core, uri, 0, RZ_PERM_R, false);
|
rz_config_set_b(core->config, "cfg.debug", true);
|
||||||
} else {
|
auto uri = rz_str_newf("dbg://%d", pid);
|
||||||
rz_core_file_reopen_remote_debug(core, uri, 0);
|
if (currentlyOpenFile.isEmpty()) {
|
||||||
|
rz_core_file_open_load(core, uri, 0, RZ_PERM_R, false);
|
||||||
|
} else {
|
||||||
|
rz_core_file_reopen_remote_debug(core, uri, 0);
|
||||||
|
}
|
||||||
|
free(uri);
|
||||||
|
return nullptr;
|
||||||
|
},
|
||||||
|
debugTask)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
free(uri);
|
|
||||||
|
|
||||||
emit debugTaskStateChanged();
|
emit debugTaskStateChanged();
|
||||||
|
|
||||||
connect(debugTask.data(), &RizinTask::finished, this, [this, pid]() {
|
connect(debugTask.data(), &RizinTask::finished, this, [this, pid]() {
|
||||||
@ -2144,7 +2151,10 @@ void CutterCore::stopDebug()
|
|||||||
rz_core_analysis_esil_trace_stop(core);
|
rz_core_analysis_esil_trace_stop(core);
|
||||||
currentlyEmulating = false;
|
currentlyEmulating = false;
|
||||||
} else {
|
} else {
|
||||||
rz_core_debug_process_close(core);
|
// ensure we have opened a file.
|
||||||
|
if (core->io->desc) {
|
||||||
|
rz_core_debug_process_close(core);
|
||||||
|
}
|
||||||
currentlyAttachedToPID = -1;
|
currentlyAttachedToPID = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user