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 271313 - Unable to see code while stepping the code via debugger
Summary: Unable to see code while stepping the code via debugger
Status: RESOLVED INCOMPLETE
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.2
Hardware: PC Other
: P1 normal (vote)
Assignee: Maria Tishkova
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-16 18:28 UTC by antoniocs
Modified: 2017-08-25 15:07 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description antoniocs 2017-08-16 18:28:32 UTC
Hey,

I have a custom c++ project (https://github.com/AntonioCS/mustachecpp)
This is the folder structure:

- build
-- exe
- src
-- main.cpp
makefile
README.md


I put a breakpoint in main.cpp and when I click on the debugger I am shown a disassembly window. I can't go back to the code.

I have gone into the projects properties and in the Debug section I have set the Source dirs to src.

Am I doing something wrong or is this an issue?
Comment 1 Maria Tishkova 2017-08-17 09:19:14 UTC
Works fine for me.
Steps to create your project that will work

1. New Project
2. C/C++-> Project with existing code
3. In the Wizard "Select Mode" step specify   the math to your mustachecpp-master folder -> all other use as set (USe Build Analyzer is turned on, configuration is Automatic)
Press Finish.

The project will be created and Build is started.

Use Step Into in the Project context menu -> debugger is started and your main.cpp file is opened in the editor. 
Enjoy our IDE!:)
Comment 2 antoniocs 2017-08-17 11:35:11 UTC
I just tried this on another machine and it does seem to work.
Not sure why it didn't work with my initial project. I will try to rescan the project or something and see if that works.
Comment 3 antoniocs 2017-08-17 21:41:37 UTC
It still does not work.
Please create a custom project similar to mine but do not add the code.
Just place the main.cpp with a simple code such as:

#include <iostream>

int main(int argc, char **argv) {

   return 0;
}

And then add the rest of the code.
I do NOT get the assembly window if I create a project with the current state of the project (as it is now in github) but with the original project, even after I have done "Code Assistance > Reparse project", I still get the assembly window.

You can see it happening here: https://www.youtube.com/watch?v=vjT49H2_4mg
Comment 4 Maria Tishkova 2017-08-18 07:38:38 UTC
youtube video doesn't help to understand and fix problem :)

Let's try to understand what happened

