Files
seer/src/SeerCatchpointCreateDialog.cpp
T

199 lines
4.9 KiB
C++
Raw Normal View History

2025-08-26 17:26:05 -05:00
// SPDX-FileCopyrightText: 2021 Ernie Pasveer <epasveer@att.net>
//
// SPDX-License-Identifier: GPL-3.0-or-later
2021-12-31 13:00:02 -06:00
#include "SeerCatchpointCreateDialog.h"
#include <QtCore/QDebug>
SeerCatchpointCreateDialog::SeerCatchpointCreateDialog (QWidget* parent) : QDialog(parent) {
// Set up the UI.
setupUi(this);
// Setup the widgets
2021-12-31 13:00:54 -06:00
setType("");
2025-06-21 16:38:45 -05:00
setArguments("");
2021-12-31 13:00:02 -06:00
2023-04-02 10:45:53 -05:00
setTemporaryEnabled(false);
setDisabledEnabled(false);
2021-12-31 13:00:02 -06:00
2025-01-01 10:17:46 -06:00
throwRadioButton->setFocus();
2021-12-31 13:00:02 -06:00
// Connect things.
}
SeerCatchpointCreateDialog::~SeerCatchpointCreateDialog () {
}
2021-12-31 13:00:54 -06:00
void SeerCatchpointCreateDialog::setType (const QString& text) {
2021-12-31 13:00:02 -06:00
2021-12-31 13:00:54 -06:00
if (text == "throw") {
throwRadioButton->setChecked(true);
2021-12-31 13:00:02 -06:00
2021-12-31 13:00:54 -06:00
}else if (text == "rethrow") {
rethrowRadioButton->setChecked(true);
2021-12-31 13:00:02 -06:00
2021-12-31 13:00:54 -06:00
}else if (text == "catch") {
catchRadioButton->setChecked(true);
2021-12-31 13:00:02 -06:00
2022-01-13 11:03:24 -06:00
}else if (text == "load") {
loadRadioButton->setChecked(true);
}else if (text == "unload") {
unloadRadioButton->setChecked(true);
2023-04-02 10:45:53 -05:00
}else if (text == "assert") {
adaAssertRadioButton->setChecked(true);
}else if (text == "exception") {
adaExceptionRadioButton->setChecked(true);
}else if (text == "handlers") {
adaHandlersRadioButton->setChecked(true);
2025-06-21 16:38:45 -05:00
}else if (text == "signal") {
signalRadioButton->setChecked(true);
}else if (text == "fork") {
forkRadioButton->setChecked(true);
}else if (text == "vfork") {
vforkRadioButton->setChecked(true);
}else if (text == "exec") {
execRadioButton->setChecked(true);
}else if (text == "syscall") {
syscallRadioButton->setChecked(true);
2021-12-31 13:00:54 -06:00
}else{
throwRadioButton->setChecked(true);
}
2021-12-31 13:00:02 -06:00
}
2021-12-31 13:00:54 -06:00
QString SeerCatchpointCreateDialog::typeText () const {
2021-12-31 13:00:02 -06:00
2021-12-31 13:00:54 -06:00
if (throwRadioButton->isChecked()) {
return "throw";
2021-12-31 13:00:02 -06:00
2021-12-31 13:00:54 -06:00
}else if (rethrowRadioButton->isChecked()) {
return "rethrow";
2021-12-31 13:00:02 -06:00
2021-12-31 13:00:54 -06:00
}else if (catchRadioButton->isChecked()) {
return "catch";
2021-12-31 13:00:02 -06:00
2022-01-13 11:03:24 -06:00
}else if (loadRadioButton->isChecked()) {
return "load";
}else if (unloadRadioButton->isChecked()) {
return "unload";
2023-04-02 10:45:53 -05:00
}else if (adaAssertRadioButton->isChecked()) {
return "assert";
}else if (adaExceptionRadioButton->isChecked()) {
return "exception";
}else if (adaHandlersRadioButton->isChecked()) {
return "handlers";
2025-06-21 16:38:45 -05:00
}else if (signalRadioButton->isChecked()) {
return "signal";
}else if (forkRadioButton->isChecked()) {
return "fork";
}else if (vforkRadioButton->isChecked()) {
return "vfork";
}else if (execRadioButton->isChecked()) {
return "exec";
}else if (syscallRadioButton->isChecked()) {
return "syscall";
2021-12-31 13:00:54 -06:00
}else{
return "throw";
}
2021-12-31 13:00:02 -06:00
}
2021-12-31 13:00:54 -06:00
void SeerCatchpointCreateDialog::setTemporaryEnabled (bool flag) {
temporaryCheckBox->setChecked(flag);
2021-12-31 13:00:02 -06:00
}
2023-04-02 10:45:53 -05:00
void SeerCatchpointCreateDialog::setDisabledEnabled (bool flag) {
disabledCheckBox->setChecked(flag);
}
2025-06-21 16:38:45 -05:00
void SeerCatchpointCreateDialog::setArguments (const QString& text) {
argumentsLineEdit->setText(text);
2021-12-31 13:00:02 -06:00
}
2025-06-21 16:38:45 -05:00
QString SeerCatchpointCreateDialog::arguments () const {
return argumentsLineEdit->text();
2021-12-31 13:00:02 -06:00
}
bool SeerCatchpointCreateDialog::temporaryEnabled () const {
return temporaryCheckBox->isChecked();
}
2023-04-02 10:45:53 -05:00
bool SeerCatchpointCreateDialog::disabledEnabled () const {
return disabledCheckBox->isChecked();
}
2021-12-31 13:00:02 -06:00
QString SeerCatchpointCreateDialog::catchpointText () const {
// Build a catchpoint specification.
2021-12-31 13:00:54 -06:00
QString catchpointParameters = typeText();
2021-12-31 13:00:02 -06:00
if (temporaryEnabled()) {
catchpointParameters += " -t";
}
2023-04-02 10:45:53 -05:00
if (disabledEnabled()) {
catchpointParameters += " -d";
}
if (typeText() == "assert") { // Handle Ada 'assert'. Nothing to add here.
}else if (typeText() == "exception") { // Handle Ada 'exception'.
2025-06-21 16:38:45 -05:00
if (arguments() != "") {
catchpointParameters += " -e " + arguments();
2023-04-02 10:45:53 -05:00
}
}else if (typeText() == "handlers") { // Handle Ada 'handlers'.
2025-06-21 16:38:45 -05:00
if (arguments() != "") {
catchpointParameters += " -e " + arguments();
2023-04-02 10:45:53 -05:00
}
}else if (typeText() == "load") { // Handle library 'load'. Must have a name.
2025-06-21 16:38:45 -05:00
catchpointParameters += " " + arguments();
2023-04-02 10:45:53 -05:00
}else if (typeText() == "unload") { // Handle library 'unload'. Must have a name.
2025-06-21 16:38:45 -05:00
catchpointParameters += " " + arguments();
}else if (typeText() == "signal") { // Handle library 'unload'. Must have a name.
catchpointParameters += " " + arguments();
}else if (typeText() == "syscall") { // Handle library 'unload'. Must have a name.
catchpointParameters += " " + arguments();
2022-01-13 20:36:39 -06:00
2023-04-02 10:45:53 -05:00
}else{ // C++ throw, rethrow, catch. These require '-r', but only if there is a name.
2025-06-21 16:38:45 -05:00
if (arguments() != "") {
catchpointParameters += " -r " + arguments();
2021-12-31 13:00:02 -06:00
}
}
2023-04-02 10:45:53 -05:00
// qDebug() << catchpointParameters;
2021-12-31 13:00:02 -06:00
return catchpointParameters;
}