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:

Re: Ubuntu debug doesn't display variables

Post by Dino »

Hi David,

I searched for packages containing "wx":
apt list | grep wx

I created the workspace from the "Workspace" menu, and I created the project from the "Workspace/New Project", right click on workspace, then click on New Project.

Then from the Debugger menu, I select "Start/Continue Debugger", and then select "Build and Debug". I add my break points and hit the play button

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 »

Code: Select all

apt list | grep wx

libwxbase3.0-0v5/jammy,now 3.0.5.1+dfsg-4 amd64 [installed,automatic]
libwxbase3.0-0v5/jammy 3.0.5.1+dfsg-4 i386
libwxbase3.0-dev/jammy,now 3.0.5.1+dfsg-4 amd64 [installed,automatic]
libwxbase3.0-dev/jammy 3.0.5.1+dfsg-4 i386
libwxbase3.1-0-unofficial/now 3.1.7-1.jammy amd64 [installed,local]
libwxbase3.1unofficial-dev/now 3.1.7-1.jammy amd64 [installed,local]
libwxbase3.2-0-unofficial-dbg/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxbase3.2-0-unofficial/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxbase3.2unofficial-dev/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk-media3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 amd64
libwxgtk-media3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 i386
libwxgtk-media3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 amd64
libwxgtk-media3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 i386
libwxgtk-media3.1-0-unofficial-dbg/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk-media3.1-0-unofficial/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk-media3.1unofficial-dev/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk-media3.2-0-unofficial-dbg/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk-media3.2-0-unofficial/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk-media3.2unofficial-dev/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk-webview3.0-gtk3-0v5/jammy,now 3.0.5.1+dfsg-4 amd64 [installed,automatic]
libwxgtk-webview3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 i386
libwxgtk-webview3.0-gtk3-dev/jammy,now 3.0.5.1+dfsg-4 amd64 [installed]
libwxgtk-webview3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 i386
libwxgtk-webview3.1-0-unofficial-dbg/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk-webview3.1-0-unofficial/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk-webview3.1unofficial-dev/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk-webview3.2-0-unofficial-dbg/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk-webview3.2-0-unofficial/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk-webview3.2unofficial-dev/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk3.0-gtk3-0v5/jammy,now 3.0.5.1+dfsg-4 amd64 [installed,automatic]
libwxgtk3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 i386
libwxgtk3.0-gtk3-dev/jammy,now 3.0.5.1+dfsg-4 amd64 [installed,automatic]
libwxgtk3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 i386
libwxgtk3.1-0-unofficial-dbg/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk3.1-0-unofficial/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk3.1unofficial-dev/now 3.1.7-1.jammy amd64 [installed,local]
libwxgtk3.2-0-unofficial-dbg/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk3.2-0-unofficial/now 3.2.2.1-1.jammy amd64 [installed,local]
libwxgtk3.2unofficial-dev/now 3.2.2.1-1.jammy amd64 [installed,local]

I created the workspace from the "Workspace" menu, and I created the project from the "Workspace/New Project", right click on workspace, then click on New Project.

So far, so good.

Then from the Debugger menu, I select "Start/Continue Debugger", and then select "Build and Debug".

Wait! You haven't mentioned adding any code!

Did you select one of the sample projects that CodeLite supplies? If so, which one?

If you did, or if you added code of your own, what happened when you did "Build and Debug"? Was there output? If so, what did it say?

It would speed things up considerably if you gave all the necessary details for someone to understand what you are doing.
It would also be an excellent idea if you would archive (e.g. zip, tar) your whole project, including the source-code that you presumably have, and attach that to your next post. Then other people could test it and have a better idea of what might be going wrong.

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,

Again, thanks for your help with this.

oem@dino-linux-pc:~$ apt list | grep libwx

