mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 11:26:11 +00:00
Fixes for debugging (#2727)
* Fix continue until main not being enabled * Use Rizin API instead of commands * Fix attaching to a process with no file opened
This commit is contained in:
parent
f59797fb3d
commit
2d05ae2595
@ -1957,8 +1957,10 @@ void CutterCore::attachDebug(int pid)
|
||||
offsetPriorDebugging = getOffset();
|
||||
}
|
||||
|
||||
QString attach_command = currentlyOpenFile.isEmpty() ? "o" : "oodf";
|
||||
// attach to process with dbg plugin
|
||||
asyncCmd("e cfg.debug = true; oodf dbg://" + QString::number(pid), debugTask);
|
||||
asyncCmd("e cfg.debug=true;" + attach_command + " dbg://" + QString::number(pid), debugTask);
|
||||
|
||||
emit debugTaskStateChanged();
|
||||
|
||||
connect(debugTask.data(), &RizinTask::finished, this, [this, pid]() {
|
||||
|
@ -249,10 +249,10 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) : QObject(main),
|
||||
|
||||
void DebugActions::setButtonVisibleIfMainExists()
|
||||
{
|
||||
// Use cmd because cmdRaw would not handle multiple commands concatenated
|
||||
int mainExists = Core()->cmd("f?sym.main; ??").toInt();
|
||||
RzCoreLocked core(Core()->core());
|
||||
// if main is not a flag we hide the continue until main button
|
||||
if (!mainExists) {
|
||||
if (!rz_flag_get(Core()->core()->flags, "sym.main")
|
||||
&& !rz_flag_get(Core()->core()->flags, "main")) {
|
||||
actionContinueUntilMain->setVisible(false);
|
||||
continueUntilButton->setDefaultAction(actionContinueUntilCall);
|
||||
}
|
||||
@ -273,8 +273,15 @@ void DebugActions::showDebugWarning()
|
||||
|
||||
void DebugActions::continueUntilMain()
|
||||
{
|
||||
QString mainAddr = Core()->cmdRaw("?v sym.main");
|
||||
Core()->continueUntilDebug(mainAddr);
|
||||
RzCoreLocked core(Core()->core());
|
||||
RzFlagItem *main_flag = rz_flag_get(Core()->core()->flags, "sym.main");
|
||||
if (!main_flag) {
|
||||
main_flag = rz_flag_get(Core()->core()->flags, "main");
|
||||
if (!main_flag) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Core()->continueUntilDebug(QString::number(main_flag->offset));
|
||||
}
|
||||
|
||||
void DebugActions::attachRemoteDebugger()
|
||||
|
Loading…
Reference in New Issue
Block a user