diff --git a/src/debug_clang.cc b/src/debug_clang.cc index 7580ebb..9503a2e 100644 --- a/src/debug_clang.cc +++ b/src/debug_clang.cc @@ -41,7 +41,8 @@ void Debug::Clang::start(const std::string &command, const boost::filesystem::pa const std::vector > &breakpoints, std::function callback, std::function status_callback, - std::function stop_callback) { + std::function stop_callback, + const std::string &plugin, const std::string &url) { if(!debugger) { lldb::SBDebugger::Initialize(); debugger=std::unique_ptr(new lldb::SBDebugger(lldb::SBDebugger::Create(true, log, nullptr))); @@ -100,7 +101,10 @@ void Debug::Clang::start(const std::string &command, const boost::filesystem::pa } lldb::SBError error; - process = std::unique_ptr(new lldb::SBProcess(target.Launch(*listener, argv, const_cast(environ), nullptr, nullptr, nullptr, path.string().c_str(), lldb::eLaunchFlagNone, false, error))); + if(!plugin.empty() && plugin!="host") + process = std::unique_ptr(new lldb::SBProcess(target.ConnectRemote(*listener, url.c_str(), plugin.c_str(), error))); + else + process = std::unique_ptr(new lldb::SBProcess(target.Launch(*listener, argv, const_cast(environ), nullptr, nullptr, nullptr, path.string().c_str(), lldb::eLaunchFlagNone, false, error))); if(error.Fail()) { Terminal::get().async_print(std::string("Error (debug): ")+error.GetCString()+'\n', true); if(callback) @@ -486,6 +490,10 @@ void Debug::Clang::write(const std::string &buffer) { std::vector Debug::Clang::get_platform_list() { //Could not find a way to do this through liblldb + static std::vector platform_list; + if(!platform_list.empty()) + return platform_list; + std::stringstream stream; Process process(Config::get().terminal.lldb_command, "", [&stream](const char *bytes, size_t n) { stream.write(bytes, n); @@ -494,10 +502,9 @@ std::vector Debug::Clang::get_platform_list() { process.close_stdin(); auto exit_status=process.get_exit_status(); if(exit_status!=0) { - Terminal::get().print("Error (debug): "+Config::get().terminal.lldb_command+" returned "+std::to_string(exit_status)+'\n'); + Terminal::get().print("Error (debug): "+Config::get().terminal.lldb_command+" returned "+std::to_string(exit_status)+'\n', true); return {}; } - std::vector platform_list; std::string line; while(std::getline(stream, line)) { if(line.find("host")==0 || line.find("remote-")==0) { diff --git a/src/debug_clang.h b/src/debug_clang.h index ad0e1b3..3373ad9 100644 --- a/src/debug_clang.h +++ b/src/debug_clang.h @@ -43,7 +43,8 @@ namespace Debug { const std::vector > &breakpoints={}, std::function callback=nullptr, std::function status_callback=nullptr, - std::function stop_callback=nullptr); + std::function stop_callback=nullptr, + const std::string &plugin="", const std::string &url=""); void continue_debug(); //can't use continue as function name void stop(); void kill(); diff --git a/src/notebook.cc b/src/notebook.cc index 5df5de2..c226a3d 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -444,8 +444,10 @@ std::pair Notebook::get_notebook_page(size_t index) { void Notebook::set_current_view(Source::View *view) { intermediate_view=nullptr; if(current_view!=view) { - if(auto view=get_current_view()) + if(auto view=get_current_view()) { + view->hide_tooltips(); view->hide_dialogs(); + } current_view=view; if(on_change_page) on_change_page(view); diff --git a/src/project.cc b/src/project.cc index e3d06fb..2e2d822 100644 --- a/src/project.cc +++ b/src/project.cc @@ -158,28 +158,26 @@ void Project::Base::debug_start() { #ifdef JUCI_ENABLE_DEBUG Project::Clang::DebugOptionsPopover::DebugOptionsPopover() : Gtk::Popover() { - auto platform_list=Debug::Clang::get_platform_list(); - for(auto &platform: platform_list) - platform_list_combo_box_text.append(platform); - if(platform_list_combo_box_text.get_model()->children().size()>0) - platform_list_combo_box_text.set_active(0); - url_entry.set_sensitive(false); - platform_list_combo_box_text.signal_changed().connect([this]() { - url_entry.set_sensitive(platform_list_combo_box_text.get_active_row_number()>0); + auto lldb_platform_list=Debug::Clang::get_platform_list(); + for(auto &platform: lldb_platform_list) + platform_list.append(platform); + if(platform_list.get_model()->children().size()>0) + platform_list.set_active(0); + url.set_sensitive(false); + platform_list.signal_changed().connect([this]() { + url.set_sensitive(platform_list.get_active_row_number()>0); }); - url_entry.set_placeholder_text("URL"); + url.set_placeholder_text("URL"); - cross_compiling_vbox.pack_start(platform_list_combo_box_text, true, true); - cross_compiling_vbox.pack_end(url_entry, true, true); + cross_compiling_vbox.pack_start(platform_list, true, true); + cross_compiling_vbox.pack_end(url, true, true); cross_compiling_frame.set_label("Cross Compiling"); cross_compiling_frame.add(cross_compiling_vbox); vbox.pack_start(cross_compiling_frame, true, true); - not_yet_implemented_label.set_text("Not yet implemented"); - vbox.pack_end(not_yet_implemented_label, true, true); add(vbox); show_all(); set_visible(false); @@ -351,6 +349,13 @@ void Project::Clang::debug_start() { if(exit_status!=EXIT_SUCCESS) debugging=false; else { + std::string plugin, url; + auto options_it=debug_options_popovers.find(project_path.string()); + if(options_it!=debug_options_popovers.end()) { + auto plugin_selection=options_it->second.platform_list.get_active_text(); + plugin=plugin_selection.substr(0, plugin_selection.find("\n")); + url=options_it->second.url.get_text(); + } std::unique_lock lock(debug_start_mutex); Debug::Clang::get().start(run_arguments, project_path, *breakpoints, [this, run_arguments](int exit_status){ debugging=false; @@ -369,7 +374,7 @@ void Project::Clang::debug_start() { if(auto view=Notebook::get().get_current_view()) view->get_buffer()->place_cursor(view->get_buffer()->get_insert()->get_iter()); }); - }); + }, plugin, url); } }); } diff --git a/src/project.h b/src/project.h index ea7c411..fe550da 100644 --- a/src/project.h +++ b/src/project.h @@ -61,13 +61,12 @@ namespace Project { class DebugOptionsPopover : public Gtk::Popover { public: DebugOptionsPopover(); + Gtk::ComboBoxText platform_list; + Gtk::Entry url; private: Gtk::VBox vbox; Gtk::Frame cross_compiling_frame; Gtk::VBox cross_compiling_vbox; - Gtk::ComboBoxText platform_list_combo_box_text; - Gtk::Entry url_entry; - Gtk::Label not_yet_implemented_label; }; static std::unordered_map debug_options_popovers; #endif diff --git a/src/source.cc b/src/source.cc index 0a41a9a..3469759 100644 --- a/src/source.cc +++ b/src/source.cc @@ -418,7 +418,7 @@ void Source::View::set_tooltip_and_dialog_events() { delayed_tooltips_connection.disconnect(); if(mark->get_name()=="insert") { - delayed_tooltips_connection.disconnect(); + hide_tooltips(); delayed_tooltips_connection=Glib::signal_timeout().connect([this]() { Tooltips::init(); Gdk::Rectangle rectangle; @@ -434,8 +434,6 @@ void Source::View::set_tooltip_and_dialog_events() { } return false; }, 500); - type_tooltips.hide(); - diagnostic_tooltips.hide(); if(autocomplete_dialog) autocomplete_dialog->hide(); @@ -458,7 +456,7 @@ void Source::View::set_tooltip_and_dialog_events() { }); signal_leave_notify_event().connect([this](GdkEventCrossing*) { - delayed_tooltips_connection.disconnect(); + hide_tooltips(); return false; }); } diff --git a/src/window.cc b/src/window.cc index d80270c..4e68680 100644 --- a/src/window.cc +++ b/src/window.cc @@ -147,8 +147,10 @@ Window::Window() { }; signal_focus_out_event().connect([](GdkEventFocus *event) { - if(auto view=Notebook::get().get_current_view()) + if(auto view=Notebook::get().get_current_view()) { + view->hide_tooltips(); view->hide_dialogs(); + } return false; });