Ubuntu debug doesn't display variables

General questions regarding the usage of CodeLite
Dino
CodeLite Enthusiast
Posts: 14
Joined: Thu Aug 17, 2023 9:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Ubuntu debug doesn't display variables

Post by Dino »

I have GDB configured for pretty printing.

CodeLite 17.0.0

oem@dino-linux-pc:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

partial log capture:

Code: Select all

Using gdbinit file: /home/oem/.codelite-gdbinit
Current working dir: /home/oem/Workspaces/section15/15_challenge
Launching gdb from : /home/oem/Workspaces/section15/build-Debug/lib
Starting debugger  : /usr/bin/gdb --command="/home/oem/.codelite-gdbinit" --tty=/dev/pts/3 --interpreter=mi "/home/oem/Workspaces/section15/build-Debug/bin/15_challenge"
DEBUG>>set unwindonsignal on
DEBUG>>set breakpoint pending on
DEBUG>>set print object on
DEBUG>>set width 0
DEBUG>>set height 0
DEBUG>>set pagingation off
DEBUG>>set debuginfod enabled off
DEBUG>>set print elements 200
DEBUG>>python
DEBUG>>import sys
DEBUG>>sys.path.insert(0, '$CodeLiteGdbPrinters')
DEBUG>>from libstdcxx.v6.printers import register_libstdcxx_printers
DEBUG>>register_libstdcxx_printers (None)
DEBUG>>from qt4 import register_qt4_printers
DEBUG>>register_qt4_printers (None)
DEBUG>>from wx import register_wx_printers
DEBUG>>register_wx_printers (None)
DEBUG>>end
DEBUG>>00000001-break-insert -f "/home/oem/Workspaces/section15/15_challenge/main.cpp:15"
DEBUG>>00000002-break-insert -f "/home/oem/Workspaces/section15/15_challenge/main.cpp:16"
DEBUG>>00000003-enable-pretty-printing
Debug session started successfully!
DEBUG>>00000004-exec-arguments
DEBUG>>00000005-exec-run
DEBUG>>=thread-group-added,id="i1"
=thread-group-added,id="i1"
DEBUG>>~"GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1\n"
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
DEBUG>>~"Copyright (C) 2022 Free Software Foundation, Inc.\n"
Copyright (C) 2022 Free Software Foundation, Inc.
DEBUG>>~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.
DEBUG>>~"\nType \"show copying\" and \"show warranty\" for details.\n"
\nType "show copying" and "show warranty" for details.
DEBUG>>~"This GDB was configured as \"x86_64-linux-gnu\".\n"
This GDB was configured as "x86_64-linux-gnu".
DEBUG>>~"Type \"show configuration\" for configuration details.\n"
Type "show configuration" for configuration details.
DEBUG>>~"For bug reporting instructions, please see:\n"
For bug reporting instructions, please see:
DEBUG>>~"<https://www.gnu.org/software/gdb/bugs/>.\n"
<https://www.gnu.org/software/gdb/bugs/>.
DEBUG>>~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."
Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>.
DEBUG>>~"\n\n"
\n
DEBUG>>~"For help, type \"help\".\n"
For help, type "help".
DEBUG>>~"Type \"apropos word\" to search for commands related to \"word\"...\n"
Type "apropos word" to search for commands related to "word"...
DEBUG>>~"Reading symbols from /home/oem/Workspaces/section15/build-Debug/bin/15_challenge...\n"
Reading symbols from /home/oem/Workspaces/section15/build-Debug/bin/15_challenge...
DEBUG>>&"\"/home/oem/.codelite-gdbinit\": No such file or directory.\n"
DEBUG>>&"set unwindonsignal on\n"
DEBUG>>=cmd-param-changed,param="unwindonsignal",value="on"
=cmd-param-changed,param="unwindonsignal",value="on"
DEBUG>>^done

Any suggestions?

Thanks,
Dino

Last edited by DavidGH on Fri Aug 18, 2023 2:03 pm, edited 1 time in total.
Reason: Added code-tags
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Ubuntu debug doesn't display variables

Post by DavidGH »

Hi,

That's strange. My (VirtualBox) jammy shows them OK:

DebuggerTip.png

Look in Settings > GDB settings. I have the following:

EnablePrettyPrinters.png

and

GdbPrinters.png

Does /home/oem/.codelite-gdbinit exist?

Regards,

David

You do not have the required permissions to view the files attached to this post.
Dino
CodeLite Enthusiast
Posts: 14
Joined: Thu Aug 17, 2023 9:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Ubuntu debug doesn't display variables

Post by Dino »

Hi David,

Yes the file exists:

oem@dino-linux-pc:~$ cat .codelite-gdbinit
python
import sys
sys.path.insert(0, '$CodeLiteGdbPrinters')

from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)

