Add two scripts for running gdb so source listing works when debugging
authorTim Mayberry <mojofunk@gmail.com>
Sun, 11 Aug 2013 04:15:16 +0000 (14:15 +1000)
committerTim Mayberry <mojofunk@gmail.com>
Sat, 7 Dec 2013 10:48:19 +0000 (20:48 +1000)
Updated Debugging section in README

tools/windows_packaging/README
tools/windows_packaging/gdb-ardour.bat [new file with mode: 0644]
tools/windows_packaging/gdb.bat [new file with mode: 0644]
tools/windows_packaging/gdbinit_home [new file with mode: 0644]
tools/windows_packaging/package.sh

index 8a8c4c8d7bc6bc3f3d56cf25a793ecbe8d3a4c5b..c02320c32abde919d59fab4f820075640fc008db 100644 (file)
@@ -100,17 +100,43 @@ When configured for debugging the package contains gdb along with a .gdbinit
 file to automatically set the source directory so that the "list" gdb command
 will show the source code corresponding to the current stack frame.
 
-Use break `Somenamespace::somepartialsymbolname + tab to list symbols, then remove 
-` to set break. If you press tab with when there are thousands of possible
-matching symbols be prepared to wait a long time(this can also cause gdb to use a
-lot of memory).
+New versions of gdb will not load a .gdbinit file unless it is located in the directory
+set in the HOME environment variable and auto-load safe-path is set appropriately.
 
-For reasons I've yet to determine many symbols are not accessible so the best way
-to set a breakpoint is by using filename and line number.
+So the gdbinit_home file needs to be moved to directory set in %USERPROFILE% and
+gdb started via gdb.bat for source file listing to work.
+
+The gdb batch scripts cannot be used if the package directory is on a network share
+so the package will need to be copied to a local drive first.
+
+When starting gdb using gdb.bat the Ardour executable needs to be set as the program
+to be debugged with the "file" command
+
+e.g (gdb) file ardour-3.5.exe
+
+You can then set a break point at main() with the "break" command as usual
+
+e.g (gdb) break main
+
+To set a breakpoint in a dll/shared library like libardour you need to wait for
+the symbols to be loaded which only occurs once the program has been executed using
+the "run" command
+
+You can set a breakpoint at a function
+
+e.g break `Somenamespace::somepartialsymbolname + tab to list symbols
+
+then remove ` to set the breakpoint.
+
+If you press tab with when there are thousands of possible matching symbols be
+prepared to wait a long time(this can also cause gdb to use a lot of memory).
+For this reason I prefer to set breakpoints by specifying the source file and line
+number.
 
 e.g (gdb) break audiosource.cc:976
 
-but this seems to only work after running Ardour at least once.
+using "catch throw" or "catch catch" can be useful to break at points where exceptions
+are thrown or caught.
 
 They are a number of glib debugging options see
 
diff --git a/tools/windows_packaging/gdb-ardour.bat b/tools/windows_packaging/gdb-ardour.bat
new file mode 100644 (file)
index 0000000..7d290b0
--- /dev/null
@@ -0,0 +1,4 @@
+set HOME=%USERPROFILE%\r
+echo "set home to %HOME%"\r
+\r
+START gdb.exe ardour-3.3.exe\r
diff --git a/tools/windows_packaging/gdb.bat b/tools/windows_packaging/gdb.bat
new file mode 100644 (file)
index 0000000..90f586b
--- /dev/null
@@ -0,0 +1,4 @@
+set HOME=%USERPROFILE%\r
+echo "set home to %HOME%"\r
+\r
+START gdb.exe\r
diff --git a/tools/windows_packaging/gdbinit_home b/tools/windows_packaging/gdbinit_home
new file mode 100644 (file)
index 0000000..910710c
--- /dev/null
@@ -0,0 +1 @@
+set auto-load safe-path /
index 92f55e890669f9eae6aa1ada500c17750a848ce1..dfe586c4570992b7b8d07bd132bb2cb880a17fc4 100755 (executable)
@@ -161,11 +161,12 @@ if test x$DEBUG != x ; then
        echo "Copying any debug files to $PACKAGE_DIR ..."
        cp $MINGW_ROOT/bin/*.debug $PACKAGE_DIR
 
-       echo "Copying gdb to $PACKAGE_DIR ..."
+       echo "Copying gdb and config files to $PACKAGE_DIR ..."
        cp $MINGW_ROOT/bin/gdb.exe $PACKAGE_DIR
-
-       echo "Copying .gdbinit to $PACKAGE_DIR ..."
        cp $TOOLS_DIR/gdbinit $PACKAGE_DIR/.gdbinit
+       cp $TOOLS_DIR/gdbinit_home $PACKAGE_DIR/gdbinit_home
+       cp $TOOLS_DIR/gdb.bat $PACKAGE_DIR/gdb.bat
+       cp $TOOLS_DIR/gdb-ardour.bat $PACKAGE_DIR/gdb-ardour.bat
 
        echo "Copying Gtk demo to $PACKAGE_DIR ..."
        cp $MINGW_ROOT/bin/gtk-demo.exe $PACKAGE_DIR