Code: Select all

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libwx-glcanvas-perl/jammy 0.09-6build1 amd64
libwx-perl-datawalker-perl/jammy,jammy 0.02-2 all
libwx-perl-processstream-perl/jammy,jammy 0.32-1.1 all
libwx-perl/jammy 1:0.9932-6build1 amd64
libwx-scintilla-perl/jammy 0.39-4build6 amd64
libwxbase3.0-0v5/jammy,now 3.0.5.1+dfsg-4 amd64 [installed,auto-removable]
libwxbase3.0-0v5/jammy 3.0.5.1+dfsg-4 i386
libwxbase3.0-dev/jammy 3.0.5.1+dfsg-4 amd64
libwxbase3.0-dev/jammy 3.0.5.1+dfsg-4 i386
libwxgtk-media3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 amd64
libwxgtk-media3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 i386
libwxgtk-media3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 amd64
libwxgtk-media3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 i386
libwxgtk-webview3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 amd64
libwxgtk-webview3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 i386
libwxgtk-webview3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 amd64
libwxgtk-webview3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 i386
libwxgtk3.0-gtk3-0v5/jammy,now 3.0.5.1+dfsg-4 amd64 [installed,auto-removable]
libwxgtk3.0-gtk3-0v5/jammy 3.0.5.1+dfsg-4 i386
libwxgtk3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 amd64
libwxgtk3.0-gtk3-dev/jammy 3.0.5.1+dfsg-4 i386
libwxsmithlib-dev/jammy 20.03-3.1 amd64
libwxsmithlib0/jammy 20.03-3.1 amd64
libwxsqlite3-3.0-0/jammy,now 3.4.1~dfsg-5build1 amd64 [installed,auto-removable]
libwxsqlite3-3.0-dev/jammy 3.4.1~dfsg-5build1 amd64
libwxsvg-dev/jammy 2:1.5.23+dfsg-1 amd64
libwxsvg-tools/jammy 2:1.5.23+dfsg-1 amd64
libwxsvg3/jammy 2:1.5.23+dfsg-1 amd64

I have been making new workspaces for each assignment, I probably should have just created new projects. Anyway, the projects are from a template that the C++ course had me setup.

For this, I created 4 classes, and filled in the code for them. The code for main.cpp came from the instructor.

Here is a build capture:

Code: Select all

/usr/bin/make -j4 -e -f  Makefile
----------Building project:[ 15_challenge - Debug ]----------
make[1]: Entering directory '/home/oem/Workspaces/section15/15_challenge'
/usr/bin/g++  -c  "/home/oem/Workspaces/section15/15_challenge/Savings_Account.cpp" -O0 -gdwarf-2 -std=c++17 -Wall  -o ../build-Debug/15_challenge/Savings_Account.cpp.o -I. -I.
/usr/bin/g++  -c  "/home/oem/Workspaces/section15/15_challenge/Checking_Account.cpp" -O0 -gdwarf-2 -std=c++17 -Wall  -o ../build-Debug/15_challenge/Checking_Account.cpp.o -I. -I.
/usr/bin/g++  -c  "/home/oem/Workspaces/section15/15_challenge/Trust_Account.cpp" -O0 -gdwarf-2 -std=c++17 -Wall  -o ../build-Debug/15_challenge/Trust_Account.cpp.o -I. -I.
/usr/bin/g++  -c  "/home/oem/Workspaces/section15/15_challenge/Account_Util.cpp" -O0 -gdwarf-2 -std=c++17 -Wall  -o ../build-Debug/15_challenge/Account_Util.cpp.o -I. -I.
/usr/bin/g++  -c  "/home/oem/Workspaces/section15/15_challenge/main.cpp" -O0 -gdwarf-2 -std=c++17 -Wall  -o ../build-Debug/15_challenge/main.cpp.o -I. -I.
/usr/bin/g++  -c  "/home/oem/Workspaces/section15/15_challenge/Account.cpp" -O0 -gdwarf-2 -std=c++17 -Wall  -o ../build-Debug/15_challenge/Account.cpp.o -I. -I.
/usr/bin/g++ -o ../build-Debug/bin/15_challenge @../build-Debug/15_challenge/ObjectsList.txt -L.   -static
make[1]: Leaving directory '/home/oem/Workspaces/section15/15_challenge'
=== build completed successfully (0 errors, 0 warnings), total time: 00:00:06 seconds ===

I need archive my project next. I will do that later today.

Thanks,
Dino

You do not have the required permissions to view the files attached to this post.
Last edited by DavidGH on Fri Aug 25, 2023 7:10 pm, edited 1 time in total.
Reason: Ad
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 added code-tags to your post; it makes things much easier to read.)

/usr/bin/make -j4 -e -f Makefile

/usr/bin/g++ -c ...-O0 -gdwarf-2 -std=c++17 -Wall...

It doesn't look as if you are creating a debug build; you have -gdwarf-2 but no -g. AFAIK gdwarf only says what sort of debugging to do; it doesn't actually say "Make a debug build".

