I hava install sublimeGDB in my sublime text 2, and my setting is right.
Then I press F9 in a line to set a breakpoint. When I press F5 to run, I found my program can not stop on the breakpoint, and the program finished running.
The information show below is "GDB session ended". The GDB view is appear in just 0.5 sec., and then disappear.
You have to compile your executable with debug information included by adding -g option to the GDB command line which is not being added by default by Sublime Text C++ build system. Check this answer for more details how to do it.
Related
I am trying to debug tensorflow project, which uses SWIG technique to wrap c++ implementation with python frontend. I want to debug C++ part. Here is what I did:
launch a tensorflow python script in terminal ($pid)
directly using lldb -p $pid works fine, I can set breakpoints, etc.
but I want to use CLion debug GUI, so I click Clion->Run->Attach to Process, find $pid as a native process.
CLion successfully attached to $pid, however, every breakpoint I set in Clion is grey and will not be hit. but if I set breakpoints in embedded lldb console, it works(breakpoint hits and highlight in Clion code file).
the error message on CLion breakpoint is:
Breakpoint will not currently be hit. No executable code is associate
with this line.
P1:
P2:
how to make this right, so that I can set breakpoints in Clion rather lldb command?
Extra information:
tensroflow using bazel to build. I don't use Clion to build. just editing/browsing/debuging. CLion has a bazel plugin, but bind to specific bazel version, not ok for me.
CLion version 2.19.2
I am running my code in Pycharm from Terminal. Is it possible to debug the code and put breakpoints inside the code during a run from terminal?
I don't know anyway to do this through the terminal, but the way I currently do it is:
Run > Edit Configurations > Add new configuration (the green + button)
Choose Python
Fill out Script path, Parameters, and other configuration fields.
Debug the newly added configuration. (Run > Debug...)
With the right configuration the result should be the same as running the script in a terminal.
I find the above process a little tedious. A PEP 553 breakpoint() might be nicer. It requires Python 3.7 and is not implemented yet. See the related issue.
Even if the program is started outside of PyCharm, we can attach PyCharm debugger to it.
Go to Run -> Attach to process.
This will show a list of python process that are currently running on the system. Select the appropriate process from it.
Now PyCharm debugger is connected to that process. We can add breakpoints and debug it.
There is a way using python console.
To run it: Tools -> python console .. or you can find it at the bottom of the IDE.
Then press on 'Attach debugger' line in the following picture:
Add a breakpoint in your code and then pass the file name to the cosole, like: %run my_file.py
I use ubuntu 12.1 64db,I installed code blocks but when I run a project "c project" it gives me "It seems that this project has not been built yet,Do you want to build it now?"
when I click yes it gives Linking console executable: bin/Debug/test /bin/sh: 1: g++: not found
so how can I run the project?
I'll assume that you want to execute your code. In that case, when you want to run it, you must first click yes to building the project. Since you must first compile and link your code into a final executable before it can be run.
Edit: He didn't have g++ >.>
Install g++ with sudo apt-get install g++ and that should solve your issues.
--1. First of all download MinGW : https://sourceforge.net/projects/mingw/ [][1]
[1]: https://i.stack.imgur.com/XJndz.png
--2. Double click the mingw-set-up.exe and press Install. [][1]
[1]: https://i.stack.imgur.com/Pz5Jf.png
--3. Dont change the Installation Directory and press Cointinue
[1]:https://i.stack.imgur.com/boOGj.png
--4. Wait until installed...
[1]: https://i.stack.imgur.com/8WCnJ.png
--5. Then press Continue and wait again..
--6. Mark all files for installation
[1]: https://i.stack.imgur.com/qtq08.png
--7. Go: Intallation --> Apply Changes. Press again Apply and wait the Download Package.
[1]: https://i.stack.imgur.com/mNvtB.png
--8. Press "Close dialogue automatically,.." and wait...
[1]: https://i.stack.imgur.com/65efE.png
--9.You can close MinGW.
--10.Copy the addres of new MinGW bin file which should be C:\MinGW\bin
--11.Right click on your start and press System
--12. Press Advanced system settings--> Environment variable
[1]: https://i.stack.imgur.com/Pr2sL.png
[2]: https://i.stack.imgur.com/TZ1oK.png
--13. In System variables click Path and then Edit.
[1]: https://i.stack.imgur.com/9pCEO.png
--14. Then press New and paste the addres of file "bin" that is inside of file MinGW in Documents(step 10) that should be C:\MinGW\bin.Then press OK-->OK-->OK.
[1]: https://i.stack.imgur.com/pQmFF.png
--15. Open cmd.I mean Right click on your start and press Command Prompt.Write
g++ --version and press enter. [If it is like this you dont have problem][1]
[1]: https://i.stack.imgur.com/a52LH.png
--16. Open Codeblocks go settings-->Compiler. Select" GNU GCC Compiler ".
[1]: https://i.stack.imgur.com/hU9pB.png
--17. Go Toolchain executales and fill in the blanks as in the Screenshot .Files must be in local disk in C:\MinGW\bin chose from there.
CAUTION!!!! This SCREENSHOT IS FOR 32-BIT SYSTEMS. I am not sure for 64-Bit systems. [32-BIT SYSTEMS][1]
[1]: https://i.stack.imgur.com/8JJh0.png
--18. If you have 64-Bit dont do the 17st step and tried if it works .If it's not work do the 17st step.If it's not work again try to put files (to "C compiler", "c++ compiler" and to "linker for dynamics li") that have almost the same name as the files that are in screenshot.
I'd like to add a file to my project that has a list of gbd commands and load that into GDB within xcode at any breakpoint. Looking at GDB documentation I see the "source" commmand, but it is unknown within xcode's gdb. Has anyone had success doing this?
source -f commandfile.gdb
Thanks,
The source command appears to work although no options are supported if you are really using gdb as the debugger. In the debug console make sure it says "(gdb)" as the prompt. The default debugger now is LLDB instead of GDB. You can change this under Product -> Edit Schemeā¦ and select the "Info" tab at the top. The "Debugger" popup will present you with GDB or LLDB.
I am building a program on Mac OS that uses the curses library. When I attempt to run it inside Xcode, I get this error message:
Error opening terminal: unknown.
And then curses calls exit.
Obviously, it works from a Terminal window.
Is it possible to launch my program in a terminal window from Xcode? I know that I can use the "Wait for XXX to launch" option, but a lot of Xcode's helpfulness in starting programs vanishes that way, so I would be looking for another way.
Xcode uses GDB, or LLDB for debugging.
You can invoke them directly from a terminal. This way, your executable will be attached to a working one.
Try:
gdb path/to/my/executable
Then, from the GDB prompt, type:
run
To start your program in debugging mode.
Take a look at the GDB manual for learning stuff like debugging commands, breakpoints, etc.