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,

Thanks for advice on compressing the file.

For displaying the variables on my Ubuntu. Would you say that I could have something configured wrong in my CodeLite settings? Or could it be something related to GDB on my PC?

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 »

Would you say that I could have something configured wrong in my CodeLite settings?

I can't think of anything that you could be doing wrong. Presumably you have gdb installed, in the usual place...

I just ran your program again, in the debugger. This is the output in the Output tab of the Debugger pane:

Code: Select all

Using gdbinit file: /home/david/.codelite-gdbinit
Current working dir: /mnt/everythingelse/devel/temp/Dino/section15/15_challenge
Launching gdb from : /home/david/devel/temp/Dino/section15/15_challenge
Starting debugger  : /usr/bin/gdb --command="/home/david/.codelite-gdbinit" --tty=/dev/pts/13 --interpreter=mi "/home/david/devel/CLworkspace/Misc/build-Debug/bin/15-ChallengeOrig"
Debug session started successfully!
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
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.
\nType "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>.
\n
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/david/devel/CLworkspace/Misc/build-Debug/bin/15-ChallengeOrig...
Successfully set breakpoint 5 at: /mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp:33
Debuggee process ID: 46340
Continuing...
Breakpoint 5, main () at /home/david/devel/temp/Dino/section15/15_challenge/main.cpp:33
33\t    display(sav_accounts);

and again, after ticking its Enable Log box

Code: Select all