In your makefile, try changing g++ to g++ -g.

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 agree, I don't see "-g", but when I looked that object file, it said the file was not stripped. Anyway, I changed the g++ compiler options:

/usr/bin/make -j4 -e -f Makefile
----------Building project:[ 15_challenge - Debug ]----------
make[1]: Entering directory '/home/oem/Workspaces/section15/15_challenge'
/usr/bin/g++ -c "/home/oem/Workspaces/section15/15_challenge/main.cpp" -g -O0 -gdwarf-2 -std=c++17 -Wall -o ../build-Debug/15_challenge/main.cpp.o -I. -I.
/usr/bin/g++ -c "/home/oem/Workspaces/section15/15_challenge/Checking_Account.cpp" -g -O0 -gdwarf-2 -std=c++17 -Wall -o ../build-Debug/15_challenge/Checking_Account.cpp.o -I. -I.
/usr/bin/g++ -c "/home/oem/Workspaces/section15/15_challenge/Trust_Account.cpp" -g -O0 -gdwarf-2 -std=c++17 -Wall -o ../build-Debug/15_challenge/Trust_Account.cpp.o -I. -I.
/usr/bin/g++ -c "/home/oem/Workspaces/section15/15_challenge/Account_Util.cpp" -g -O0 -gdwarf-2 -std=c++17 -Wall -o ../build-Debug/15_challenge/Account_Util.cpp.o -I. -I.
/usr/bin/g++ -c "/home/oem/Workspaces/section15/15_challenge/Savings_Account.cpp" -g -O0 -gdwarf-2 -std=c++17 -Wall -o ../build-Debug/15_challenge/Savings_Account.cpp.o -I. -I.
/usr/bin/g++ -c "/home/oem/Workspaces/section15/15_challenge/Account.cpp" -g -O0 -gdwarf-2 -std=c++17 -Wall -o ../build-Debug/15_challenge/Account.cpp.o -I. -I.
/usr/bin/g++ -o ../build-Debug/bin/15_challenge @../build-Debug/15_challenge/ObjectsList.txt -L. -static
make[1]: Leaving directory '/home/oem/Workspaces/section15/15_challenge'
=== build completed successfully (0 errors, 0 warnings), total time: 00:00:06 seconds ===

I still don't see the locals displaying correctly?

I can't attach my tar file for my workspace, it's too large. I'm not sure where to go from here?

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 »

I agree, I don't see "-g", but when I looked that object file, it said the file was not stripped

Try doing, in a terminal:
file ${program-name}
The output for one of mine ends:

Code: Select all

...BuildID[sha1]=870975de1eaa7014c1b93aa4c300a34485d22b29, for GNU/Linux 3.2.0, with debug_info, not stripped

Note the 'with debug_info'.

I can't attach my tar file for my workspace, it's too large. I'm not sure where to go from here?

Use a paste-bin. e.g. https://filebin.net/

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 uploaded my executable file:

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 »

I uploaded my executable file:

That doesn't tell us anything useful. When you use a file-bin, you need to copy and tell people the exact link to your upload; then people know where to download it from.

And anyway, it's not the exe that you need to upload, it's an archive of your project. Then others can test it at home.
You only need to do 'file' on the exe.

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 your patience and help with this. There wasn't any space yesterday to put my tar file on that server. However, I put it up today:

dino_section15.tar

https://filebin.net/po3zjqbjvpop7bap

The bin po3zjqbjvpop7bap was created 24 seconds ago, updated now and it expires 6 days from now. It contains 1 uploaded file at 14 MB.

Any help you can provide is much appreciated.

I'm going to try the GDB command line in the meanwhile, to see if I can look at that vector from a debugger.

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 »

The bin po3zjqbjvpop7bap was created 24 seconds ago, updated now and it expires 6 days from now. It contains 1 uploaded file at 14 MB.

Most people would have created a tar.gz or tar.xz or... Your dino_section15.tar was 13.5MB; its tar.xz was 1.9MB.
You can easily do that with the correct tar command in a terminal. Alternatively any good file manager should be able to do it for you (FWIW I use 4Pane).

Anyway, I built and ran it in CodeLite, using gdb. As you can see, it displays variables OK here. And that's without adding -g to your settings. So I don't know why you have a problem, but it doesn't seem to be a CodeLite one.

You do not have the required permissions to view the files attached to this post.
Post Reply