Author Topic: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.  (Read 34546 times)

Max

  • Guest
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #15 on: August 31, 2010, 10:07:52 pm »
what should be the behavior when an exception is thrown when running from within the debugger in CB ?
I would guess, things should continue since code was catching the exception, right ?

Well, the debugger stops, waiting for an user action without any information in the debugger panel (I can discover that an exception was thrown looking at the debugger log only). It may be a good idea to get a message in the debug panel adding any available info (from gdb) about the issue. Or should I disseminate breakpoints in every catch block?  Any advice from you on the issue is welcome.

In the past, may be last year, I got info when an exception was thrown. But using different GCC and GDB. May be CB is doing the most...

Max

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #16 on: September 01, 2010, 12:11:06 am »
killerbot: the idea is to stop when the exception is thrown. So the user can inspect the reason for the throw (there is a checkbox in the settings to disable this feature).
MaxGaspa:
1. Hm, it seems that it doesn't work on windows (the regex doesn't match)

Here is a patch that should fix the problem.
Code
Index: src/plugins/debuggergdb/gdb_driver.cpp
===================================================================
--- src/plugins/debuggergdb/gdb_driver.cpp      (revision 6564)
+++ src/plugins/debuggergdb/gdb_driver.cpp      (working copy)
@@ -52,6 +52,8 @@
 static wxRegEx reBreak3(_T("^(0x[A-Fa-f0-9]+) in (.*)"));
 // Catchpoint 1 (exception thrown), 0x00007ffff7b982b0 in __cxa_throw () from /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/libstdc++.so.6
 static wxRegEx reCatchThrow(_T("^Catchpoint ([0-9]+) \\(exception thrown\\), (0x[0-9a-f]+) in (.+) from (.+)$"));
+// Catchpoint 1 (exception thrown), 0x00401610 in __cxa_throw ()
+static wxRegEx reCatchThrowNoFile(_T("^Catchpoint ([0-9]+) \\(exception thrown\\), (0x[0-9a-f]+) in (.+)$"));

 // easily match cygwin paths
 //static wxRegEx reCygwin(_T("/cygdrive/([A-Za-z])/"));
@@ -1097,6 +1099,15 @@
                 m_Cursor.changed = true;
                 m_needsUpdate = true;
             }
+            else if (reCatchThrowNoFile.Matches(lines[i]) )
+            {
+                m_Cursor.file = wxEmptyString;
+                m_Cursor.function= reCatchThrowNoFile.GetMatch(lines[i], 3);
+                m_Cursor.address = reCatchThrowNoFile.GetMatch(lines[i], 2);
+                m_Cursor.line = -1;
+                m_Cursor.changed = true;
+                m_needsUpdate = true;
+            }
         }
     }
     buffer.Clear();

2. Yes it will be merged with trunk, but it should be tested a bit more.

