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.

Bug 233683 - Gdb doesn't work with NetBeans 7.3.1
Summary: Gdb doesn't work with NetBeans 7.3.1
Status: RESOLVED INCOMPLETE
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: henk89
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-30 19:35 UTC by john_ousterhout
Modified: 2014-07-02 09:02 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Gdb log file (6.94 KB, text/plain)
2013-07-31 21:22 UTC, john_ousterhout
Details
Gdb log file from larger project (8.71 KB, text/plain)
2013-08-01 16:22 UTC, john_ousterhout
Details

Note You need to log in before you can comment on or make changes to this bug.
Description john_ousterhout 2013-07-30 19:35:45 UTC
I recently upgraded from NetBeans 7.2 to NetBeans 7.3.1, and since the upgrade I have not been able to get gdb to work for C++ debugging. I'm able to run programs in debug mode, but there seems to be no way to stop them: breakpoints do not trigger, and the Pause button has no effect.

I am cross-developing: NetBeans runs on a Windows 7 laptop, and build and test run on a Linux box ("Automatic copying" mode).

This seems to be a difference between NetBeans 7.2 and 7.3.1: when I downgraded back to 7.2, debugging worked fine again.

Any suggestions on what I might be doing wrong?
Comment 1 Vladimir Voskresensky 2013-07-31 06:35:41 UTC
Could you start NB with clean userdir and do not import settings from 7.2?
Can you try any sample project and check if debugger has problems as well?
Comment 2 john_ousterhout 2013-07-31 17:57:59 UTC
I re-created the NetBeans project from scratch when I upgraded to 7.3.1 (I accidentally lost the old "nbproject" directory during the upgrade). Is this what you mean by "clean userdir", or is there something else I should do in addition?

I just tried the "Welcome" project under Samples->C/C++ in the "New Project" wizard, and I can't get breakpoints to work with this project either. As with my own project, the project will run under the debugger (I checked to see that there is really a gdb process running on the target machine), but it will not stop at breakpoints. With this project I *was* able to use the Pause button to get into the debugger. To do this, I added a usleep line to slow the process down:

    std::cout << "Welcome ..." << std::endl;
    usleep(10000000);

    // Prints arguments...
    if (argc > 1) {
    ...

Then, once the process got running, I was able to click Pause and get into the debugger. I tried setting an additional breakpoint while in the debugger, but when I clicked Continue, the process executed to completion without stopping at the new breakpoint.
Comment 3 soldatov 2013-07-31 18:47:40 UTC
john_ousterhout, use Window|Debugging|Debugger Console instead of magic hacks
Comment 4 john_ousterhout 2013-07-31 19:00:07 UTC
soldatov: sorry, but I don't know how you'd like me to use Window|Debugging|Debugger Console; shouldn't I just be able to click the "Debug Project" icon to run the debugger?

Also, I'm not sure what you mean by "magic hacks".

Can you provide a bit more information?
Comment 5 soldatov 2013-07-31 20:32:16 UTC
In "Debugger Console" (Gdb log) you can see:
- all commands from IDE to GDB
- all answers from GDB

You needs to repeat scenario from comment 2 (before "Continue") and attach full text from "Debugger Console" tab. Only Gdb log contains useful information.
Comment 6 john_ousterhout 2013-07-31 21:22:54 UTC
Created attachment 138087 [details]
Gdb log file

Ahah; thanks very much! I hadn't known previously about this window, and it's very helpful. I'm attaching the log file, and I think it helps to explain the problem.

In looking through the logs, I see that the commands attempting to set breakpoints failed, because gdb couldn't find the specified file. The tail of the file name is .../welcome_1/welcome.cc, and indeed, this file does not exist on the target machine. The actual file on the target machine is .../Welcome_1/welcome.cc (Welcome_1 is the project name).  It looks like there is some confusion over case in the gdb commands being generated? I see that in other situations the generated commands properly use "Welcome_1" instead of "welcome_1".
Comment 7 john_ousterhout 2013-08-01 16:22:52 UTC
Created attachment 138142 [details]
Gdb log file from larger project

Here is the debugger console session from a different (larger) project where breakpoints do not work under NetBeans 7.3.1. This one does not show the problem with uppercase versus lowercase that occurred in the sample project, but there are different errors. However, in spite of the errors, the breakpoint does appear to have been set properly in gdb, so I'm not sure why it doesn't trigger.
Comment 8 Blackbird808 2013-08-15 15:38:58 UTC
I came across the problem with 7.3.1, 7.4 too. Finally I solved it. It was a quite annoying that a such wonderful IDE couldn't debug program.

Here is my solution, hope it helps:

Project->Properties:
1. Build->Make->Build Result: fill the actual executable file name here, such as myapp.
2. Run->Run Command: start command line like this ./myapp
 
3. Run->Run Directory: /home/userxx/... like that.


This fixed the problem for me on both Windows and Linux.
Comment 9 john_ousterhout 2013-08-19 19:47:44 UTC
Thanks very much! That fixed things for me.  All I had to do was step 1 of your suggestion: fill in Build->Make->Build Result (I had previously left that blank and specified the command to run in the Debug panel).
Comment 10 RAM518 2014-05-09 09:24:19 UTC
I cannot for the life of me figure out how to use the gdb debugger to debug a C++ project within netbeans. I've tried playing around with the paths under project properties and debug tab there, but no success. This shouldn't be so difficult. I just want it to stop at a breakpoint.
Comment 11 henk89 2014-07-01 14:43:35 UTC
(In reply to RAM518 from comment #10)
> I cannot for the life of me figure out how to use the gdb debugger to debug
> a C++ project within netbeans. I've tried playing around with the paths
> under project properties and debug tab there, but no success. This shouldn't
> be so difficult. I just want it to stop at a breakpoint.

That is a certain problem?