Using gdbinit file: /home/david/.codelite-gdbinit
Current working dir: /mnt/everythingelse/devel/temp/Dino/section15/15_challenge
Launching gdb from : /home/david/devel/temp/Dino/section15/15_challenge
Starting debugger  : /usr/bin/gdb --command="/home/david/.codelite-gdbinit" --tty=/dev/pts/13 --interpreter=mi "/home/david/devel/CLworkspace/Misc/build-Debug/bin/15-ChallengeOrig"
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, '/home/david/.codelite/gdb_printers')
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>>00000210-break-insert -f "/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp:33"
DEBUG>>00000212-enable-pretty-printing
Debug session started successfully!
DEBUG>>00000213-exec-arguments
DEBUG>>00000214-exec-run
DEBUG>>=thread-group-added,id="i1"
=thread-group-added,id="i1"
DEBUG>>~"GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git\n"
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
...
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"
...
DEBUG>>=cmd-param-changed,param="confirm",value="off"
=cmd-param-changed,param="confirm",value="off"
DEBUG>>~"Reading symbols from /home/david/devel/CLworkspace/Misc/build-Debug/bin/15-ChallengeOrig...\n"
Reading symbols from /home/david/devel/CLworkspace/Misc/build-Debug/bin/15-ChallengeOrig...
DEBUG>>&"\"/home/david/.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
DEBUG>>&"set breakpoint pending on\n"
DEBUG>>=cmd-param-changed,param="breakpoint pending",value="on"
=cmd-param-changed,param="breakpoint pending",value="on"
DEBUG>>^done
DEBUG>>&"set print object on\n"
DEBUG>>=cmd-param-changed,param="print object",value="on"
=cmd-param-changed,param="print object",value="on"
DEBUG>>^done
DEBUG>>&"set width 0\n"
DEBUG>>=cmd-param-changed,param="width",value="4294967295"
=cmd-param-changed,param="width",value="4294967295"
DEBUG>>^done
DEBUG>>&"set height 0\n"
DEBUG>>=cmd-param-changed,param="height",value="4294967295"
=cmd-param-changed,param="height",value="4294967295"
DEBUG>>^done
DEBUG>>&"set pagingation off\n"
DEBUG>>&"No symbol \"pagingation\" in current context.\n"
DEBUG>>^error,msg="No symbol \"pagingation\" in current context."
^error,msg="No symbol \"pagingation\" in current context."
DEBUG>>&"set debuginfod enabled off\n"
DEBUG>>&"No symbol \"debuginfod\" in current context.\n"
DEBUG>>^error,msg="No symbol \"debuginfod\" in current context."
^error,msg="No symbol \"debuginfod\" in current context."
DEBUG>>&"set print elements 200\n"
DEBUG>>^done
DEBUG>>&"python\n"
DEBUG>>&"Traceback (most recent call last):\n"
DEBUG>>&"  File \"<string>\", line 7, in <module>\n"
DEBUG>>&"ImportError: cannot import name 'register_wx_printers' from 'wx' (/home/david/.codelite/gdb_printers/wx.py)\n"
DEBUG>>&"Error while executing Python code.\n"
DEBUG>>^error,msg="Error while executing Python code."
^error,msg="Error while executing Python code."
...
DEBUG>>00000210^done,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404efc",func="main()",file="/home/david/devel/temp/Dino/section15/15_challenge/main.cpp",fullname="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp",line="33",thread-groups=["i1"],times="0",original-location="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp:33"}
Found the breakpoint ID!
Storing debugger breakpoint Id=5
Successfully set breakpoint 5 at: /mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp:33
DEBUG>>&"No source file named /home/david/devel/CLworkspace/Misc/SimpleWxExecutabe/main.cpp.\n"
DEBUG>>00000211^done,bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="
Debuggee process ID: 4094
DEBUG>>=thread-group-started,id="i1",pid="4094"
=thread-group-started,id="i1",pid="4094"
DEBUG>>=thread-created,id="1",group-id="i1"
=thread-created,id="1",group-id="i1"
DEBUG>>00000214^running
Continuing...
DEBUG>>*running,thread-id="all"
*running,thread-id="all"
DEBUG>>=breakpoint-modified,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404efc",func="main()",file="/home/david/devel/temp/Dino/section15/15_challenge/main.cpp",fullname="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp",line="33",thread-groups=["i1"],times="1",original-location="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp:33"}
=breakpoint-modified,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404efc",func="main()",file="/home/david/devel/temp/Dino/section15/15_challenge/main.cpp",fullname="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp",line="33",thread-groups=["i1"],times="1",original-location="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp:33"}
DEBUG>>~"\n"
DEBUG>>~"Breakpoint 5, main () at /home/david/devel/temp/Dino/section15/15_challenge/main.cpp:33\n"
Breakpoint 5, main () at /home/david/devel/temp/Dino/section15/15_challenge/main.cpp:33
DEBUG>>~"33\t    display(sav_accounts);\n"
33\t    display(sav_accounts);
DEBUG>>*stopped,reason="breakpoint-hit",disp="keep",bkptno="5",frame={addr="0x0000000000404efc",func="main",args=[],file="/home/david/devel/temp/Dino/section15/15_challenge/main.cpp",fullname="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp",line="33",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="8"
DEBUG>>00000215-file-list-exec-source-file
DEBUG>>00000216-break-list
DEBUG>>00000215^done,line="33",file="/home/david/devel/temp/Dino/section15/15_challenge/main.cpp",fullname="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp",macro-info="0"
DEBUG>>00000216^done,BreakpointTable={nr_rows="6",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:30",times="0",original-location="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:30"},bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:16",times="0",original-location="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:16"},bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:22",times="0",original-location="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:22"},bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:25",times="0",original-location="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:25"},bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404efc",func="main()",file="/home/david/devel/temp/Dino/section15/15_challenge/main.cpp",fullname="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp",line="33",thread-groups=["i1"],times="1",original-location="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp:33"},bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/home/david/devel/CLworkspace/Misc/SimpleWxExecutabe/main.cpp:9",times="0",original-location="/home/david/devel/CLworkspace/Misc/SimpleWxExecutabe/main.cpp:9"}]}

Have a look at your output; see if you can spot any important difference.

Or could it be something related to GDB on my PC?

You were going to try running your program direct in gdb. What happened? Could gdb show the content of variables when a BP was hit?

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,

The test to run GDB from the command line also failed:

Code: Select all