from qt4 import register_qt4_printers
register_qt4_printers (None)

from wx import register_wx_printers
register_wx_printers (None)

To clarify, I get the Debugger panel with the "Locals" panel. it just does not allow you to look a members of a variable in a class.

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: Ubuntu debug doesn't display variables

Post by DavidGH »

It works here, using a C++ workspace and one of the simple project templates, wxWidgets GUI application (wxFrame, using wxCrafter), that CodeLite provides:

Locals.png

Try creating a project of that type and putting a breakpoint in Help > About; the wxStrings display for me.

You do not have the required permissions to view the files attached to this post.
Dino
CodeLite Enthusiast
Posts: 14
Joined: Thu Aug 17, 2023 9:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Ubuntu debug doesn't display variables

Post by Dino »

Hi David,

Thanks for trying to help me. I created the workspace from the "Workspace" menu, and I created the project from the "Workspace/New Project". I'm not following what you're suggesting?

Thanks,
John

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

Re: Ubuntu debug doesn't display variables

Post by DavidGH »

(I presume you have wxWidgets installed. If you're using the jammy packages, you need the debug ones too.
Alternatively choose a non-wxWidgets type of Project, but make sure you're building it in debug mode.)

You now have a new C++ Project. Build it, in debug mode of course. For the wxWidgets project that will mean:
C++ compiler options: $(shell wx-config --cxxflags --unicode=yes --debug=yes).
Linker options: $(shell wx-config --debug=yes --libs --unicode=yes)

Put a breakpoint somewhere sensible: for the wx project that would be at the end of MainFrame::OnAbout.
Build the project, then run in the debugger. Click the Help > About menu item and the breakpoint should be hit. Check the Locals pane...

Dino
CodeLite Enthusiast
Posts: 14
Joined: Thu Aug 17, 2023 9:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Ubuntu debug doesn't display variables

Post by Dino »

Hi David,

Thanks for all your help with this!

My compiler settings for C++ Compiler Options don't have any options like you specified. I right clicked on my project, and under "Settings...",
when I click on the elipsis for C++ Compiler Options, I don't see anything like you specified????

How do I check fot the installed packages I'm running?

Thanks again,
Dino

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

Re: Ubuntu debug doesn't display variables

Post by DavidGH »

My compiler settings for C++ Compiler Options don't have any options like you specified.

That's surprising.

You haven't told us anything about your project: what it's supposed to do, what the source-code is, what its build requirements are, how you build it, etc. Please would you do so.

And how did you add it to CodeLite? Did you create a new Project, or alter one of the template ones, or...

How do I check for the installed packages I'm running?

I don't understand the question. 'apt' will tell you what packages you have installed, but that's presumably not what you mean.

Dino
CodeLite Enthusiast
Posts: 14
Joined: Thu Aug 17, 2023 9:45 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Ubuntu debug doesn't display variables

Post by Dino »

Hi David,

I confused CodeLite with VS Studio. When I installed VS Studio it suggested packages to install.

The only wx packages installed are:
wx-common/jammy,now 3.0.5.1+dfsg-4 amd64 [installed,auto-removable]
wx-common/jammy 3.0.5.1+dfsg-4 i386
wx3.0-doc/jammy,jammy 3.0.5.1+dfsg-4 all
wx3.0-examples/jammy,jammy 3.0.5.1+dfsg-4 all
wx3.0-headers/jammy,jammy 3.0.5.1+dfsg-4 all
wx3.0-i18n/jammy,jammy 3.0.5.1+dfsg-4 all
wxastrocapture/jammy 1.8.1+git20140821.796e1a1+dfsg-1build1 amd64
wxedid/jammy 0.0.21-2 amd64
wxglade/jammy,jammy 1.0.4-1 all
wxhexeditor/jammy 0.24+repack-1build1 amd64
wxmaxima/jammy 20.12.1-1 amd64
wxpython-tools/jammy,jammy 4.0.7+dfsg-13build1 all
wxsqlite3-doc/jammy,jammy 3.4.1dfsg-5build1 all

So wxWidgets is not installed.

And yes, when I go into settings for the compiler options, there aren't any wx-config options displayed. Maybe because wxWidgets is not installed.

The project I created is for an online Udemy C++ class programming assignment.

Thanks,
Dino

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

Re: Ubuntu debug doesn't display variables

Post by DavidGH »

So wxWidgets is not installed.

Well, some are; but perhaps not the -dev packages that you'd need to build a wxWidgets program. (It's hard to be sure, but I suspect you searched for 'wx' rather than 'libwx'.)

The project I created is for an online Udemy C++ class programming assignment.

OK, but what sort of project? What does it do? What are its dependencies? How are you supposed to build it?
And, to repeat: how did you add it to CodeLite? Did you create a new Project, or alter one of the template ones, or...

Post Reply