Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Cannot debug application on ubuntu linux
Cannot debug application on ubuntu linux [message #57399] Wed, 04 August 2021 22:58 Go to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
Hi!

I just installed upp and trying to debug simple program.

Compiling and run works fine, but I can't run it with debugger.

Build methods screen in attached files.

After I start debug this console window appears, Warning: Program 'tail' crashed.

How to fix it? May be I have some wrong settings in TheIde or system?
Re: Cannot debug application on ubuntu linux [message #57400 is a reply to message #57399] Wed, 04 August 2021 23:18 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
First thing I would verify that gdb works if launched from terminal. Like compile your app into ~, then run "gdb appname" from the console.
Re: Cannot debug application on ubuntu linux [message #57404 is a reply to message #57399] Thu, 05 August 2021 10:33 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
This window opens when I start with debugger.
Re: Cannot debug application on ubuntu linux [message #57405 is a reply to message #57400] Thu, 05 August 2021 10:51 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
Seems gdb works from console.

I'm created program with 3 lines of source code, compiled clang++ -g ./TheMain.cpp

Then gdb ./a.out.

Output:

GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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:
<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"...
Reading symbols from ./a.out...
(gdb) b main
Breakpoint 1 at 0x4011df: file ./TheMain.cpp, line 5.
(gdb) r
Starting program: /data/3/soft/devel/IDEs/cb/cb_test/a.out 

Breakpoint 1, main () at ./TheMain.cpp:5
5           std::cout << "Preved" << std::endl;
(gdb) s
Preved
6           std::cout << "Preved2" << std::endl;
(gdb) s
Preved2
7           return 0;
(gdb) s
__libc_start_main (main=0x4011d0 <main()>, argc=1, argv=0x7fffffffdac8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fffffffdab8) at ../csu/libc-start.c:342
342     ../csu/libc-start.c: No such file or directory.
(gdb) s
__GI_exit (status=0) at exit.c:138
138     exit.c: No such file or directory.
(gdb) s
139     in exit.c


Seems after exiting my main some strange occured - it tries to find files that not exists. But I can debug my application itself.
Re: Cannot debug application on ubuntu linux [message #57406 is a reply to message #57400] Thu, 05 August 2021 10:55 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
Hi mirek!

How I can see what happens when I start debug? What commands runs upp?
Re: Cannot debug application on ubuntu linux [message #57407 is a reply to message #57406] Thu, 05 August 2021 11:15 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
In setup menu, you can activate "Verbose" - you will then see the gdb communication.

'tail' is the name of your program (or it is system command)?
Re: Cannot debug application on ubuntu linux [message #57408 is a reply to message #57407] Thu, 05 August 2021 11:48 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
Yes, tail is system command. But I don't understand how it is launched from theide when I trying to debug.

I activate Be Verbose checkbox. But I does not see any additional messages/logs.

May be I need to open some window or file? Where it write verbose logs?
Re: Cannot debug application on ubuntu linux [message #57409 is a reply to message #57408] Thu, 05 August 2021 13:04 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
alex-t wrote on Thu, 05 August 2021 11:48
Yes, tail is system command. But I don't understand how it is launched from theide when I trying to debug.

I activate Be Verbose checkbox. But I does not see any additional messages/logs.


Should be visible in bottom pane when you choose the right subpane (the one under closing cross).

Quote:

May be I need to open some window or file? Where it write verbose logs?


It is used to create a terminal for console session.

https://github.com/ultimatepp/ultimatepp/blob/1d018151f105f4 e739045307577e3dd0bc8b856a/uppsrc/ide/Debuggers/Terminal.cpp #L24

Probably means your app is console one.

Can you try to debug something with GUI? E.g. examples/AddressBook

Mirek
Re: Cannot debug application on ubuntu linux [message #57410 is a reply to message #57409] Thu, 05 August 2021 13:29 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
Yes, my application is console application.

Debug in AddressBook works.

Later I read source code of Terminal.cpp, and if I understand what happens and what to do to make it working, I write message here.
Re: Cannot debug application on ubuntu linux [message #57411 is a reply to message #57409] Thu, 05 August 2021 13:35 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
mirek wrote on Thu, 05 August 2021 13:04


Should be visible in bottom pane when you choose the right subpane (the one under closing cross).



This window appears when I debug GUI application, but only blinked and disappears in a tick when I'm trying to debug console application.
Re: Cannot debug application on ubuntu linux [message #57412 is a reply to message #57411] Thu, 05 August 2021 14:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
alex-t wrote on Thu, 05 August 2021 13:35
mirek wrote on Thu, 05 August 2021 13:04


Should be visible in bottom pane when you choose the right subpane (the one under closing cross).



This window appears when I debug GUI application, but only blinked and disappears in a tick when I'm trying to debug console application.


Ah, I see. That probably means gdb did not even started... But you can make it reappear (e.g. press Esc).

I guess the next step would be trying the complete gdb from terminal, with the -tty= option...

Mirek
Re: Cannot debug application on ubuntu linux [message #57414 is a reply to message #57412] Thu, 05 August 2021 14:35 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
huh, after Esc it really apears again. Thank you, mirek, for this advice.

Now I can check logs of starting debugger. Seems it started, but not stopping on breakpoints.

Log:

----- ConsoleTest ( MAIN CLANG DEBUG SHARED DEBUG_FULL BLITZ POSIX LINUX )
cd /data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest
/data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest (30024 B) is up to date.

OK. (0:00.00)
gdb -tty=/dev/pts/10 /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest
Command: set prompt <u++dbg-q98klwr835f427>
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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:
<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"...
Reading symbols from /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest...
(gdb) 
Time of `set prompt <u++dbg-q98klwr835f427>` 36.367 ms
=========== Result:
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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:
<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"...
Reading symbols from /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest...
(gdb) 
===================
Command: set disassembly-flavor intel

Time of `set disassembly-flavor intel` 20.787 ms
=========== Result:

===================
Command: set exec-done-display off

Time of `set exec-done-display off` 20.762 ms
=========== Result:

===================
Command: set annotate 1

Time of `set annotate 1` 20.787 ms
=========== Result:

===================
Command: set height 0

Time of `set height 0` 20.758 ms
=========== Result:

===================
Command: set width 0

Time of `set width 0` 20.742 ms
=========== Result:

===================
Command: set confirm off

Time of `set confirm off` 20.74 ms
=========== Result:

===================
Command: set print asm-demangle

Time of `set print asm-demangle` 20.795 ms
=========== Result:

===================
Command: set print static-members off

Time of `set print static-members off` 20.74 ms
=========== Result:

===================
Command: set print vtbl off

Time of `set print vtbl off` 20.748 ms
=========== Result:

===================
Command: set print repeat 0

Time of `set print repeat 0` 20.785 ms
=========== Result:

===================
Command: set print null-stop

Time of `set print null-stop` 20.755 ms
=========== Result:

===================
Command: start
Temporary breakpoint 1 at 0x4011e6: file ConsoleTest.cpp, line 5.
Starting program: /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:5
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:5:66:beg:0x4011e6
5  std::cout << "bla-bla-bla" << std::endl;

Time of `start` 201.981 ms
=========== Result:
Temporary breakpoint 1 at 0x4011e6: file ConsoleTest.cpp, line 5.
Starting program: /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:5
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:5:66:beg:0x4011e6
5  std::cout << "bla-bla-bla" << std::endl;

===================
Command: info inferior
  Num  Description       Executable        
* 1    process 161372    /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Time of `info inferior` 20.801 ms
=========== Result:
  Num  Description       Executable        
* 1    process 161372    /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

===================
Command: continue
Continuing.
[Inferior 1 (process 161372) exited normally]

Time of `continue` 20.746 ms
=========== Result:
Continuing.
[Inferior 1 (process 161372) exited normally]

===================
Fast Command: frame
No stack.

Result: No stack.

Re: Cannot debug application on ubuntu linux [message #57416 is a reply to message #57412] Thu, 05 August 2021 14:50 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
Hmm... A very strange. If I pick debugger breakpoint to line 6 instead of line 5, debugger stops!!!

index.php?t=getfile&id=6486&private=0

Log from this case (I select run to finish program):

----- ConsoleTest ( MAIN CLANG DEBUG SHARED DEBUG_FULL BLITZ POSIX LINUX )
cd /data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest
/data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest (30024 B) is up to date.

OK. (0:00.00)
gdb -tty=/dev/pts/13 /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest
Command: set prompt <u++dbg-q98klwr835f427>
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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:
<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"...
Reading symbols from /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest...
(gdb) 
Time of `set prompt <u++dbg-q98klwr835f427>` 42.615 ms
=========== Result:
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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:
<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"...
Reading symbols from /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest...
(gdb) 
===================
Command: set disassembly-flavor intel

Time of `set disassembly-flavor intel` 20.791 ms
=========== Result:

===================
Command: set exec-done-display off

Time of `set exec-done-display off` 20.747 ms
=========== Result:

===================
Command: set annotate 1

Time of `set annotate 1` 20.841 ms
=========== Result:

===================
Command: set height 0

Time of `set height 0` 20.818 ms
=========== Result:

===================
Command: set width 0

Time of `set width 0` 20.876 ms
=========== Result:

===================
Command: set confirm off

Time of `set confirm off` 20.761 ms
=========== Result:

===================
Command: set print asm-demangle

Time of `set print asm-demangle` 20.867 ms
=========== Result:

===================
Command: set print static-members off

Time of `set print static-members off` 20.885 ms
=========== Result:

===================
Command: set print vtbl off

Time of `set print vtbl off` 671 us
=========== Result:

===================
Command: set print repeat 0

Time of `set print repeat 0` 20.772 ms
=========== Result:

===================
Command: set print null-stop

Time of `set print null-stop` 671 us
=========== Result:

===================
Fast Command: b /data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6
Breakpoint 1 at 0x401211: file ConsoleTest.cpp, line 6.

Result: Breakpoint 1 at 0x401211: file ConsoleTest.cpp, line 6.

Command: start
Temporary breakpoint 2 at 0x4011e6: file ConsoleTest.cpp, line 5.
Starting program: /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Temporary breakpoint 2, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:5
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:5:66:beg:0x4011e6
5  std::cout << "bla-bla-bla" << std::endl;

Time of `start` 182.494 ms
=========== Result:
Temporary breakpoint 2 at 0x4011e6: file ConsoleTest.cpp, line 5.
Starting program: /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Temporary breakpoint 2, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:5
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:5:66:beg:0x4011e6
5  std::cout << "bla-bla-bla" << std::endl;

===================
Command: info inferior
  Num  Description       Executable        
* 1    process 162236    /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Time of `info inferior` 20.821 ms
=========== Result:
  Num  Description       Executable        
* 1    process 162236    /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

===================
Command: continue
Continuing.

Breakpoint 1, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6:109:beg:0x401211
6  std::cout << "bla-bla-bla2" << std::endl;

Time of `continue` 20.834 ms
=========== Result:
Continuing.

Breakpoint 1, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6:109:beg:0x401211
6  std::cout << "bla-bla-bla2" << std::endl;

===================
Fast Command: disas
Result: Dump of assembler code for function main(int, char const**):
   0x00000000004011d0 <+0>: push   rbp
   0x00000000004011d1 <+1>: mov    rbp,rsp
   0x00000000004011d4 <+4>: sub    rsp,0x20
   0x00000000004011d8 <+8>: mov    DWORD PTR [rbp-0x4],0x0
   0x00000000004011df <+15>: mov    DWORD PTR [rbp-0x8],edi
   0x00000000004011e2 <+18>: mov    QWORD PTR [rbp-0x10],rsi
   0x00000000004011e6 <+22>: movabs rdi,0x404080
   0x00000000004011f0 <+32>: movabs rsi,0x402004
   0x00000000004011fa <+42>: call   0x401050 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_tra
    its<char> >&, char const*)@plt>
   0x00000000004011ff <+47>: mov    rdi,rax
   0x0000000000401202 <+50>: movabs rsi,0x401030
   0x000000000040120c <+60>: call   0x401060 <std::ostream::operator<<(std::ostream& (*)(std::ostream&))@plt>
=> 0x0000000000401211 <+65>: movabs rdi,0x404080
   0x000000000040121b <+75>: movabs rsi,0x402010
   0x0000000000401225 <+85>: mov    QWORD PTR [rbp-0x18],rax
   0x0000000000401229 <+89>: call   0x401050 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_tra
    its<char> >&, char const*)@plt>
   0x000000000040122e <+94>: mov    rdi,rax
   0x0000000000401231 <+97>: movabs rsi,0x401030
   0x000000000040123b <+107>: call   0x401060 <std::ostream::operator<<(std::ostream& (*)(std::ostream&))@plt>
   0x0000000000401240 <+112>: xor    ecx,ecx
   0x0000000000401242 <+114>: mov    QWORD PTR [rbp-0x20],rax
   0x0000000000401246 <+118>: mov    eax,ecx
   0x0000000000401248 <+120>: add    rsp,0x20
   0x000000000040124c <+124>: pop    rbp
   0x000000000040124d <+125>: ret    
End of assembler dump.

Fast Command: frame
#0  main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6:109:beg:0x401211
6  std::cout << "bla-bla-bla2" << std::endl;

Result: #0  main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6:109:beg:0x401211
6  std::cout << "bla-bla-bla2" << std::endl;

Fast Command: info threads
  Id   Target Id                    Frame 
* 1    process 162236 "ConsoleTest" main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6

Result:   Id   Target Id                    Frame 
* 1    process 162236 "ConsoleTest" main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6

Fast Command: print int
Attempt to use a type name as an expression

Result: Attempt to use a type name as an expression

Fast Command: print main
$1 = {int (int, const char **)} 0x4011d0 <main(int, char const**)>

Result: $1 = {int (int, const char **)} 0x4011d0 <main(int, char const**)>

Fast Command: print argc
$2 = 1

Result: $2 = 1

Fast Command: print const
A syntax error in expression, near `'.

Result: A syntax error in expression, near `'.

Fast Command: print char
Attempt to use a type name as an expression

Result: Attempt to use a type name as an expression

Fast Command: print argv
$3 = (const char **) 0x7fffffffd988

Result: $3 = (const char **) 0x7fffffffd988

Fast Command: print std
Attempt to use a type name as an expression

Result: Attempt to use a type name as an expression

Fast Command: print cout
No symbol "cout" in current context.

Result: No symbol "cout" in current context.

Fast Command: print endl
No symbol "endl" in current context.

Result: No symbol "endl" in current context.

Fast Command: print return
No symbol "return" in current context.

Result: No symbol "return" in current context.

Fast Command: print iostream
A syntax error in expression, near `'.

Result: A syntax error in expression, near `'.

Command: continue
Continuing.
[Inferior 1 (process 162236) exited normally]

Time of `continue` 6.999 ms
=========== Result:
Continuing.
[Inferior 1 (process 162236) exited normally]

===================
Fast Command: frame
No stack.

Result: No stack.


Re: Cannot debug application on ubuntu linux [message #57419 is a reply to message #57416] Thu, 05 August 2021 22:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
alex-t wrote on Thu, 05 August 2021 14:50
Hmm... A very strange. If I pick debugger breakpoint to line 6 instead of line 5, debugger stops!!!

index.php?t=getfile&id=6486&private=0

Log from this case (I select run to finish program):

----- ConsoleTest ( MAIN CLANG DEBUG SHARED DEBUG_FULL BLITZ POSIX LINUX )
cd /data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest
/data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest (30024 B) is up to date.

OK. (0:00.00)
gdb -tty=/dev/pts/13 /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest
Command: set prompt <u++dbg-q98klwr835f427>
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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:
<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"...
Reading symbols from /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest...
(gdb) 
Time of `set prompt <u++dbg-q98klwr835f427>` 42.615 ms
=========== Result:
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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:
<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"...
Reading symbols from /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest...
(gdb) 
===================
Command: set disassembly-flavor intel

Time of `set disassembly-flavor intel` 20.791 ms
=========== Result:

===================
Command: set exec-done-display off

Time of `set exec-done-display off` 20.747 ms
=========== Result:

===================
Command: set annotate 1

Time of `set annotate 1` 20.841 ms
=========== Result:

===================
Command: set height 0

Time of `set height 0` 20.818 ms
=========== Result:

===================
Command: set width 0

Time of `set width 0` 20.876 ms
=========== Result:

===================
Command: set confirm off

Time of `set confirm off` 20.761 ms
=========== Result:

===================
Command: set print asm-demangle

Time of `set print asm-demangle` 20.867 ms
=========== Result:

===================
Command: set print static-members off

Time of `set print static-members off` 20.885 ms
=========== Result:

===================
Command: set print vtbl off

Time of `set print vtbl off` 671 us
=========== Result:

===================
Command: set print repeat 0

Time of `set print repeat 0` 20.772 ms
=========== Result:

===================
Command: set print null-stop

Time of `set print null-stop` 671 us
=========== Result:

===================
Fast Command: b /data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6
Breakpoint 1 at 0x401211: file ConsoleTest.cpp, line 6.

Result: Breakpoint 1 at 0x401211: file ConsoleTest.cpp, line 6.

Command: start
Temporary breakpoint 2 at 0x4011e6: file ConsoleTest.cpp, line 5.
Starting program: /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Temporary breakpoint 2, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:5
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:5:66:beg:0x4011e6
5  std::cout << "bla-bla-bla" << std::endl;

Time of `start` 182.494 ms
=========== Result:
Temporary breakpoint 2 at 0x4011e6: file ConsoleTest.cpp, line 5.
Starting program: /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Temporary breakpoint 2, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:5
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:5:66:beg:0x4011e6
5  std::cout << "bla-bla-bla" << std::endl;

===================
Command: info inferior
  Num  Description       Executable        
* 1    process 162236    /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

Time of `info inferior` 20.821 ms
=========== Result:
  Num  Description       Executable        
* 1    process 162236    /data/3/soft/devel/IDEs/upp/.cache/upp.out/MyApps/CLANG.Debug.Debug_Full.Shared/ConsoleTest 

===================
Command: continue
Continuing.

Breakpoint 1, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6:109:beg:0x401211
6  std::cout << "bla-bla-bla2" << std::endl;

Time of `continue` 20.834 ms
=========== Result:
Continuing.

Breakpoint 1, main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6:109:beg:0x401211
6  std::cout << "bla-bla-bla2" << std::endl;

===================
Fast Command: disas
Result: Dump of assembler code for function main(int, char const**):
   0x00000000004011d0 <+0>: push   rbp
   0x00000000004011d1 <+1>: mov    rbp,rsp
   0x00000000004011d4 <+4>: sub    rsp,0x20
   0x00000000004011d8 <+8>: mov    DWORD PTR [rbp-0x4],0x0
   0x00000000004011df <+15>: mov    DWORD PTR [rbp-0x8],edi
   0x00000000004011e2 <+18>: mov    QWORD PTR [rbp-0x10],rsi
   0x00000000004011e6 <+22>: movabs rdi,0x404080
   0x00000000004011f0 <+32>: movabs rsi,0x402004
   0x00000000004011fa <+42>: call   0x401050 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_tra
    its<char> >&, char const*)@plt>
   0x00000000004011ff <+47>: mov    rdi,rax
   0x0000000000401202 <+50>: movabs rsi,0x401030
   0x000000000040120c <+60>: call   0x401060 <std::ostream::operator<<(std::ostream& (*)(std::ostream&))@plt>
=> 0x0000000000401211 <+65>: movabs rdi,0x404080
   0x000000000040121b <+75>: movabs rsi,0x402010
   0x0000000000401225 <+85>: mov    QWORD PTR [rbp-0x18],rax
   0x0000000000401229 <+89>: call   0x401050 <std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_tra
    its<char> >&, char const*)@plt>
   0x000000000040122e <+94>: mov    rdi,rax
   0x0000000000401231 <+97>: movabs rsi,0x401030
   0x000000000040123b <+107>: call   0x401060 <std::ostream::operator<<(std::ostream& (*)(std::ostream&))@plt>
   0x0000000000401240 <+112>: xor    ecx,ecx
   0x0000000000401242 <+114>: mov    QWORD PTR [rbp-0x20],rax
   0x0000000000401246 <+118>: mov    eax,ecx
   0x0000000000401248 <+120>: add    rsp,0x20
   0x000000000040124c <+124>: pop    rbp
   0x000000000040124d <+125>: ret    
End of assembler dump.

Fast Command: frame
#0  main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6:109:beg:0x401211
6  std::cout << "bla-bla-bla2" << std::endl;

Result: #0  main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6
/data/3/soft/devel/IDEs/upp/MyApps/ConsoleTest/ConsoleTest.cpp:6:109:beg:0x401211
6  std::cout << "bla-bla-bla2" << std::endl;

Fast Command: info threads
  Id   Target Id                    Frame 
* 1    process 162236 "ConsoleTest" main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6

Result:   Id   Target Id                    Frame 
* 1    process 162236 "ConsoleTest" main (argc=1, argv=0x7fffffffd988) at ConsoleTest.cpp:6

Fast Command: print int
Attempt to use a type name as an expression

Result: Attempt to use a type name as an expression

Fast Command: print main
$1 = {int (int, const char **)} 0x4011d0 <main(int, char const**)>

Result: $1 = {int (int, const char **)} 0x4011d0 <main(int, char const**)>

Fast Command: print argc
$2 = 1

Result: $2 = 1

Fast Command: print const
A syntax error in expression, near `'.

Result: A syntax error in expression, near `'.

Fast Command: print char
Attempt to use a type name as an expression

Result: Attempt to use a type name as an expression

Fast Command: print argv
$3 = (const char **) 0x7fffffffd988

Result: $3 = (const char **) 0x7fffffffd988

Fast Command: print std
Attempt to use a type name as an expression

Result: Attempt to use a type name as an expression

Fast Command: print cout
No symbol "cout" in current context.

Result: No symbol "cout" in current context.

Fast Command: print endl
No symbol "endl" in current context.

Result: No symbol "endl" in current context.

Fast Command: print return
No symbol "return" in current context.

Result: No symbol "return" in current context.

Fast Command: print iostream
A syntax error in expression, near `'.

Result: A syntax error in expression, near `'.

Command: continue
Continuing.
[Inferior 1 (process 162236) exited normally]

Time of `continue` 6.999 ms
=========== Result:
Continuing.
[Inferior 1 (process 162236) exited normally]

===================
Fast Command: frame
No stack.

Result: No stack.




Well, it is sometimes unreliable (gdb?)

Mirek
Re: Cannot debug application on ubuntu linux [message #57420 is a reply to message #57419] Thu, 05 August 2021 23:54 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
Gdb seems works fine. I don't know how to explain this behavior.

I look to Terminal.cpp, and see that before launch upp looks for consoles, and use first that it find. In my case it is konsole.
And seems no option to switch to another, like xterm.

I'm later try to switch to xterm and see what happens (by commenting other alternatives in src of upp and rebuilding upp).
Re: Cannot debug application on ubuntu linux [message #57421 is a reply to message #57420] Fri, 06 August 2021 00:02 Go to previous messageGo to next message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
with xterm nothing changed, so problem in communication with gdb i think
Re: Cannot debug application on ubuntu linux [message #57426 is a reply to message #57421] Sat, 07 August 2021 09:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
What happens if you do

tail -f /dev/null

on commandline?

BTW, it is a long time since this workaround was introduced (and worked fine until now), but I think that the tail command is there just to make the terminal open or something, there probably should be some alternatives to it.

Mirek
Re: Cannot debug application on ubuntu linux [message #57429 is a reply to message #57426] Mon, 09 August 2021 12:08 Go to previous message
alex-t is currently offline  alex-t
Messages: 12
Registered: August 2021
Promising Member
After
tail -f /dev/null

terminal waits for output, seems as freezed.

I not understanding for now this hack.

Previous Topic: Linux Executable
Next Topic: Build with no preset comper/linker switches
Goto Forum:
  


Current Time: Thu Apr 18 07:28:55 CEST 2024

Total time taken to generate the page: 0.02399 seconds