How can I debug my Program with optirun or primusrun? When simply running it, I can use the workaround of running primusrun with my program as parameter, but this does not work for debugging. I tried replacing "gdb" with "primusrun gdb" and starting eclipse with primusrun but it does not do anything.
You can start Eclipse under primusrun. gdb and the debbugged process will "inherit" this, thus running themselves on the discrete card.
Unfortunately, this means that Eclipse itself is also holding the card active, thereby increasing the power consumption.
Instead of having to start Eclipse using optirun, you can change the command used to launch GDB as follows:
Click on "Debug configurations..." on the Run menu.
Click on the launch configuration for your application.
Go to the Debugger tab.
Change the "GDB debugger" field to optirun gdb.
On my system (eclipse neon, Debian stretch), you have to put a absolute path to make this working (/usr/bin/optirun gdb).
For Run Configurations another solution is to set optirun (absolute path) as "C/C++ Application" and the name of your Application (e.g. "Debug/appName") as an Argument ("Arguments" Tab, "Program arguments").
Related
In a VScode C/C++ programming setup on Windows 10 system, the "C/C++ Extension Pack", "Code Runner", "WSL" extensions are installed, which use Alpine Linux target on WSL on this PC. Alpine Linux WSL instance has the gcc dev environment, build-tools, gdb etc. installed, apart from the necessary VScode extensions needed inside WSL.
In this environment I am able to write C/C++ programs, build them, execute them, interact with them through the built-in terminal. I use the "Code Runner" "Run C/C++ file" shortcut button to build(if necessary) and run individual C/C++ program files (there is no Makefile and these are simple programs all thrown in a single folder, not in a project structure).
Recently however, I noticed that whenever I try to "Run C/C++ file", debugger is also launched and I get a screen like this (notice the 2 yellow/orange arrows indicating what I am trying to draw attention to):
I do not remember this being the case earlier, but I think this started after I tried to debug a program by setting a breakpoint, which I later cleared. I've also ensured that "Run > Remove All Breakpoints" is done, to make sure that there are absolutely no breakpoints. Therefore wondering if:
it is normal for debugger to get launched in this manner ?
if not, what exactly might have caused it ?
finally, what can I do to make sure that the debugger is not launched, when all I want to do is "Run" ?
In "Code Runner" settings file, I did not find anything that might control this behaviour, but then I am quite new to VScode so not sure if I am missing anything obvious.
I'm new to Macs but I don't think this is a problem that comes from that. I've been attempting to set up GDB as a debugger for programming in golang on Eclipse. I know how to do it for the most part, but at some point one of the steps is to open up your debug preferences in the C/C++ configuration and fill in the path of where the debugger is located. Unfortunately, the option doesn't even show up for me:
Why doesn't the "GDB" option show up under Preferences >> C/C++ >> Debug? If i'm not mistaken, it should be a part of the CDT package correct? Am I just using the wrong version? It should be giving me this option:
At least it does for Neil Craft, the author of this tutorial
For anyone coming here looking for an answer:
https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html#eclipse
If there is no GDB section in the C/C++Debug subtree, close the preferences window, and try to first start a debugging session for any project that you can already run without problems. You can do it by either clicking the Debug button on the toolbar, or selecting RunDebug from the main menu. This attempt will, of course, fail with an error message about the gdb command, but it will force the said C/C++DebugGDB settings to appear in the preferences.
I'm trying to get debugging of go programs working in eclipse Luna with goclipse v0.11.0 on OS-X 10.9.5. I am using GNU gdb (GDB) 7.9.1 from brew, and go1.4.2.
I successfully installed and code-signed gdb using instructions here:
http://ntraft.com/installing-gdb-on-os-x-mavericks/
I am building my go program with -gcflags "-N -l" and I can successfully debug it at the command line, including setting breakpoints at go functions and stepping through them with the gdb command line, with source appearing as it should.
However, in goclipse I cannot set a breakpoint at all, because the 'toggle breakpoint' item on the menu is greyed out, and the 'Breakpoint Types' list says 'none available'.
If I select 'Stop on Startup at' 'main', then I can step through assembler, which is unhelpful, but proves gdb is being used.
If I keep the above option set, wait until the program hits the main breakpoint, and type (at the gdb console within eclipse) break main.foo, then cont, then a breakpoint is set in the right place, and I can step through things in the Eclipse IDE. Thus it appears the only issue is setting the breakpoints in the IDE.
The go program concerned is a single file and it works under command line gdb, and I have deleted the binary and started afresh, so this is not a 'need a rebuild' issue.
Related question: How to debug Go programs using GoClipse? however the two answers there are 'disable Stop on Startup' (which makes no difference here), and ensuring -gcflags "-N -l" is given (which makes no difference).
Screenshot:
Any ideas?
I recently switched to Eclipse (Helios) for my programming needs, and I like it very much.
There is just on thing that is driving me crazy, how can I launch (compile and run) my code into the native mac osx terminal.
I tried creating an "external tools configuration", but that just starts the terminal without outputting the application.
What I do now is right-click on the binary in the Project Explorer and then "Open With" and then "Other" and then I pick the terminal app from the list. But this solution is driving me nuts.
Please help.
It's all about defining the External Tool correctly.
For example, the following should work if your selected file is a Unix executable.
Open a new External Tool configuration.
Set the location to /usr/bin/open
Set Working directory as ${selected_resource_loc}
Set the arguments to -a /Applications/Utilities/Terminal.app ${selected_resource_loc}
When you run make sure you select "src"
This should work. You could improve it further. You could even write an AppleScript that would do that and run it using osascript.
I'm currently writing some ncurses code and the native Eclipse (3.2.2) console can't display its graphics. I'd instead like to run the program through xterm. What I want is to be able to start xterm and run from there. I'd prefer to not get involved with any plugins or that jazz. Just something simple.
EDIT
So I have the answer and it was pretty simple...
Run -> External Tools -> External Tools -> New Launch Config...
Then select location of your terminal emulator. /usr/bin/gnome-terminal in my case.
after that set the appropriate arguments. "-e ~/ncurses/start" in my case.
Then make sure you aren't allocating a console by unchecking that option in the "Common" tab.
Annon add to his question:
its a pain to keep switching back and forth from eclipse and the terminal. I'm looking for a way to just hit something like"F5" and have it run my ncurses program in a new xterm terminal process
The simplest way to do that is to report the command line into an external tool configuration, and point eclipse to use a shell (like described in this program)
In the argument, you will add the command line eclipse execute (command line which can be retrieved as mentioned in the second part of this answer below).
Of course, replace 'cmd.exe' by the shell of your choice, and try not setting the 'Allocate Console' checkbox in the Common tab of that external launcher.
To launch through a xterm, without eclipse involved (not what you are asking for, just keep here for archive)
You can launch your program through Eclipse (Run Configurations), and observe through a 'ps' command the exact Java command line used.
Or launch it in debug mode, and right click the task in Debug view and open Properties. It will show the command line, as documented here.
Then launch that command line directly in your console (Eclipse being not involved at all at this point).