Author Topic: debugging and #line directives  (Read 12787 times)

Offline stevenkucera

  • Single posting newcomer
  • *
  • Posts: 4
debugging and #line directives
« on: January 20, 2012, 04:08:03 am »
Hi World,

I have installed Code::Blocks on Ubuntu and would like to use it with http://www.lazycplusplus.com/. This makes .cpp and .h files from .lzz files, referencing to the .lzz files with #line directives in the .cpp and .h files. I have noticed:

Warning and error messages are correctly cross-referenced to the .lzz files when I compile the .cpp files.
Code::Blocks allows you to set breakpoints and in the .lzz file and the debugger will correctly stop at the right line of code in the .lzz file.
BUT: the little arrow meant to show where the current executing line is in the debugger is absent.

I am thinking this is a simple oversight rather than a bug, but it would be cool if it can be fixed.

Thoughts?

Steve

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: debugging and #line directives
« Reply #1 on: January 20, 2012, 08:47:46 am »
/off: What on earth caused some guy to write this stupidity? Turning C++ into Java style single file O_O...

Can you paste (inside a code tag) the full debugger's debug log.
This log is not the default debuglog, but you have to enable it in the settings (Settings -> Compiler & Debugger -> Debugger).
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: debugging and #line directives
« Reply #2 on: January 20, 2012, 09:20:05 am »
I just tested it with a very simple test-project and actual debugger-nightly from my repo on debian and it works correctly (not lzz, because it can not find iostream, so I had to do some tiny manual tweaking, but it shows the yellow triangle, in the cpp-, h- and lzz-file).

Offline stevenkucera

  • Single posting newcomer
  • *
  • Posts: 4
Re: debugging and #line directives
« Reply #3 on: January 20, 2012, 10:50:26 am »
Hi,

Here is my LZZ code:

Code
#src
#include <iostream>
#end

using namespace std;

int main()
{
   cout << "Hello world 1" << endl;
   cout << "Hello world 2" << endl;
   cout << "Hello world 3" << endl;
   cout << "Hello world 4" << endl;
}

The two generated files:
Code
// Test.h
//

#ifndef LZZ_Test_h
#define LZZ_Test_h
#define LZZ_INLINE inline
#line 7 "Test.lzz"
int main ();
#undef LZZ_INLINE
#endif

// Test.cpp
//

#include "Test.h"
#line 2 "Test.lzz"
#include <iostream>
#define LZZ_INLINE inline
#line 5 "Test.lzz"
using namespace std;
#line 7 "Test.lzz"
int main ()
#line 8 "Test.lzz"
{
   cout << "Hello world 1" << endl;
   cout << "Hello world 2" << endl;
   cout << "Hello world 3" << endl;
   cout << "Hello world 4" << endl;
}
#undef LZZ_INLINE

I put a breakpoint on the first cout and single step the rest of the program, here is the debug log. Everything appears in the terminal as it should, the only thing missing is the triangle. Pls forgive if I've missed something obvious, I am new to the IDE.

Steve
Code
LD_LIBRARY_PATH=.:
Command-line: /usr/bin/gdb -nx -fullname  -quiet -args bin/Debug/TestLzz
Working dir : /home/steve/TestLzz/
Reading symbols from /home/steve/TestLzz/bin/Debug/TestLzz...done.
(gdb)
> set prompt >>>>>>cb_gdb:
Executing: xterm -T 'Program Console' -e sleep 107722
>>>>>>cb_gdb:
> show version
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 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".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set disassembly-flavor intel
>>>>>>cb_gdb:
> catch throw
Function "__cxa_throw" not defined.
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
Executing: ps x -o tty,pid,command
>>>>>>cb_gdb:
> directory /home/steve/TestLzz/
>>>>>>cb_gdb:
> break "/home/steve/TestLzz/Test.lzz:9"
PS result: ?        28333 ps x -o tty,pid,command
PS result: pts/0    28330 sleep 107722
TTY is[/dev/pts/0]
GetConsoleTTY[/dev/pts/0]ConsolePid[28328]
Queued:[tty /dev/pts/0]
Breakpoint 2 at 0x400758: file Test.lzz, line 9.
>>>>>>cb_gdb:
> tty /dev/pts/0
>>>>>>cb_gdb:
> run
Breakpoint 2, main () at Test.lzz:9
/home/steve/TestLzz/Test.lzz:9:66:beg:0x400758
>>>>>>cb_gdb:
> next
/home/steve/TestLzz/Test.lzz:10:102:beg:0x40076f
>>>>>>cb_gdb:
> next
/home/steve/TestLzz/Test.lzz:11:138:beg:0x400786
>>>>>>cb_gdb:
> next
/home/steve/TestLzz/Test.lzz:12:174:beg:0x40079d
>>>>>>cb_gdb:
> next
/home/steve/TestLzz/Test.lzz:13:210:beg:0x4007b4
>>>>>>cb_gdb:
> next
258 libc-start.c: No such file or directory.
__libc_start_main (main=0x400754 <main()>, argc=1, ubp_av=0x7fffffffe6f8, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffe6e8) at libc-start.c:258
in libc-start.c
>>>>>>cb_gdb:
> next
[Inferior 1 (process 28334) exited normally]
>>>>>>cb_gdb:
> next
The program is not being run.
>>>>>>cb_gdb:
> quit

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: debugging and #line directives
« Reply #4 on: January 20, 2012, 10:57:16 am »
You've not mentioned what version you are using. If you're using 10.05 or trunk nightly please try with a debugger's branch nightly build and report it is still broken.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: debugging and #line directives
« Reply #5 on: January 20, 2012, 11:13:33 am »
I just tested again (your project) with the actual debian-nightlies (from my repo) for debugger-branch and it works fine, the trunk nightly does not show the triangle.

Offline stevenkucera

  • Single posting newcomer
  • *
  • Posts: 4
Re: debugging and #line directives
« Reply #6 on: January 21, 2012, 01:31:38 am »
Thanks guys, I downloaded the latest C::B and the triangle works!

Btw. regarding lzz, I have used both it and normal C++ and like lzz a lot. To each his own!

Steve