oem@dino-linux-pc:~/Workspaces/section15/build-Debug/bin$ gdb 15_challenge 
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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"...
Reading symbols from 15_challenge...
(gdb) list
1	// Section 15
2	// Challenge 
3	#include <iostream>
4	#include <vector>
5	#include "Savings_Account.h"
6	#include "Account_Util.h"
7	
8	using namespace std;
9	
10	int main() {
(gdb) 
11	    cout.precision(2);
12	    cout << fixed;
13	
14	    // Accounts
15	    vector<Account> accounts;
16	    accounts.push_back(Account {}); 
17	    accounts.push_back(Account {"Larry"});
18	    accounts.push_back(Account {"Moe", 2000} );
19	    accounts.push_back(Account {"Curly", 5000} );
20	    
(gdb) 21 display(accounts); 22 deposit(accounts, 1000); 23 withdraw(accounts,2000); 24
25 // Savings 26 27 vector<Savings_Account> sav_accounts; 28 sav_accounts.push_back(Savings_Account {} ); 29 sav_accounts.push_back(Savings_Account {"Superman"} ); 30 sav_accounts.push_back(Savings_Account {"Batman", 2000} ); (gdb) b 21 Breakpoint 1 at 0x404c37: file /home/oem/Workspaces/section15/15_challenge/main.cpp, line 21. (gdb) run Starting program: /home/oem/Workspaces/section15/build-Debug/bin/15_challenge Breakpoint 1, main () at /home/oem/Workspaces/section15/15_challenge/main.cpp:21 21 display(accounts); (gdb) p *(&accounts)@5 $1 = {{<std::_Vector_base<Account, std::allocator<Account> >> = { _M_impl = {<std::allocator<Account>> = {<__gnu_cxx::new_allocator<Account>> = {<No data fields>}, <No data fields>}, <std::_Vector_base<Account, std::allocator<Account> >::_Vector_impl_data> = {_M_start = 0x5fb470, _M_finish = 0x5fb510, _M_end_of_storage = 0x5fb510}, <No data fields>}}, <No data fields>}, {<std::_Vector_base<Account, std::allocator<Account> >> = { _M_impl = {<std::allocator<Account>> = {<__gnu_cxx::new_allocator<Account>> = {<No data fields>}, <No data fields>}, <std::_Vector_base<Account, std::allocator<Account> >::_Vector_impl_data> = {_M_start = 0x5dfd80 <std::wclog>, _M_finish = 0x5da4a8 <vtable for std::basic_ostream<wchar_t, std::char_traits<wchar_t> >>, _M_end_of_storage = 0x49bef3 <__dynamic_cast+131>}, <No data fields>}}, <No data fields>}, {<std::_Vector_base<Account, std::allocator<Account> >> = { _M_impl = {<std::allocator<Account>> = {<__gnu_cxx::new_allocator<Account>> = {<No data fields>}, <No data fields>}, <std::_Vector_base<Account, std::allocator<Account> >::_Vector_impl_data> = {_M_start = 0x5e0fc0 <(anonymous namespace)::num_get_w>, _M_finish = 0x7fffffffde90, _M_end_of_storage = 0x7fffffffdea0}, <No data fields>}}, <No data fields>}, {<std::_Vector_base<Account, std::allocator<Account> >> = { _M_impl = {<std::allocator<Account>> = {<__gnu_cxx::new_allocator<Account>> = {<No data fields>}, <No data fields>}, <std::_Vector_base<Account, std::allocator<Account> >::_Vector_impl_data> = {_M_start = 0x5, _M_finish = 0x206400796c727543, _M_end_of_storage = 0x746e756f636341}, <No data fields>}}, <No data fields>}, {<std::_Vector_base<Account, std::allocator<Account> >> = { _M_impl = {<std::allocator<Account>> = {<__gnu_cxx::new_allocator<Account>> = {<No data fields>}, <No data fields>}, <std::_Vector_base<Account, std::allocator<Account> >::_Vector_impl_data> = {_M_start = 0x7fffffffdec0, _M_finish = 0x0, _M_end_of_storage = 0x206400796c727500}, <No data fields>}}, <No data fields>}} (gdb)

I tried to google for this not working, and have not found anything.

Here is a capture on CodeLite debugger output

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/15_challenge
Starting debugger  : /usr/bin/gdb --command="/home/oem/.codelite-gdbinit" --tty=/dev/pts/4 --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>>00000042-break-insert -f "/home/oem/Workspaces/section15/15_challenge/main.cpp:20"
DEBUG>>00000043-break-insert -f "/home/oem/Workspaces/section15/15_challenge/main.cpp:22"
DEBUG>>00000044-enable-pretty-printing
Debug session started successfully!
DEBUG>>00000045-exec-arguments
DEBUG>>00000046-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
DEBUG>>&"set breakpoint pending on\n"
DEBUG>>=cmd-param-changed,param="breakpoint pending",value="on"
=cmd-param-changed,param="breakpoint pending",value="on"
DEBUG>>^done
DEBUG>>&"set print object on\n"
DEBUG>>=cmd-param-changed,param="print object",value="on"
=cmd-param-changed,param="print object",value="on"
DEBUG>>^done
DEBUG>>&"set width 0\n"
DEBUG>>=cmd-param-changed,param="width",value="4294967295"
=cmd-param-changed,param="width",value="4294967295"
DEBUG>>^done
DEBUG>>&"set height 0\n"
DEBUG>>=cmd-param-changed,param="height",value="4294967295"
=cmd-param-changed,param="height",value="4294967295"
DEBUG>>^done
DEBUG>>&"set pagingation off\n"
DEBUG>>&"No symbol \"pagingation\" in current context.\n"
DEBUG>>^error,msg="No symbol \"pagingation\" in current context."
^error,msg="No symbol \"pagingation\" in current context."
DEBUG>>&"set debuginfod enabled off\n"
DEBUG>>=cmd-param-changed,param="debuginfod enabled",value="off"
=cmd-param-changed,param="debuginfod enabled",value="off"
DEBUG>>^done
DEBUG>>&"set print elements 200\n"
DEBUG>>^done
DEBUG>>&"python\n"
DEBUG>>&"Traceback (most recent call last):\n"
DEBUG>>&"  File \"<string>\", line 3, in <module>\n"
DEBUG>>&"ModuleNotFoundError: No module named 'libstdcxx'\n"
DEBUG>>&"Error while executing Python code.\n"
DEBUG>>^error,msg="Error while executing Python code."
^error,msg="Error while executing Python code."
DEBUG>>00000042^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404baf",func="main()",file="/home/oem/Workspaces/section15/15_challenge/main.cpp",fullname="/home/oem/Workspaces/section15/15_challenge/main.cpp",line="20",thread-groups=["i1"],times="0",original-location="/home/oem/Workspaces/section15/15_challenge/main.cpp:20"}
Found the breakpoint ID!
Storing debugger breakpoint Id=1
Successfully set breakpoint 1 at: /home/oem/Workspaces/section15/15_challenge/main.cpp:20
DEBUG>>00000043^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404c37",func="main()",file="/home/oem/Workspaces/section15/15_challenge/main.cpp",fullname="/home/oem/Workspaces/section15/15_challenge/main.cpp",line="22",thread-groups=["i1"],times="0",original-location="/home/oem/Workspaces/section15/15_challenge/main.cpp:22"}
Found the breakpoint ID!
Storing debugger breakpoint Id=2
Successfully set breakpoint 2 at: /home/oem/Workspaces/section15/15_challenge/main.cpp:22
DEBUG>>00000044^done
DEBUG>>00000045^done
Debuggee process ID: 55412
DEBUG>>=thread-group-started,id="i1",pid="55412"
=thread-group-started,id="i1",pid="55412"
DEBUG>>=thread-created,id="1",group-id="i1"
=thread-created,id="1",group-id="i1"
DEBUG>>00000046^running
Continuing...
DEBUG>>*running,thread-id="all"
*running,thread-id="all"
DEBUG>>=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404baf",func="main()",file="/home/oem/Workspaces/section15/15_challenge/main.cpp",fullname="/home/oem/Workspaces/section15/15_challenge/main.cpp",line="20",thread-groups=["i1"],times="1",original-location="/home/oem/Workspaces/section15/15_challenge/main.cpp:20"}
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404baf",func="main()",file="/home/oem/Workspaces/section15/15_challenge/main.cpp",fullname="/home/oem/Workspaces/section15/15_challenge/main.cpp",line="20",thread-groups=["i1"],times="1",original-location="/home/oem/Workspaces/section15/15_challenge/main.cpp:20"}
DEBUG>>~"\n"
DEBUG>>~"Breakpoint 1, main () at /home/oem/Workspaces/section15/15_challenge/main.cpp:20\n"
Breakpoint 1, main () at /home/oem/Workspaces/section15/15_challenge/main.cpp:20
DEBUG>>~"20\t    accounts.push_back(Account {\"Curly\", 5000} );\n"
20\t    accounts.push_back(Account {"Curly", 5000} );
DEBUG>>*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x0000000000404baf",func="main",args=[],file="/home/oem/Workspaces/section15/15_challenge/main.cpp",fullname="/home/oem/Workspaces/section15/15_challenge/main.cpp",line="20",arch="i386:x86-64"},thread-id="1",stopped-threads="all",core="1"
DEBUG>>00000047-file-list-exec-source-file
DEBUG>>00000048-break-list
DEBUG>>00000047^done,line="20",file="/home/oem/Workspaces/section15/15_challenge/main.cpp",fullname="/home/oem/Workspaces/section15/15_challenge/main.cpp",macro-info="0"
DEBUG>>00000048^done,BreakpointTable={nr_rows="2",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404baf",func="main()",file="/home/oem/Workspaces/section15/15_challenge/main.cpp",fullname="/home/oem/Workspaces/section15/15_challenge/main.cpp",line="20",thread-groups=["i1"],times="1",original-location="/home/oem/Workspaces/section15/15_challenge/main.cpp:20"},bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404c37",func="main()",file="/home/oem/Workspaces/section15/15_challenge/main.cpp",fullname="/home/oem/Workspaces/section15/15_challenge/main.cpp",line="22",thread-groups=["i1"],times="0",original-location="/home/oem/Workspaces/section15/15_challenge/main.cpp:22"}]}