1. Please attach messages.log (can be found in NetBeans userdir, see View->IDE Log to locate userdir)
2. GDB log (see http://wiki.netbeans.org/GdbLog)


P.S. Code Assistance has nothing to do with debugging. At all. Debugger is  GDB started with your symbol files and if you do not have the debug information (-g) for example Code Assistance will not help. 
Code Assistance is about so called Code Model features such as Code Completion, Find Usages, Refactoring, Go To Declaration/Definition.
Comment 5 antoniocs 2017-08-18 07:56:46 UTC
The youtube video may not help you fix the problem but it demonstrates the problem and so I hope that you won't be tempted to close the ticket again by just saying "it works on my machine"

I don't have access to the machine now but I will provide all the logs as soon as I have access.

Yeah, I thought as much, but I am willing to try anything to get this work and you have access to the makefile of the project (in the github repo) you can clearly see that I am passing the -g flag to g++ (https://github.com/AntonioCS/mustachecpp/blob/1df382bd88ae39d0cee5af1e15010f94fd3f05e8/makefile#L5)
Comment 6 soldatov 2017-08-18 09:18:29 UTC
I see you uses Windows. Can you describe you tools? MinGW, MSYS2, Cygwin, custom build?
Comment 7 antoniocs 2017-08-18 09:21:56 UTC
I use MSYS2. 

I believe the g++ and gdb versions are the following:

gcc version 6.3.0
GNU gdb (GDB) 7.12.1
Comment 8 Maria Tishkova 2017-08-22 15:42:19 UTC
Ok. Can you please try developer version of NetBeans.
The latest bits can be downloaded here: http://bits.netbeans.org/dev/nightly/latest/
I tried on my windows (virtual machinne), created project from your source and it worked fine for me with Cygwin. 
Please try latest bits, if no luck - please send me GDB log again with the latest bits. Also you could try to use cygwin instead of msys.


P.S. From the GDB log you sent by email I see the message " Source file is more recent than executable" (I do not think this is the reason of disassembly window though). Some debugger bugs were fixed recently and I strongly recommend you to try latest bits
Comment 9 antoniocs 2017-08-23 22:01:11 UTC
The same exact thing happened. I imported the configurations from my previous Netbeans, this might have been a mistake.

As I mentioned in a previous comment I did get this to work on another machine (with the same version of netbeans and also running msys2).
Not sure what setting might be doing this.

I have upgraded gcc and gdb.
gcc version 7.2.0 (Rev1, Built by MSYS2 project)
GNU gdb (GDB) 7.11.1

I have destroyed the project and rebuilt it. (not sure that all the settings were destroyed because when I recreated the project I had the same exact breakpoints set in the main file)

Are there any other alternatives? This seriously complicates my C++ development.
Comment 10 antoniocs 2017-08-23 22:03:15 UTC
One thing I wanted to ask.
In the project Properties in Debug there is a "Substitute Path". Might this feature do something? Might somehow gdb getting different paths (or something similar?) 
I can't seem to find documentation showing examples of how or when to use this feature.
Comment 11 soldatov 2017-08-24 09:11:22 UTC
Works for me in Msys2 (GCC 5.4.0, GDB 7.11.1) + NetBeans 8.2 case

Do you have some non-latin symbols or spaces in full path to you project?
Can you attach you executable file?
Can you try some commands in GDB console (Window > Debugging > Debugger Console)? For example:
info source
info files
b main
where
Comment 12 soldatov 2017-08-24 09:17:05 UTC
In my case:

info source                                                                                                                                               
(gdb) 
Current source file is src/main.cpp
Compilation directory is C:\\tmp\\mustachecpp-master
Located in C:\\tmp\\mustachecpp-master\\src\\main.cpp
Contains 138 lines.
Source language is c++.
Producer is GNU C++14 5.4.0 -mtune=generic -march=x86-64 -g -std=c++14.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
(gdb)
info files                                                                                                                                                
(gdb) 
Symbols from \"C:\\tmp\\mustachecpp-master\\build\\mustachecpp.exe\".
Native process:
\tUsing the running image of child Thread 20620.0x5c34.
\tWhile running this, GDB does not access memory from...
Local exec file:
\t`C:\\tmp\\mustachecpp-master\\build\\mustachecpp.exe', file type pei-x86-64.
\tEntry point: 0x401510
\t0x0000000000401000 - 0x0000000000403400 is .text
\t0x0000000000404000 - 0x00000000004040b8 is .data
\t0x0000000000405000 - 0x0000000000405a50 is .rdata
\t0x0000000000406000 - 0x0000000000406318 is .pdata
\t0x0000000000407000 - 0x00000000004072fc is .xdata
\t0x0000000000408000 - 0x00000000004089b0 is .bss
\t0x0000000000409000 - 0x0000000000409d30 is .idata
\t0x000000000040a000 - 0x000000000040a068 is .CRT
\t0x000000000040b000 - 0x000000000040b068 is .tls
\t0x000000000040c000 - 0x000000000040c4e8 is .rsrc
\t0x00007ffc097f1000 - 0x00007ffc09918d0e is .text in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc09919000 - 0x00007ffc099191c6 is RT in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc0991a000 - 0x00007ffc0991e200 is .data in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc09923000 - 0x00007ffc0992f2e8 is .pdata in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc09930000 - 0x00007ffc09930260 is .mrdata in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc09931000 - 0x00007ffc09931bc1 is text in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc09932000 - 0x00007ffc099347d0 is data in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc09935000 - 0x00007ffc09997450 is .rsrc in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc09998000 - 0x00007ffc099996b6 is .reloc in C:\\windows\\SYSTEM32\
tdll.dll
\t0x00007ffc086e1000 - 0x00007ffc087f3924 is .text in C:\\windows\\system32\\kernel32.dll
\t0x00007ffc087f4000 - 0x00007ffc087f4e00 is .data in C:\\windows\\system32\\kernel32.dll
\t0x00007ffc087f6000 - 0x00007ffc087fdd34 is .pdata in C:\\windows\\system32\\kernel32.dll
\t0x00007ffc087fe000 - 0x00007ffc08809bf2 is .idata in C:\\windows\\system32\\kernel32.dll
\t0x00007ffc0880a000 - 0x00007ffc0880a520 is .rsrc in C:\\windows\\system32\\kernel32.dll
\t0x00007ffc0880b000 - 0x00007ffc0881994c is .reloc in C:\\windows\\system32\\kernel32.dll
\t0x00007ffc06c31000 - 0x00007ffc06d1d4cc is .text in C:\\windows\\system32\\KernelBase.dll
\t0x00007ffc06d1e000 - 0x00007ffc06d21800 is .data in C:\\windows\\system32\\KernelBase.dll
\t0x00007ffc06d22000 - 0x00007ffc06d3340c is .pdata in C:\\windows\\system32\\KernelBase.dll
\t0x00007ffc06d34000 - 0x00007ffc06d39c3e is .idata in C:\\windows\\system32\\KernelBase.dll
\t0x00007ffc06d3a000 - 0x00007ffc06d3d530 is .rsrc in C:\\windows\\system32\\KernelBase.dll
\t0x00007ffc06d3e000 - 0x00007ffc06d3e55c is .reloc in C:\\windows\\system32\\KernelBase.dll
\t0x00007ffc09501000 - 0x00007ffc0958eb68 is .text in C:\\windows\\system32\\msvcrt.dll
\t0x00007ffc0958f000 - 0x00007ffc09593400 is .data in C:\\windows\\system32\\msvcrt.dll
\t0x00007ffc09594000 - 0x00007ffc0959c004 is .pdata in C:\\windows\\system32\\msvcrt.dll
\t0x00007ffc0959d000 - 0x00007ffc0959eaca is .idata in C:\\windows\\system32\\msvcrt.dll
\t0x00007ffc0959f000 - 0x00007ffc095a0247 is text in C:\\windows\\system32\\msvcrt.dll
\t0x00007ffc095a1000 - 0x00007ffc095a4200 is data in C:\\windows\\system32\\msvcrt.dll
\t0x00007ffc095a5000 - 0x00007ffc095a53f8 is .rsrc in C:\\windows\\system32\\msvcrt.dll
\t0x00007ffc095a6000 - 0x00007ffc095a64ec is .reloc in C:\\windows\\system32\\msvcrt.dll
\t0x0000000061441000 - 0x000000006144f5f0 is .text in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x0000000061450000 - 0x0000000061450058 is .data in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x0000000061451000 - 0x00000000614530b0 is .rdata in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x0000000061454000 - 0x0000000061454828 is .pdata in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x0000000061455000 - 0x0000000061455704 is .xdata in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x0000000061456000 - 0x0000000061456960 is .bss in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x0000000061457000 - 0x0000000061457ae8 is .edata in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x0000000061458000 - 0x0000000061458844 is .idata in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x0000000061459000 - 0x0000000061459058 is .CRT in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x000000006145a000 - 0x000000006145a068 is .tls in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x000000006145b000 - 0x000000006145b068 is .reloc in C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll
\t0x000000006fc41000 - 0x000000006fd03e70 is .text in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd04000 - 0x000000006fd07c68 is .data in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd08000 - 0x000000006fd1ff60 is .rdata in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd20000 - 0x000000006fd2cd8c is .pdata in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd2d000 - 0x000000006fd3f28c is .xdata in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd40000 - 0x000000006fd41440 is .bss in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd42000 - 0x000000006fd989a2 is .edata in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd99000 - 0x000000006fd9a520 is .idata in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd9b000 - 0x000000006fd9b058 is .CRT in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd9c000 - 0x000000006fd9c068 is .tls in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x000000006fd9d000 - 0x000000006fd9ed68 is .reloc in C:\\msys64\\mingw64\\bin\\libstdc++-6.dll
\t0x0000000064941000 - 0x0000000064948bf8 is .text in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x0000000064949000 - 0x00000000649490a8 is .data in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x000000006494a000 - 0x000000006494ab10 is .rdata in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x000000006494b000 - 0x000000006494ba80 is .pdata in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x000000006494c000 - 0x000000006494c894 is .xdata in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x000000006494d000 - 0x000000006494d9b0 is .bss in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x000000006494e000 - 0x000000006494f0df is .edata in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x0000000064950000 - 0x0000000064950d98 is .idata in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x0000000064951000 - 0x0000000064951060 is .CRT in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x0000000064952000 - 0x0000000064952068 is .tls in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x0000000064953000 - 0x0000000064953450 is .rsrc in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x0000000064954000 - 0x0000000064954068 is .reloc in C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll
\t0x00007ffc08971000 - 0x00007ffc08a08580 is .text in C:\\windows\\system32\\user32.dll
\t0x00007ffc08a09000 - 0x00007ffc08a0a800 is .data in C:\\windows\\system32\\user32.dll
\t0x00007ffc08a0b000 - 0x00007ffc08a17810 is .pdata in C:\\windows\\system32\\user32.dll
\t0x00007ffc08a18000 - 0x00007ffc08a1b9c4 is .idata in C:\\windows\\system32\\user32.dll
\t0x00007ffc08a1c000 - 0x00007ffc08adfe18 is .rsrc in C:\\windows\\system32\\user32.dll
\t0x00007ffc08ae0000 - 0x00007ffc08ae0368 is .reloc in C:\\windows\\system32\\user32.dll
\t0x00007ffc08821000 - 0x00007ffc0893abec is .text in C:\\windows\\system32\\gdi32.dll
\t0x00007ffc0893b000 - 0x00007ffc0893ea00 is .data in C:\\windows\\system32\\gdi32.dll
\t0x00007ffc0893f000 - 0x00007ffc0894df88 is .pdata in C:\\windows\\system32\\gdi32.dll
\t0x00007ffc0894e000 - 0x00007ffc08950178 is .idata in C:\\windows\\system32\\gdi32.dll
\t0x00007ffc08951000 - 0x00007ffc089629c8 is .rsrc in C:\\windows\\system32\\gdi32.dll
\t0x00007ffc08963000 - 0x00007ffc08963fc0 is .reloc in C:\\windows\\system32\\gdi32.dll
\t0x00007ffc07131000 - 0x00007ffc07154d80 is .text in C:\\windows\\system32\\imm32.dll
\t0x00007ffc07155000 - 0x00007ffc07155a00 is .data in C:\\windows\\system32\\imm32.dll
\t0x00007ffc07156000 - 0x00007ffc0715a848 is .pdata in C:\\windows\\system32\\imm32.dll
\t0x00007ffc0715b000 - 0x00007ffc0715d100 is .idata in C:\\windows\\system32\\imm32.dll
\t0x00007ffc0715e000 - 0x00007ffc07162c40 is .rsrc in C:\\windows\\system32\\imm32.dll
\t0x00007ffc07163000 - 0x00007ffc07163088 is .reloc in C:\\windows\\system32\\imm32.dll
\t0x00007ffc08c11000 - 0x00007ffc08cede08 is .text in C:\\windows\\system32\\msctf.dll
\t0x00007ffc08cee000 - 0x00007ffc08cef400 is .data in C:\\windows\\system32\\msctf.dll
\t0x00007ffc08cf0000 - 0x00007ffc08d00644 is .pdata in C:\\windows\\system32\\msctf.dll
\t0x00007ffc08d01000 - 0x00007ffc08d04780 is .idata in C:\\windows\\system32\\msctf.dll
\t0x00007ffc08d05000 - 0x00007ffc08d46a50 is .rsrc in C:\\windows\\system32\\msctf.dll
\t0x00007ffc08d47000 - 0x00007ffc08d48e5c is .reloc in C:\\windows\\system32\\msctf.dll
(gdb)
b main
(gdb) 
Note: breakpoint 1 also set at pc 0x4015dd.
Breakpoint 3 at 0x4015dd: file src/main.cpp, line 118.
(gdb)
where
(gdb) 
#0  main (argc=1, argv=0x5318d0) at src/main.cpp:118
(gdb)
Comment 13 antoniocs 2017-08-24 20:59:42 UTC
I uninstalled netbeans (removed everything).
Haven't installed any plugins just created the project ran the debugger and it WORKED!!

I will install the plugins I had and will check if that breaks something.

Thanks again to all that helped!
Comment 14 antoniocs 2017-08-24 20:59:53 UTC
I uninstalled netbeans (removed everything).
Haven't installed any plugins just created the project ran the debugger and it WORKED!!

I will install the plugins I had and will check if that breaks something.

Thanks again to all that helped!
Comment 15 Maria Tishkova 2017-08-25 13:52:37 UTC
Closed as works at the user's machine. Please let me know which version of NetBeans works for you? Dev or NetBeans8.2 (if it is clean 8.2 and later you will install updates they can break your debugging. In this case I strongly recommend to use Dev version)
Comment 16 antoniocs 2017-08-25 15:07:30 UTC
I am using netbeans 8.2 not the dev version.
I have been installing the plugins and trying to see if that breaks debugging. So far so good. I will keep checking if I missed any plugins.

Thanks for all the help!