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.
Lets assume the next example: 1. mkdir /export/home/tester/1 2. cd /export/home/tester/1 3. vi args.c ----------------------------------------- #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char**argv) { int i; // Prints arguments printf("Arguments:\n"); for (i = 0; i < argc; i++) { printf("%i: %s\n", i, argv[i]); } return 0; } ----------------------------------------- 4. vi Makefile --------------------------------- args: args.c gcc -g -o args args.c ---------------------------------- 5. Start Netbeans 6. New project with existing Makefile 6.1 Project Name and Location set default(project location is ~/MakefileProject1) 6.2 Build actions: choose Working directory: /export/home/tester/1 Build command: make Output file: args 6.3 On "Source File Folders" add /export/home/tester/1 Click Finish. 7. Build project 8. Due to IZ 86064 we need to point output file in project properties by hands. Open Properties/Configuration Properties/Make, set "/export/home/tester/1/args" in Output property. 9. Open args.c in editor. Set Toggle breakpoint at line 10. 10. Run debugger. It ignores breakpoint and just execute the program
It looks like this problem is not reproducible on Windows, so there is some Unix specific (file name?). I'll check it out tomorrow on Solaris. Alexander, if you still can reproduce this problem, could you please add all messages, that you see in "Debugger Console", to this bug report? (to stop the program you can set a function breakpoint on "_exit").
Nik, problem is still reproduced on Linux-machine, exactly on sqao35. gdb output is the next: Start debugger gdb gdb_cmd=gdb --nw --interpreter=mi --tty /dev/pts/3 ~"GNU gdb Red Hat Linux (6.1post-1.20040607.41rh)\n" ~"Copyright 2004 Free Software Foundation, Inc.\n" ~"GDB is free software, covered by the GNU General Public License, and you are\n" ~"welcome to change it and/or distribute copies of it under certain conditions.\n" ~"Type \"show copying\" to see the conditions.\n" ~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n" ~"This GDB was configured as \"i386-redhat-linux-gnu\"." ~"\n" (gdb) 212-file-exec-and-symbols /export/home/tester/MakefileProject5/../1/args ~"Using host libthread_db library \"/lib/tls/libthread_db.so.1\".\n" 212^done 501-break-insert /export/home/tester/1/args.c:10 (gdb) &"No source file named /export/home/tester/1/args.c.\n" 501^error,msg="No source file named /export/home/tester/1/args.c." (gdb) -exec-run ^running (gdb) To receive this output I've included program stopper line: scanf(); after breakpoint. In other cases Debugger Console were immediately closed as program finished.
function breakpoint on _exit is also ignored...
Yes, there is no _exit function. You can try to set function breakpoint in _fini function.
I investigated the problem, and it seems that the root of it is in some bug in gdb 6.1 - it does not work properly with filename in "-break-insert" command. It works properly in one case: when current directory is the same where the executable is. Please take a look at 2 scenarios below: in first case gdb works just fine, in second case it failed. The only difference is that in second case I changed current directory to "/". Alexander, could you please try a small test? Do the same steps as you described, and when program hangs on scanf(), interrupt it with Ctrl-C (or send -INT signal to args process). After that gdb will stop the program, and you can type in commands in "Debugger Console" window. Type in the following commands in "Debugger Console" input text field: cd /export/home/tester/1 shell pwd 501-break-insert /export/home/tester/1/args.c:10 -exec-run This should set the breakpoint, restart the execution, and it should stop at breakpoint. ============ Scenario 1 =================== sside-linux tester/1> pwd /export/home/tester/1 sside-linux tester/1> ls -l -rwxrwxr-x 1 nikm wheel 13141 2006-10-02 17:25 args -rw-rw-r-- 1 nikm wheel 389 2006-10-02 17:25 args.c -rw-rw-r-- 1 nikm wheel 62 2006-10-02 17:25 Makefile sside-linux tester/1> gdb --nw --interpreter=mi --tty /dev/pts/6 ~"GNU gdb 6.1\n" ~"Copyright 2004 Free Software Foundation, Inc.\n" ~"GDB is free software, covered by the GNU General Public License, and you are\n" ~"welcome to change it and/or distribute copies of it under certain conditions.\n" ~"Type \"show copying\" to see the conditions.\n" ~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-suse-linux\"." ~"\n" (gdb) 212-file-exec-and-symbols /export/home/tester/1/args ~"Using host libthread_db library \"/lib64/tls/libthread_db.so.1\".\n" 212^done (gdb) 501-break-insert /export/home/tester/1/args.c:10 501^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000 0000004005a0",func="main",file="args.c",line="10",times="0"} (gdb) ============ Scenario 2 =================== sside-linux tester/MakefileProject5> cd / Directory: / sside-linux /> gdb --nw --interpreter=mi --tty /dev/pts/6 ~"GNU gdb 6.1\n" ~"Copyright 2004 Free Software Foundation, Inc.\n" ~"GDB is free software, covered by the GNU General Public License, and you are\n" ~"welcome to change it and/or distribute copies of it under certain conditions.\n" ~"Type \"show copying\" to see the conditions.\n" ~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-suse-linux\"." ~"\n" (gdb) 212-file-exec-and-symbols /export/home/tester/1/args ~"Using host libthread_db library \"/lib64/tls/libthread_db.so.1\".\n" 212^done (gdb) 501-break-insert /export/home/tester/1/args.c:10 &"No source file named /export/home/tester/1/args.c.\n" 501^error,msg="No source file named /export/home/tester/1/args.c." (gdb) ==================================================================
I have gdb 6.2.1 on my local machine. Your scenarios have the same output on gdb 6.2.1 And I don't know how to send INT signal to debugged process. I do not see the process args or any new processes after starting debugger in my process list(command "top"). And in the Runtime window of Netbeans there is no debugged process in "Processes"(for Java debugging processes I can see new 'java' process in top comand and 'debug' process in Runtime window)...
I found out that we can help gdb to find source files. There is special command "directory": directory -- Add directory DIR to beginning of search path for source files The suggested fix is to pass the following command to gdb before setting breakpoints: directory /... where "/..." is the directory name where executable is. I verified that the fix works just fine on Linux with gdb 6.1. The fix is integrated in "release55" branch. -------------------------------------------------------------- Tag: release55 User: NikMolchanov Date: 2006/10/03 15:03:03 Modified: cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxyCL.java Log: IZ 86069 toggle(line) breakpoints are ignored in makefile-based projects. - Added "directory" setting to help gdb 6.1 and gdb 6.2 to find source file. File Changes: Directory: /cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/ ============================================================== File [changed]: GdbProxyCL.java Url: http://cnd.netbeans.org/source/browse/cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxyCL.java?r1=1.2.2.10&r2=1.2.2.11 Delta lines: +16 -3 -------------------- --- GdbProxyCL.java 1 Oct 2006 01:52:14 -0000 1.2.2.10 +++ GdbProxyCL.java 3 Oct 2006 22:03:00 -0000 1.2.2.11 @@ -362,6 +362,17 @@ // Tell low level to send the command to the debugger reply = gdbProxy.gdbProxyML.sendCommand(cmd); if ( reply != null) return reply; + // Set directory for search path (for gdb 6.1 and gdb 6.2) + if (!isWindows) { + int i = program.lastIndexOf('/'); + if (i >= 0) { + if (gdbVersion.startsWith("6.1") || gdbVersion.startsWith("6.2")) { + String directory = "directory "; // NOI18N + directory += program.substring(0, i); // IZ 86069 + gdbProxy.gdbProxyML.sendCommand(directory); + } + } + } // Set external terminal (not implemented yet) // -inferior-tty-set /dev/pts/1 // -inferior-tty-show @@ -1816,9 +1827,11 @@ gdbVersion=message.substring(s1.length()); //log.fine("DEBUG: extractGdbVersion gdbVersion = "+gdbVersion); // DEBUG } + if (isWindows) { if (message.toLowerCase().contains("cygwin")) { gdbIsCygwin = true; } + } } /** ---------------------------------------------------------------------
ok, debugger became working, but no annotations, no current pc appears as it described for function breakpoints in 86067