Josh Posted March 10, 2019 Share Posted March 10, 2019 This topic is for discussion of experimental support for the Codelite IDE for Linux, created by @reepblue I added a file "$PROJECT_NAME.debug.sh" for the debug build to launch. The project settings need the debug executable to be defined like this: <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="../../$(ProjectName).debug.sh" IsExtended="no"> <DebuggerSearchPaths/> <PostConnectCommands/> <StartupCommands/> </Debugger> I see in the project settings for the Debug configuration, the symbol "g" is passed to GCC, which I think makes it keep debug symbols, but the program still does not stop on breakpoints. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted March 10, 2019 Share Posted March 10, 2019 I'm attaching the files here if anyone wishes to experiment with it. Install within your "/home/username/.steam/steam/steamapps/common/Leadwerks/Templates/Common/Projects" directory. "Linux_CodeLite should sit with the Existing Windows and Linux folders. Looks like we just need to get the debugger system configured. If anyone has any insight, let us know! On my end, I'm getting this. Not sure it's because we are launching a shell script instead of the actual application or not. Linux_CodeLite_Test.zip Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted March 10, 2019 Author Share Posted March 10, 2019 I updated the editor so the file permissions for those .sh files get copied over, so they are executable as soon as you create a new project. See my explanation above for the debug executable. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted March 10, 2019 Share Posted March 10, 2019 Really weird. Now I can't launch the application from CodeLite at all. I can the scripts run it from the terminal just fine. ? Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
reepblue Posted March 10, 2019 Share Posted March 10, 2019 Here is hl2.sh file. There is debugging information that looks like it might help. #!/bin/bash # figure out the absolute path to the script being run a bit # non-obvious, the ${0%/*} pulls the path out of $0, cd's into the # specified directory, then uses $PWD to figure out where that # directory lives - and all this in a subshell, so we don't affect # $PWD GAMEROOT=$(cd "${0%/*}" && echo $PWD) #determine platform UNAME=`uname` if [ "$UNAME" == "Darwin" ]; then # prepend our lib path to LD_LIBRARY_PATH export DYLD_LIBRARY_PATH="${GAMEROOT}"/bin:$DYLD_LIBRARY_PATH elif [ "$UNAME" == "Linux" ]; then # prepend our lib path to LD_LIBRARY_PATH export LD_LIBRARY_PATH="${GAMEROOT}"/bin:$LD_LIBRARY_PATH fi if [ -z $GAMEEXE ]; then if [ "$UNAME" == "Darwin" ]; then GAMEEXE=hl2_osx elif [ "$UNAME" == "Linux" ]; then GAMEEXE=hl2_linux fi fi ulimit -n 2048 # enable nVidia threaded optimizations export __GL_THREADED_OPTIMIZATIONS=1 # and launch the game cd "$GAMEROOT" # Enable path match if we are running with loose files if [ -f pathmatch.inf ]; then export ENABLE_PATHMATCH=1 fi # Do the following for strace: # GAME_DEBUGGER="strace -f -o strace.log" # Do the following for tcmalloc # LD_PRELOAD=../src/thirdparty/gperftools-2.0/.libs/libtcmalloc_debug.so:$LD_PRELOAD STATUS=42 while [ $STATUS -eq 42 ]; do if [ "${GAME_DEBUGGER}" == "gdb" ] || [ "${GAME_DEBUGGER}" == "cgdb" ]; then ARGSFILE=$(mktemp $USER.hl2.gdb.XXXX) echo b main > "$ARGSFILE" # Set the LD_PRELOAD varname in the debugger, and unset the global version. This makes it so that # gameoverlayrenderer.so and the other preload objects aren't loaded in our debugger's process. echo set env LD_PRELOAD=$LD_PRELOAD >> "$ARGSFILE" echo show env LD_PRELOAD >> "$ARGSFILE" unset LD_PRELOAD echo run $@ >> "$ARGSFILE" echo show args >> "$ARGSFILE" ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} -x "$ARGSFILE" rm "$ARGSFILE" else ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@" fi STATUS=$? done exit $STATUS I need to fix LAUNCHING the game from the IDE first, but I still think this holds the key. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted March 10, 2019 Author Share Posted March 10, 2019 Make sure your .sh files have permissions that say "allow running as executable" in the file properties. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted March 10, 2019 Share Posted March 10, 2019 Ok, turns out, $PROJECT_PATH was fixed in a push earlier which broke my setup. Getting the same results as Josh now which the debugger doesn't stop at the break points. Uploaded update. Linux_CodeLite_updated.zip Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
reepblue Posted March 10, 2019 Share Posted March 10, 2019 Got it to work. We need to write better launch scripts... export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}" gdb ./CodeLiteTest.debug "$@" #exec "./CodeLiteTest.debug" "$@" 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
reepblue Posted March 10, 2019 Share Posted March 10, 2019 Ok, after that win, we have 2-3 options. Edit the script file to launch the debugger in the debug shell script. The shell script can not be launched alone without a debugger attached, but the editor seems to execute the debug application directly and why would you execute the debug version with no debuggers attached? Figure out a way to pass a value so our script knows we are setting a debugger to the application. Make a new script for the gdb use. I say we go with option 1 to be honest. Also noticed that any arguments being set from CodeLite isn't passing through. export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}" gdb ./$PROJECT_NAME.debug "$@" Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted March 10, 2019 Author Share Posted March 10, 2019 Here's how command-line arguments work going through the shell script: http://faculty.salina.k-state.edu/tim/unix_sg/shell/variables.html#command-line-arguments And passing arguments from GDB to the program is here: https://sourceware.org/gdb/current/onlinedocs/gdb/Invoking-GDB.html#Invoking-GDB One simple way to test is to add -devmode to the project arguments for the debug configuration. This will make the game always launch in a windowed application. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted March 10, 2019 Share Posted March 10, 2019 Did a test from the terminal. Reported it as a bug. I can't test running the app directly as we need to set the Library path first. ? Only fix is to add a bogus flag at the end (ex: -devmode -l) Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
reepblue Posted March 10, 2019 Share Posted March 10, 2019 Here's my latest work. Shell script changed, and the app launches in -devmode. For now, I had to add a dummy flag so the -devmode flag would set correctly until that bug gets fixed. At this point, the project manager will just copy the files, and it will "just work" with the debugger and all. Linux_CodeLite-nearfinal.zip Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted March 10, 2019 Author Share Posted March 10, 2019 I'm not sure there is a bug. See my reply. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
aiaf Posted March 15, 2019 Share Posted March 15, 2019 Why not just use Visual Studio Code with Leadwerks 4.6 ? the debugger works well . Using this kind of setup for long time. For new users just missing a way to easy build, i think a task can be created to build the project Ps didnt use codelite so far , maybe is good , so just asking Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Josh Posted March 15, 2019 Author Share Posted March 15, 2019 I don't know how to set up VSCode with a compiler. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted March 15, 2019 Share Posted March 15, 2019 I'm open for a VSCode setup. How would you go about doing this? Keep in mind that it's common for Linux users to be im anti-Microsoft; they have a sour taste for Microsoft products. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
aiaf Posted March 16, 2019 Share Posted March 16, 2019 This article say much of it https://code.visualstudio.com/docs/languages/cpp Short version: After you install the c/c++ extension. Open the project folder and press Add folder to workpspace, now your project is a workspace and you can see a .vscode directory. launch.json launches your game with gdb, you have to add the binary there. { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/structura", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] } Press Ctrl-Shift-B for the tasks menu.Add a new build task. You need a way to build the project, vscode doesnt provide it for you. I have a cmake project and use it as below, but any other way will work. I investigated a bit ,there is a program cbp2make (sudo apt get cb2make) , that transforms the cbp project to a normal makefile. I didnt test it , but if it works you could just add a make in the tasks.json below. { // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "testbuild", "type": "shell", "command": "cmake --build .", "group": { "kind": "build", "isDefault": true } } ], "group": { "kind": "build", "isDefault": true } } After this when you press Ctrl - Shift - B it will run your build. Then debug as needed. Only issue could be you need to modify the makefile when you add new files , vscode isnt made to do that for you. Im pretty sure anyone starting with a c++ engine would have heard of makefiles. 1 Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.