mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36: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();
|
offsetPriorDebugging = getOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString attach_command = currentlyOpenFile.isEmpty() ? "o" : "oodf";
|
||||||
// attach to process with dbg plugin
|
// 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();
|
emit debugTaskStateChanged();
|
||||||
|
|
||||||
connect(debugTask.data(), &RizinTask::finished, this, [this, pid]() {
|
connect(debugTask.data(), &RizinTask::finished, this, [this, pid]() {
|
||||||
|
@ -249,10 +249,10 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) : QObject(main),
|
|||||||
|
|
||||||
void DebugActions::setButtonVisibleIfMainExists()
|
void DebugActions::setButtonVisibleIfMainExists()
|
||||||
{
|
{
|
||||||
// Use cmd because cmdRaw would not handle multiple commands concatenated
|
RzCoreLocked core(Core()->core());
|
||||||
int mainExists = Core()->cmd("f?sym.main; ??").toInt();
|
|
||||||
// if main is not a flag we hide the continue until main button
|
// 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);
|
actionContinueUntilMain->setVisible(false);
|
||||||
continueUntilButton->setDefaultAction(actionContinueUntilCall);
|
continueUntilButton->setDefaultAction(actionContinueUntilCall);
|
||||||
}
|
}
|
||||||
@ -273,8 +273,15 @@ void DebugActions::showDebugWarning()
|
|||||||
|
|
||||||
void DebugActions::continueUntilMain()
|
void DebugActions::continueUntilMain()
|
||||||
{
|
{
|
||||||
QString mainAddr = Core()->cmdRaw("?v sym.main");
|
RzCoreLocked core(Core()->core());
|
||||||
Core()->continueUntilDebug(mainAddr);
|
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()
|
void DebugActions::attachRemoteDebugger()
|
||||||
|
Loading…
Reference in New Issue
Block a user