Opened 11 years ago

Closed 11 years ago

#4710 closed patch (fixed)

Run mythfrontend and mythbackend through gdb under win32

Reported by: Jeff Black <jmblack256@…> Owned by: Isaac Richards
Priority: trivial Milestone: unknown
Component: contrib Version: head
Severity: low Keywords: win32
Cc: Ticket locked: no

Description

These scripts apply only to Win32 builds and should if included in SVN be copied to the same directory as the binaries mythfrontend.exe and mythbackend.exe. If these prove useful the perl script should be able to, one day, move these around as part of its 'install'

According to http://www.mythtv.org/docs/mythtv-HOWTO-22.html#ss22.2 GDB should be run using a gdbcommands file. This runs mythfrontend or mythbackend under GDB with the recommended options. Hopefully someone finds this useful.

Index: contrib/Win32/debug-mythbackend.cmd
===================================================================
--- contrib/Win32/debug-mythbackend.cmd	(revision 0)
+++ contrib/Win32/debug-mythbackend.cmd	(revision 0)
@@ -0,0 +1,58 @@
+@Echo off
+::
+:: Script to run mythbackend through gdb (easily?)
+:: There is likely a more efficient way of doing this, 
+:: but we have to start somewhere.
+::
+Echo COMMENTS: --------------------------------------
+Echo COMMENTS: This script is used for gathering backtraces using gdb
+Echo COMMENTS: See: http://www.mythtv.org/docs/mythtv-HOWTO-22.html#ss22.2
+Echo COMMENTS: See: http://www.mythtv.org/wiki/index.php/Windows_Port
+Echo COMMENTS: --------------------------------------
+Echo.
+::
+:gdbcommands
+::
+:: Check for and Create if needed the .\gdbcommands.txt 
+::
+:: syntax taken from [ http://www.mythtv.org/docs/mythtv-HOWTO.html#toc22.2 ] 
+::
+if not exist ./gdbcommands.txt (
+	echo handle SIGPIPE nostop noprint > .\gdbcommands.txt
+	echo handle SIG33 nostop noprint >> .\gdbcommands.txt
+	echo set logging on >> .\gdbcommands.txt
+	echo set pagination off >> .\gdbcommands.txt
+	echo set args -l myth.log --noupnp --nosched --nojobqueue --nohousekeeper --noautoexpire -v all >> .\gdbcommands.txt
+	echo run >> .\gdbcommands.txt
+	echo thread apply all bt full >> .\gdbcommands.txt
+	echo set logging off >> .\gdbcommands.txt )
+@Echo off
+
+Echo COMMENTS: --------------------------------------
+Echo COMMENTS: Clearing old gdb.txt before running gdb again.
+Echo COMMENTS: --------------------------------------
+Echo. 
+::
+:: add current data/time to gdb.txt 
+:: will this be a bad idea? who knows? =) 
+::
+date /t > .\gdb.txt
+time /t >> .\gdb.txt
+
+:gdb
+::
+:: gdb should be in the path. 
+::
+Echo COMMENTS: --------------------------------------
+Echo COMMENTS: If you need to add any switches to mythbackend edit gdbcommands.txt
+Echo COMMENTS: see: "mythbackend.exe --help" for options
+Echo COMMENTS: --------------------------------------
+Echo.
+Echo COMMENTS: --------------------------------------
+Echo COMMENTS: Starting: gdb
+Echo COMMENTS: --------------------------------------
+gdb .\mythbackend.exe -x .\gdbcommands.txt
+
+Echo.
+Echo The backtrace can be found in .\gdb.txt
+Echo.
\ No newline at end of file
Index: contrib/Win32/debug-mythfrontend.cmd
===================================================================
--- contrib/Win32/debug-mythfrontend.cmd	(revision 0)
+++ contrib/Win32/debug-mythfrontend.cmd	(revision 0)
@@ -0,0 +1,58 @@
+@Echo off
+::
+:: Script to run mythfrontend through gdb (easily?)
+:: There is likely a more efficient way of doing this, 
+:: but we have to start somewhere.
+::
+Echo COMMENTS: --------------------------------------
+Echo COMMENTS: This script is used for gathering backtraces using gdb
+Echo COMMENTS: See: http://www.mythtv.org/docs/mythtv-HOWTO-22.html#ss22.2
+Echo COMMENTS: See: http://www.mythtv.org/wiki/index.php/Windows_Port
+Echo COMMENTS: --------------------------------------
+Echo.
+::
+:gdbcommands
+::
+:: Check for and Create if needed the .\gdbcommands.txt 
+::
+:: syntax taken from [ http://www.mythtv.org/docs/mythtv-HOWTO.html#toc22.2 ] 
+::
+if not exist ./gdbcommands.txt (
+	echo handle SIGPIPE nostop noprint > .\gdbcommands.txt
+	echo handle SIG33 nostop noprint >> .\gdbcommands.txt
+	echo set logging on >> .\gdbcommands.txt
+	echo set pagination off >> .\gdbcommands.txt
+	echo set args -l myth.log --noupnp --nosched --nojobqueue --nohousekeeper --noautoexpire -v all >> .\gdbcommands.txt
+	echo run >> .\gdbcommands.txt
+	echo thread apply all bt full >> .\gdbcommands.txt
+	echo set logging off >> .\gdbcommands.txt )
+@Echo off
+
+Echo COMMENTS: --------------------------------------
+Echo COMMENTS: Clearing old gdb.txt before running gdb again.
+Echo COMMENTS: --------------------------------------
+Echo. 
+::
+:: add current data/time to gdb.txt 
+:: will this be a bad idea? who knows? =) 
+::
+date /t > .\gdb.txt
+time /t >> .\gdb.txt
+
+:gdb
+::
+:: gdb should be in the path. 
+::
+Echo COMMENTS: --------------------------------------
+Echo COMMENTS: If you need to add any switches to mythfrontend edit gdbcommands.txt
+Echo COMMENTS: see: "mythbackend.exe --help" for options
+Echo COMMENTS: --------------------------------------
+Echo.
+Echo COMMENTS: --------------------------------------
+Echo COMMENTS: Starting: gdb
+Echo COMMENTS: --------------------------------------
+gdb .\mythfrontend.exe -x .\gdbcommands.txt 
+Echo.
+Echo The backtrace can be found in .\gdb.txt
+Echo.
+

