This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
See also issue #115464 Steps to reproduce: - create Quote sample project - do step into project - do steps over until "discount" is calculated (in line 113) for name "John" - add a new watch for "getDiscountFor(customerName)", keep in mind that customerName is defined and a real "discount" is obtained Result: The value of the expression becomes: >The program being debugged was signaled while in a function called from GDB.\nGDB has restored the context to what it was before the call.\nTo change this behavior use "set unwindonsignal off"\nEvaluation of the expression containing the function ((anonymous namespace)::getDiscountFor(std::string)) will be abandoned<
For some reason gdb is saying customerName isn't in scope, even though it is. I tried this on Solaris with gdb 6.6 and duplicated the problem. The same test works on Solaris from the command line. I'll try on Windows but I just started a complete clean of my netbeans sources so I can't for an hour or so... What platform were you on when you saw this problem?
Actually, it did not work from the gdb command line. I evaluated "customerName" rather than "getDiscountFor(customerName)". When I tried the function, I got the same SEGV I get in the IDE. While I can't fix the fact gdb is segv'ing on the function call, I will replace the gdb message with a shorter one. I'll also see if it behaves differently on Windows and on Solaris with older versions of gdb.
Fixed
In build 20071005 Now gdb fails when a user creates a watch for getDiscountFor(customerName). - clean watches - perform the scenario from the description but add a new watch by selecting the function with a parameter in code and calling a context menu->New Watch (or Ctrl+Shift+F7). The watch appears with messages ">No symbol "customerName" in current context<" - do step over Result: The process exited with signal "SIGSEGV" on Linux and fails on Windows. When the watch was created before starting a debugger or just after stepping into or manually via the Watches window then function is not evaluated but debugger does not fail. The Value shows ">Gdb aborted evaluation<"
There are 2 problems here: Problem 1: Gdb fails to evaluate "getDiscountFor(customerName)". Instead, if gets a SIGSEGV. This is not a gdb-lite problem. Its either a gdb or g++ problem. Gdb is treating customerName as if its out-of-scope and getDiscountFor fails because its getting a random address passed to it. The best I can do here is to make sure the SEGV doesn't destroy the debug session, and replace the long message with one more user friendly. Thats what I did in my original commit for this bug. There is nothing I can do to keep gdb from getting a segv on what should be a valid watch. The 2nd problem is the process exiting with a SEGV. This actually isn't a watch problem but a tooltip problem. When you highlight "getDiscountFor(customerName)" it sends a tooltip request to gdb. Its very similar to what happens when you do the watch request for the same string. But while I unset breakpoints and tell gdb to ignore signals for watches, I didn't do that for tooltips. Hence the SEGV. The solution is to do for tooltip requests which make function calls exactly what I do for watches which make function calls. I've made that change and the SEGV goes away. By the way, the SEGV happens on both Linux and Solaris (I've got my PC booted to Linux now, so I can't see what happens on Windows). I'm closing this bug because I committed the tooltip fix. But the aborted watch cannot be fixed in gdb-lite. I did notice that on Ubuntu (with g++ 4.1.1) the watch and tooltip work. Thats why I'm inclined to think its a g++ bug and not a gdb bug. My hypothesis is that there is no debug information for customerName inside the do-while block and thats why the call fails.
The following watch causes GDB crash on Windows in Quote sample: getDiscountFor("John") Gdb crashes with an error window: Error: Unexpected GDB Failure The GDB Debugger has exited unexpectedly with a return code of 35584.
Created attachment 50700 [details] gdb log
I would like to note that command line gdb will work the same way, I have tried on my laptop and Segmentation fault (core dumped) occurred when I have tried to invoke print getDiscountFor("Ann") So, it looks more like gdb problem, not gdb-lite,and I think we should close it as INVALID Alexander, if you have case where gdb-lite (not gdb) will crash please reopen this IZ
We need to advocate for a fix in gdb. Have we explored this issue with the gdb community?
Indeed it's a GDB bug, somehow i missed it. The similar situation is with evaluating of expression so I mark the issue as verified.
Filed gdb bug report: > Thank you very much for your problem report. > It has the internal identification `c++/2333'. > The individual assigned to look at your > report is: unassigned. > > > >Category: c++ > > >Responsible: unassigned > > >Synopsis: gdb gets segv evaluating valid function call > > >Arrival-Date: Thu Oct 11 19:38:01 UTC 2007
The crash does not happen with GDB 6.6 only with GDB 6.5 (checked on Windows and Solaris) so it looks like this bug in GDB has been fixed. But function is not evaluated in any GDB and it's a bug that has to be fixed in GDB.
While this is a gdb (version 6.6) defect, from a user perspective it is seen as a gdb-lite defect. We can consider various workarounds, such as alerting the user that the watch for a function "is not available", or (better) we can work with the gdb community to fix the defect. That said, I think we need to keep the defect open and to waive it for NetBeans 6.0.
It's rather gdb than gdb-lite bug so I downgrade the priority to P3.
Fixed in gdb. gdb-lite handles gdb failures. Nothing else to do.
verified in build 20080321