Thanks for the report :)
(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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5489
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #17 on: September 01, 2010, 09:57:48 am »
well then I can say, this works on both linux and windows (windows TDM GCC 4.4 and 4.5).
I was struggling with this (had no idea the debugger could catch the exceptions).

I ran a program in the debugger and after a while it stopped/halted/paused in the debugger, and looking at the call stack it had stopped on a "throw".
Just did an experiment on linux, and when I uncheck the catch C++ exceptions, it nicely continues (did this in a small test program).

In case of an uncheck it would be nice to see a list of occurred exceptions in the debug log. I did an experiment this weekend with MSVC2008 express, and there the debugger continued, but in the debug log panel one could see the exceptions that had occurred.

What am I missing with respect to people saying it does not work, or something is missing ?

Oh yeah : this was running trunk (on my windows machine), and a trunk nightly version from long ago. So maybe it got broken afterwards ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #18 on: September 01, 2010, 10:51:45 am »
Quote
In case of an uncheck it would be nice to see a list of occurred exceptions in the debug log.
The uncheck disables the feature inside gdb and it doesn't stop at all, nor prints anything.
I could make it skip the messages and print something in the log.

Quote
MSVC2008 express, and there the debugger continued, but in the debug log panel one could see the exceptions that had occurred.
Probably this is not implemented for the CDB. Can you provide the full debugger's debug log?

Quote
Oh yeah : this was running trunk (on my windows machine), and a trunk nightly version from long ago. So maybe it got broken afterwards ?
Hm, should test with a trunk version...
Can you test debugger's branch + the patch?
(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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5489
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #19 on: September 01, 2010, 11:05:47 am »
Quote
MSVC2008 express, and there the debugger continued, but in the debug log panel one could see the exceptions that had occurred.
Probably this is not implemented for the CDB. Can you provide the full debugger's debug log?

I mean completely in the IDE of MSVC express. Not within CB.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #20 on: September 01, 2010, 11:27:14 am »
In MSVC 2008 non express, C++ exceptions are disabled by default. To enabled them go to Debug->Exceptions -> C++ exception [check the throw checkbox]
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #21 on: September 01, 2010, 10:59:36 pm »
Killerbot: I've tested the latest normal nightly and catch exceptions doesn't work...
(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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5489
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #22 on: September 01, 2010, 11:09:44 pm »
just checked my win box : rev 5859. That one does catch exceptions, meaning when an exception is thrown the debugger stops, and the callstack show a throw at the deepest level. Can this be considered as 'working' or not ?

Max

  • Guest
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #23 on: September 01, 2010, 11:25:39 pm »
just checked my win box : rev 5859. That one does catch exceptions, meaning when an exception is thrown the debugger stops, and the callstack show a throw at the deepest level. Can this be considered as 'working' or not ?

In the end this is a developper's decision  :lol:

What I'm expecting (IMO) is to observe the most useful behaviour (the one I observed  long ago). The debuuger stops printing some information in the log panel. The perfect info (IMO) is the line of code in which the exception was thrown. 

I don't konw if that is feasible with a limited effort. The option to stay "as today" is not the preferred one (by me  :)) but is better than nothing  :)

Max
 

Max

  • Guest
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #24 on: September 02, 2010, 12:34:18 am »
Dear all,

I think to have found a bug (regression because it worked in the past).

Have a look at the image attached



Uploaded with ImageShack.us

or

http://img840.imageshack.us/img840/1463/debugger.jpg



The variable sqlStatement is a std::string containing

CREATE TABLE 1234567890123456789012345678901234567890_data (x REAL,y_1 REAL,y_2 REAL,y_3 REAL.......

In the memory dump (at the variable content's address) the content is correct. In the watches panel yhe strng's content is shown in several lines with the commas missed. The raw content of the first line (_M_p) is showing the first part of the string. Commas are missed.

I don't know if it's clear, hope this helps.

Max
« Last Edit: September 02, 2010, 12:53:13 am by MaxGaspa »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #25 on: September 02, 2010, 01:21:44 am »
MaxGapsa:
1. Please look at debugger's debug log and if the correct output is there, if it is please provide a simple project that reproduces the problem...
2. Looking at the watches window, it looks like the parser has failed to parse the watch value correctly. Test project please...

Killerbot: yes, stopping at the throw site is considered working "Catch exceptions" feature. Have you tried the patch I've provided?
(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!]

Max

  • Guest
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #26 on: September 02, 2010, 09:49:00 pm »
MaxGapsa:
1. Please look at debugger's debug log and if the correct output is there, if it is please provide a simple project that reproduces the problem...

Yes in the debugger log is correct. look at



http://img42.imageshack.us/img42/3205/debugger2.jpg

Uploaded with ImageShack.us

in which I'm using the testcase attached.


2. Looking at the watches window, it looks like the parser has failed to parse the watch value correctly. Test project please...

Killerbot: yes, stopping at the throw site is considered working "Catch exceptions" feature. Have you tried the patch I've provided?

Test project attached. Set a breakpoint on line 12 and when the debugger stops there add theString to the watches. Comma disappeared.

Hope this helps

Max

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 24 August 2010 build (6527) DEBUGGER BRANCH version is out.
« Reply #27 on: September 03, 2010, 02:37:28 am »
The watch and the catch exception bugs should be fixed with this patch: http://forums.codeblocks.org/index.php/topic,10908.msg88984.html#msg88984

MaxGaspa: next time please paste the ouput from the "output" command, screenshots are harder to use (I can't copy paste them:) )
(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!]