This is different than your capture:
DEBUG>>&"\"/home/oem/.codelite-gdbinit\": No such file or directory.\n"
and:
DEBUG>>sys.path.insert(0, '$CodeLiteGdbPrinters')

I could not see how to print
$CodeLiteGdbPrinters
Do you know how I can check what this is?

Thanks,
Dino

Last edited by DavidGH on Fri Sep 01, 2023 7:29 pm, edited 1 time in total.
Reason: Moved the code to _inside_ the code-tag sections!
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 moved the code to inside the code /code tags :roll: )

I'm afraid that output is too complicated for me to spot what might be wrong. A simpler, 'minimal' program would be easier but, first, try adding
int foo;
foo = 123;
to lines 26 and 27. Then build and debug.

For me here, that clearly shows the value of foo in Locals.

I can also see its value if, when the breakpoint is hit, I type into the Output pane:
p foo
(and press the Return key)

Code: Select all

DEBUG>>00000296^done,BreakpointTable={nr_rows="6",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:30",times="0",original-location="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:30"},bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:16",times="0",original-location="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:16"},bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:22",times="0",original-location="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:22"},bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:25",times="0",original-location="/mnt/everythingelse/devel/CLworkspace/Misc/YAProject/MainFrame.cpp:25"},bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000404f03",func="main()",file="/home/david/devel/temp/Dino/section15/15_challenge/main.cpp",fullname="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp",line="34",thread-groups=["i1"],times="1",original-location="/mnt/everythingelse/devel/temp/Dino/section15/15_challenge/main.cpp:34"},bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="/home/david/devel/CLworkspace/Misc/SimpleWxExecutabe/main.cpp:9",times="0",original-location="/home/david/devel/CLworkspace/Misc/SimpleWxExecutabe/main.cpp:9"}]}
p foo
DEBUG>>p foo
DEBUG>>&"p foo\n"
DEBUG>>~"$1 = 123\n"
$1 = 123
DEBUG>>^done

What happens for you?

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,

It can interpret the integer variable with no problem from the local variables debug window, and from the command line:
DEBUG>>p foo
DEBUG>>&"p foo\n"
DEBUG>>~"$1 = 123\n"
$1 = 123

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 »

Aha! That's good news. It means that there's not a problem either with CodeLite or with gdb. Instead there must be something wrong/missing on your system to do with interpreting std::vector (and presumably other similar std:: things).

However I've no idea what might be missing or wrong; it's outside my experience. I suggest you ${SearchEngine} for any ideas, or ask on a C++ forum, or...

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 have CodeLite working with pretty-print, now.

I adapted what I found here:
https://stackoverflow.com/questions/310 ... ython-issu

CodeLite always re-creates the .codelite-gdbinit for GDB each time you start it, so from

CodeLite/Settings/GDB Settings/Startup Commands/Startup

After:
python
import sys
sys.path.insert(0, '$CodeLiteGdbPrinters')

Add:
python sys.path.append("/usr/share/gcc/python")

Save that change by clicking OK.

Image

I still don't have GDB from command line working, I will try to get that going.

THanks,
Dino

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 »

I'm glad you fixed it. Well done!

Post Reply