Debugger Not starting

General questions regarding the usage of CodeLite
dinabandhu
CodeLite Enthusiast
Posts: 10
Joined: Sun Sep 27, 2020 11:38 pm
Genuine User: Yes
IDE Question: C++
Contact:

Debugger Not starting

Post by dinabandhu »

Hi,

I have created a simple basic console executable project (create a workspace and and a simple executable g++ project). I am trying t debug the default main.cpp generated by codelite. I get the following error when I hit "Debugger->Start/Continue Debugger".
Screenshot from 2020-10-04 08-29-36.png
My environment is as follows

codelite version - 14.0.0
Self Compiled - Yes
OS - Ubuntu 18.04 (64 bit) on Raspberry Pi 4
Compiler - g++ 7.5.0

I am new to codelite and would appreciate any help/guidance

Thanks & regards,
Dinabandhu
You do not have the required permissions to view the files attached to this post.
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Debugger Not starting

Post by DavidGH »

Hi,

The message should read:
Failed to launch debugger 'gdb': debugger not loaded
(or 'lldb' if that's what you use).

First, the obvious question: Do you have a debugger installed? If not...

Next, open your project's Settings (the spanner icon in the Workspace toolbar). The bottom section of its General page is 'Debugging'. The first line will say which debugger is your current choice; that field will shown a dropdown arrow if you click on it. What do you see?

Those are the easy questions, so I'll pause at this point :) .

Regards,

David
dinabandhu
CodeLite Enthusiast
Posts: 10
Joined: Sun Sep 27, 2020 11:38 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Not starting

Post by dinabandhu »

Hi David,

Thanks for your response.
DavidGH wrote: Sun Oct 04, 2020 1:04 pm First, the obvious question: Do you have a debugger installed? If not...
Yes... I think I have gdb installed. Please see the following outputs ....

++++++++++++++++++++++++++++++++++++++++++++++++
ubuntu@ubuntu:~$ sudo apt-get install gdb
Reading package lists... Done
Building dependency tree
Reading state information... Done
gdb is already the newest version (8.1-0ubuntu3.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ubuntu@ubuntu:~$ ls -l /usr/bin/gdb
-rwxr-xr-x 1 root root 7038112 Oct 30 2019 /usr/bin/gdb
++++++++++++++++++++++++++++++++++++++++++++++++++++
ubuntu@ubuntu:~$ gdb
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb)
++++++++++++++++++++++++++++++++++++++++++++++
DavidGH wrote: Sun Oct 04, 2020 1:04 pm Next, open your project's Settings (the spanner icon in the Workspace toolbar). The bottom section of its General page is 'Debugging'. The first line will say which debugger is your current choice; that field will shown a dropdown arrow if you click on it. What do you see?
The dropdown is blank ... doesn't show anything.


I also tried setting debugger path in project->setting like the following ... no luck
Screenshot from 2020-10-04 15-21-34.png
I must be doing something very stupid ... any pointers you can give would be great.

Thanks & regards,
Dinabandhu
You do not have the required permissions to view the files attached to this post.
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Debugger Not starting

Post by DavidGH »

I must be doing something very stupid
No, not at all! There is clearly a bug somewhere, possibly in the system but more likely in CodeLite. Guessing what and where isn't easy though, and I can't debug here.

First, close CodeLite and temporarily rename your Workspace, so that you don't lose it. Restart CodeLite, create a new workspace and project and see if that still has the problem. I expect it will, but you never know.

Second, have a look in your project settings file: it's probably ~/Documents/<workspace-name>/Test.project. Check it contains a line similar to:

Code: Select all

<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="/usr/bin/gdb" IsExtended="no">
If it doesn't, you could try (closing the workspace, and then) editing it to add the correct DebuggerPath. If CodeLite then can manage to call gdb, that at least solves the current problem for you.

If neither help, then the only alternative I can think of is to debug CodeLite. That means someone with a RPi needs to create a debug build...
dinabandhu
CodeLite Enthusiast
Posts: 10
Joined: Sun Sep 27, 2020 11:38 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Not starting

Post by dinabandhu »

Hi David,

This is what I did
I created a new project ... no luck.

I Closed the project and opened the project file in a text editor. A debugger element is there but the attribute DebuggerPath="".

I opened the project and set debugger path manually in Project->Settings->Debugger->Debugger Path to /usr/bin/gdb.

Now the project xml has the correct gdb .. DebuggerPath="/usr/bin/gdb" ... but still no luck ...

I saw in debugger configuration that it loads some python scripts as gdb printers can there be problems?
dinabandhu wrote: Sun Oct 04, 2020 1:57 pm If neither help, then the only alternative I can think of is to debug CodeLite. That means someone with a RPi needs to create a debug build...
That sounds ominous :( ... but if that's the only way ... will try my best ... please give me some guidance on how to go about it.

Thanks & regards,
Dinabandhu
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Debugger Not starting

Post by DavidGH »

I saw in debugger configuration that it loads some python scripts as gdb printers can there be problems?
Not quite: there are scripts supplied, but the debugger has to run before it loads them.
please give me some guidance on how to go about it.
The same as before, but instead of:
cmake -DCMAKE_BUILD_TYPE=Release
the cmake line starts with:
cmake -DCMAKE_BUILD_TYPE=DebugFull

You may also wish to install locally, rather than to /usr/* If so, do something like:

Code: Select all

(mkdir -p build-dbg && cd build-dbg/ && cmake -G "Unix Makefiles" VERBOSE=1 -DCMAKE_BUILD_TYPE=DebugFull  -DCL_PREFIX=$(pwd)/../CL-install .. && make -j`nproc` && make install)
You will then have a debug build that you can run by doing (if you're in the source dir):
CL-install/bin/codelite
and debug by doing
gdb CL-install/bin/codelite

One place to put a breakpoint is
IDebugger* dbgr = DebuggerMgr::Get().GetActiveDebugger();
in ./LiteEditor/manager.cpp line 2092 (approximately; I'm looking at git head, not 14.0)
and step in.

Good luck!
dinabandhu
CodeLite Enthusiast
Posts: 10
Joined: Sun Sep 27, 2020 11:38 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Not starting

Post by dinabandhu »

Hi,

Now that you mention it, I realized I have also built from git head(master branch). Is that an issue? Should I checkout the 14.0 tag and build from that?

Thanks & Regards,
Dinabandhu
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Debugger Not starting

Post by DavidGH »

No, the current git head is fine. I doubt if it will behave differently from 14.0 when loading gdb.
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Not starting

Post by eranif »

Hi,

Can you post a screenshot of this dialog:
Settings -> GDB Settings

You should have tab per debugger plugin installed.
This will confirm if the GDB plugin is loaded (it does not matter if you have gdb installed locally or not)

You can also confirm that CodeLite loaded the GDB plugin from:

- In CodeLite, change the log verbosity of CodeLite: Settings -> Preferences -> Misc -> Log -> Log file verbosity -> Debug
- Close CodeLite
- Open CodeLite

Check for entries in the log file: ~/.codelite/codelite.log similar to this:

Code: Select all

[11:52:42:276 DBG] [Main] Attempting to load debugger: C:\src\codelite\Runtime\debuggers\DebuggerGDB.dll
[11:52:42:277 DBG] [Main] Loaded debugger: GNU gdb debugger, Version: v2.0
Eran
Make sure you have read the HOW TO POST thread
dinabandhu
CodeLite Enthusiast
Posts: 10
Joined: Sun Sep 27, 2020 11:38 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Not starting

Post by dinabandhu »

Hi David,

The problem seems to be sorted.

This is what I did,

1. Built the debug version and run thru gdb, it worked.
2. Run the debug version straight, it still worked.
3. Run the release version I had again and it didn't work.
4. I thought that we had kind of manipulated around the problem in CMakeLists.txt in the original release build, may be that is the problem.
5. I tried a clean release build with your fix in CMakeLists.txt.
6. It worked, now I can debug :D

@Eran,
You are right ... I noticed today that when I try to create a new project, the debugger field is grayed out. But now it looks sorted out and shows gdb.

Thanks guys, for your time, patience and help. I can't appreciate it enough.

Thanks & regards,
Dinabandhu
Post Reply