Attachments (2)

debug-mythfrontend.cmd_debug-mythbackend.cmd.patch (4.6 KB) - added by Jeff Black <jmblack256@…> 11 years ago.
Win32 scripts to start mythfrontend mythbackend under gdb
gdb_mythfrontend-gdb_mythbackend.patch (5.2 KB) - added by Jeff Black <jmblack256@…> 11 years ago.
patch against win32-packager.pl to add gdb_myth*.bat scripts to run

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by Jeff Black <jmblack256@…>

Win32 scripts to start mythfrontend mythbackend under gdb

comment:1 Changed 11 years ago by David Bussenschutt (aka buzz) <davidbuzz@…>

thanks! I've tried the .frontend script, and apart from gdb NOT being in my default path ( c:\msys\1.0\bin isn't in my default path unless I have the "build" environment running, whereas this is a runtime tool :-) Everything else worked immediately. :-)

comment:2 Changed 11 years ago by Jeff Black <jmblack256@…>

hrm

Without c:\msys\1.0\bin in my path I get:

(in a popup window) mythfrontend.exe - Unable to Locate Component (x) This application has failed to start becuase msys-1.0.dll was not found. Re-installing the application may fix this problem.

Of course adding c:\msys\1.0\bin to the path fixed my runtime issues. Question is, should I add "c:\msys\1.0\bin" to the path in the debug script(local to only the scripts runtime) or should it be added by the mythtv win32 perl script to be 'global'?

comment:3 Changed 11 years ago by David Bussenschutt (aka buzz) <davidbuzz@…>

the win32 "build" script (aka win32-packager.pl) is a build-time script, the .cmd scripts in this patch are for run-time usage, so there is little relation between the two other than that the build-time script could be modified to create the .cmd script/s for run-time use, if desired. For the time being, I'm going to assume that the .cmd files will be accepted into SVN, and we can tweak them from there as-necessary. :-)

Changed 11 years ago by Jeff Black <jmblack256@…>

patch against win32-packager.pl to add gdb_myth*.bat scripts to run

comment:4 Changed 11 years ago by anonymous

Close, but the frontend script invokes it with illegal arguments. Suggest:

echo set args -l myth.log --disable-autodiscovery -v all >> .\gdbcommands.txt

comment:5 Changed 11 years ago by Nigel

(In [16716]) GDB wrapper scripts. See #4710

comment:6 Changed 11 years ago by Nigel

Resolution: fixed
Status: newclosed

(In [16746]) Copy GDB wrapper scripts into bin directory. Closes #4710. Remove un-needed mythverbose.h copy (some plugins built for me)

Note: See TracTickets for help on using tickets.