mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-13 04:42:12 +03:00
Add more debuggers. Allow to load core dumps.
This commit is contained in:
@@ -52,6 +52,14 @@
|
||||
"arguments": {
|
||||
"pid": "${command:pickProcess}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Load coredump",
|
||||
"request": "attach",
|
||||
"arguments": {
|
||||
"coreFile": "${command:pickFile}",
|
||||
"program": "${file}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -110,6 +118,14 @@
|
||||
"arguments": {
|
||||
"pid": "${command:pickProcess}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Load coredump",
|
||||
"request": "attach",
|
||||
"arguments": {
|
||||
"coreFile": "${command:pickFile}",
|
||||
"program": "${file}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -175,7 +191,7 @@
|
||||
},
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"name": "Launch script",
|
||||
"command_arguments": ["--wait-for-client", "${file}", "${args}"],
|
||||
"request": "attach",
|
||||
"arguments": {
|
||||
@@ -185,7 +201,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Launch module",
|
||||
"command_arguments": ["--wait-for-client", "-m", "${command:pickString"],
|
||||
"command_arguments": ["--wait-for-client", "-m", "${command:promptString}"],
|
||||
"request": "attach",
|
||||
"arguments": {
|
||||
"stopOnEntry": true,
|
||||
@@ -202,6 +218,51 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dart",
|
||||
"type": "dart",
|
||||
"languages": [ "dart" ],
|
||||
"url": "https://github.com/dart-lang/sdk/blob/main/third_party/pkg/dap/tool/README.md",
|
||||
"run": {
|
||||
"command": "dart",
|
||||
"command_arguments": ["debug_adapter"]
|
||||
},
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch (debug)",
|
||||
"request": "launch",
|
||||
"arguments": {
|
||||
"mode": "debug",
|
||||
"program": "${file}",
|
||||
"args": "${args}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "perl-ls",
|
||||
"url": "https://github.com/richterger/Perl-LanguageServer",
|
||||
"type": "perl",
|
||||
"languages": [ "perl" ],
|
||||
"run": {
|
||||
"command": "perl",
|
||||
"command_arguments": ["-MPerl::LanguageServer", "-e", "Perl::LanguageServer::run", "--", "--port", "${randPort}"],
|
||||
"redirectStderr": false,
|
||||
"redirectStdout": true,
|
||||
"supportsSourceRequest": false
|
||||
},
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"request": "launch",
|
||||
"arguments": {
|
||||
"program": "${file}",
|
||||
"args": "${args}",
|
||||
"stopOnEntry": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -313,8 +313,7 @@ void App::onDocumentUndoRedo( UICodeEditor* editor, TextDocument& doc ) {
|
||||
|
||||
void App::openFileDialog() {
|
||||
UIFileDialog* dialog =
|
||||
UIFileDialog::New( UIFileDialog::DefaultFlags, "*",
|
||||
mLastFileFolder.empty() ? getLastUsedFolder() : mLastFileFolder );
|
||||
UIFileDialog::New( UIFileDialog::DefaultFlags, "*", getDefaultFileDialogFolder() );
|
||||
dialog->setWindowFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
|
||||
dialog->setTitle( i18n( "open_file", "Open File" ) );
|
||||
dialog->setCloseShortcut( KEY_ESCAPE );
|
||||
@@ -335,7 +334,11 @@ void App::openFileDialog() {
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
std::string App::getLastUsedFolder() {
|
||||
std::string App::getDefaultFileDialogFolder() const {
|
||||
return mLastFileFolder.empty() ? getLastUsedFolder() : mLastFileFolder;
|
||||
}
|
||||
|
||||
std::string App::getLastUsedFolder() const {
|
||||
if ( !mCurrentProject.empty() && mCurrentProject != getPlaygroundPath() )
|
||||
return mCurrentProject;
|
||||
if ( !mRecentFolders.empty() )
|
||||
@@ -1751,6 +1754,10 @@ AppConfig& App::getConfig() {
|
||||
return mConfig;
|
||||
}
|
||||
|
||||
const AppConfig& App::getConfig() const {
|
||||
return mConfig;
|
||||
}
|
||||
|
||||
const std::map<KeyBindings::Shortcut, std::string>& App::getRealDefaultKeybindings() {
|
||||
if ( mRealDefaultKeybindings.empty() ) {
|
||||
mRealDefaultKeybindings.insert( mRealLocalKeybindings.begin(),
|
||||
|
||||
@@ -55,6 +55,8 @@ class App : public UICodeEditorSplitter::Client, public PluginContextProvider {
|
||||
|
||||
void openFileDialog();
|
||||
|
||||
std::string getDefaultFileDialogFolder() const;
|
||||
|
||||
void openFolderDialog();
|
||||
|
||||
void openFontDialog( std::string& fontPath, bool loadingMonoFont, bool terminalFont = false );
|
||||
@@ -345,6 +347,8 @@ class App : public UICodeEditorSplitter::Client, public PluginContextProvider {
|
||||
|
||||
AppConfig& getConfig();
|
||||
|
||||
const AppConfig& getConfig() const;
|
||||
|
||||
void updateDocInfo( TextDocument& doc );
|
||||
|
||||
std::vector<std::pair<String::StringBaseType, String::StringBaseType>>
|
||||
@@ -653,7 +657,7 @@ class App : public UICodeEditorSplitter::Client, public PluginContextProvider {
|
||||
|
||||
void onPluginEnabled( Plugin* plugin );
|
||||
|
||||
std::string getLastUsedFolder();
|
||||
std::string getLastUsedFolder() const;
|
||||
|
||||
void insertRecentFolder( const std::string& rpath );
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace ecode {
|
||||
static constexpr auto INPUT_PATTERN = "%$%{input%:([%w_]+)%}"sv;
|
||||
static constexpr auto COMMAND_PATTERN = "%$%{command%:([%w_]+)%}"sv;
|
||||
static constexpr auto CMD_PICK_PROCESS = "${command:pickProcess}"sv;
|
||||
static constexpr auto CMD_PICK_STRING = "${command:pickString}"sv;
|
||||
static constexpr auto CMD_PROMPT_STRING = "${command:promptString}"sv;
|
||||
static constexpr auto CMD_PICK_FILE = "${command:pickFile}"sv;
|
||||
|
||||
static LuaPattern inputPtrn( INPUT_PATTERN );
|
||||
static LuaPattern commandPtrn( COMMAND_PATTERN );
|
||||
@@ -1180,11 +1181,17 @@ DebuggerPlugin::needsToResolveInputs( nlohmann::json& json,
|
||||
if ( it != mDapInputs.end() )
|
||||
inputs[it->first] = it->second;
|
||||
} else if ( String::icontains( val, CMD_PICK_PROCESS ) ) {
|
||||
DapConfigurationInput dci{ "pickprocess", "Process ID", "pickprocess", "", {} };
|
||||
DapConfigurationInput dci{
|
||||
"pickprocess", i18n( "process_id", "Process ID" ), "pickprocess", "", {} };
|
||||
inputs[std::string{ CMD_PICK_PROCESS }] = dci;
|
||||
} else if ( String::icontains( val, CMD_PICK_STRING ) ) {
|
||||
DapConfigurationInput dci{ "pickstring", "Name", "pickstring", "", {} };
|
||||
inputs[std::string{ CMD_PICK_STRING }] = dci;
|
||||
} else if ( String::icontains( val, CMD_PROMPT_STRING ) ) {
|
||||
DapConfigurationInput dci{
|
||||
"promptstring", i18n( "name", "Name" ), "promptstring", "", {} };
|
||||
inputs[std::string{ CMD_PROMPT_STRING }] = dci;
|
||||
} else if ( String::icontains( val, CMD_PICK_FILE ) ) {
|
||||
DapConfigurationInput dci{
|
||||
"pickfile", i18n( "file_path", "File Path" ), "pickfile", "", {} };
|
||||
inputs[std::string{ CMD_PICK_FILE }] = dci;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1567,28 +1574,55 @@ void DebuggerPlugin::runConfig( const std::string& debugger, const std::string&
|
||||
void DebuggerPlugin::resolveInputsBeforeRun(
|
||||
std::unordered_map<std::string, DapConfigurationInput> inputs, DapTool debugger,
|
||||
DapConfig config, std::unordered_map<std::string, std::string> solvedInputs ) {
|
||||
if ( !inputs.empty() ) {
|
||||
auto input = inputs.begin()->second;
|
||||
if ( input.type == "pickprocess"sv ) {
|
||||
UIWindow* win = processPicker();
|
||||
win->setTitle( i18n( "pick_process", "Pick Process" ) );
|
||||
win->center();
|
||||
win->showWhenReady();
|
||||
win->on( Event::OnConfirm, [inputs, win, debugger, config, solvedInputs,
|
||||
this]( const Event* ) mutable {
|
||||
UITableView* uiTableView = win->find( "processes_list" )->asType<UITableView>();
|
||||
auto model = static_cast<ProcessesModel*>( uiTableView->getModel() );
|
||||
std::string inputData(
|
||||
model->data( uiTableView->getSelection().first(), ModelRole::Display )
|
||||
.toString() );
|
||||
std::string id( inputs.begin()->second.id );
|
||||
solvedInputs[id] = inputData;
|
||||
inputs.erase( inputs.begin() );
|
||||
resolveInputsBeforeRun( inputs, debugger, config, solvedInputs );
|
||||
win->closeWindow();
|
||||
} );
|
||||
return;
|
||||
}
|
||||
if ( inputs.empty() ) {
|
||||
prepareAndRun( debugger, config, solvedInputs );
|
||||
return;
|
||||
}
|
||||
|
||||
auto input = inputs.begin()->second;
|
||||
if ( input.type == "pickprocess"sv ) {
|
||||
UIWindow* win = processPicker();
|
||||
win->setTitle( i18n( "pick_process", "Pick Process" ) );
|
||||
win->center();
|
||||
win->showWhenReady();
|
||||
win->on( Event::OnConfirm, [inputs, win, debugger, config, solvedInputs,
|
||||
this]( const Event* ) mutable {
|
||||
UITableView* uiTableView = win->find( "processes_list" )->asType<UITableView>();
|
||||
auto model = static_cast<ProcessesModel*>( uiTableView->getModel() );
|
||||
std::string inputData(
|
||||
model->data( uiTableView->getSelection().first(), ModelRole::Display ).toString() );
|
||||
std::string id( inputs.begin()->second.id );
|
||||
solvedInputs[id] = inputData;
|
||||
inputs.erase( inputs.begin() );
|
||||
resolveInputsBeforeRun( inputs, debugger, config, solvedInputs );
|
||||
win->closeWindow();
|
||||
} );
|
||||
} else if ( input.type == "pickfile" ) {
|
||||
UIFileDialog* dialog = UIFileDialog::New(
|
||||
UIFileDialog::DefaultFlags, "*", getPluginContext()->getDefaultFileDialogFolder() );
|
||||
dialog->setWindowFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
|
||||
dialog->setTitle( i18n( "open_file", "Open File" ) );
|
||||
dialog->setCloseShortcut( KEY_ESCAPE );
|
||||
dialog->setSingleClickNavigation(
|
||||
getPluginContext()->getConfig().editor.singleClickNavigation );
|
||||
dialog->setAllowsMultiFileSelect( false );
|
||||
dialog->on( Event::OpenFile, [this, dialog, inputs, solvedInputs, debugger,
|
||||
config]( const Event* event ) mutable {
|
||||
auto file = event->getNode()->asType<UIFileDialog>()->getFullPath();
|
||||
solvedInputs[inputs.begin()->second.id] = file;
|
||||
inputs.erase( inputs.begin() );
|
||||
resolveInputsBeforeRun( inputs, debugger, config, solvedInputs );
|
||||
dialog->closeWindow();
|
||||
} );
|
||||
dialog->on( Event::OnWindowClose, [this]( const Event* ) {
|
||||
if ( getPluginContext()->getSplitter() &&
|
||||
getPluginContext()->getSplitter()->getCurWidget() &&
|
||||
!SceneManager::instance()->isShuttingDown() )
|
||||
getPluginContext()->getSplitter()->getCurWidget()->setFocus();
|
||||
} );
|
||||
dialog->center();
|
||||
dialog->show();
|
||||
} else {
|
||||
bool isPick = input.type == "pickstring";
|
||||
UIMessageBox* msgBox = UIMessageBox::New(
|
||||
isPick ? UIMessageBox::DROPDOWNLIST : UIMessageBox::INPUT, input.description );
|
||||
@@ -1613,10 +1647,7 @@ void DebuggerPlugin::resolveInputsBeforeRun(
|
||||
resolveInputsBeforeRun( inputs, debugger, config, solvedInputs );
|
||||
msgBox->closeWindow();
|
||||
} );
|
||||
return;
|
||||
}
|
||||
|
||||
prepareAndRun( debugger, config, solvedInputs );
|
||||
}
|
||||
|
||||
void DebuggerPlugin::prepareAndRun( DapTool debugger, DapConfig config,
|
||||
@@ -1644,7 +1675,7 @@ void DebuggerPlugin::prepareAndRun( DapTool debugger, DapConfig config,
|
||||
|
||||
for ( const std::string& cmdArg : config.cmdArgs ) {
|
||||
if ( cmdArg == KEY_FILE || cmdArg == KEY_ARGS || cmdArg == CMD_PICK_PROCESS ||
|
||||
cmdArg == CMD_PICK_STRING )
|
||||
cmdArg == CMD_PROMPT_STRING )
|
||||
forceUseProgram = true;
|
||||
auto args = replaceKeyInString( cmdArg, randomPort, solvedInputs );
|
||||
for ( const auto& arg : args )
|
||||
|
||||
@@ -38,6 +38,7 @@ using namespace EE::UI::Doc;
|
||||
|
||||
namespace ecode {
|
||||
|
||||
class AppConfig;
|
||||
class UIStatusBar;
|
||||
class TerminalManager;
|
||||
class UniversalLocator;
|
||||
@@ -126,6 +127,9 @@ class PluginContextProvider {
|
||||
|
||||
virtual UIMainLayout* getMainLayout() const = 0;
|
||||
|
||||
virtual std::string getDefaultFileDialogFolder() const = 0;
|
||||
|
||||
virtual const AppConfig& getConfig() const = 0;
|
||||
};
|
||||
|
||||
} // namespace ecode
|
||||
|
||||
Reference in New Issue
Block a user