diff options
author | Petr Mladek <pmladek@suse.cz> | 2011-06-22 14:48:26 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2011-06-22 14:48:26 +0200 |
commit | cfe0ccb95d6f513ade07b9c54ba2a1b10a9f794a (patch) | |
tree | dfd2ddaf5a956179c377eae5edbc8d6ce4a7543c /desktop | |
parent | 073dd4c78a396bb41802083fe389ac1085cf270b (diff) |
add --backtrace, --strace, and --valgring option to soffice wrapper
the change is only for Linux; it will help users to provide the needed debug
info; thanks Kendy for the idea
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/prj/d.lst | 1 | ||||
-rw-r--r-- | desktop/scripts/gdbtrace | 12 | ||||
-rwxr-xr-x | desktop/scripts/makefile.mk | 3 | ||||
-rwxr-xr-x | desktop/scripts/soffice.sh | 62 |
4 files changed, 76 insertions, 2 deletions
diff --git a/desktop/prj/d.lst b/desktop/prj/d.lst index 9fa248f290f1..047b46d3346d 100644 --- a/desktop/prj/d.lst +++ b/desktop/prj/d.lst @@ -110,6 +110,7 @@ mkdir: %_DEST%\bin\odf4ms ..\%__SRC%\misc\swriter.sh %_DEST%\bin\swriter ..\%__SRC%\misc\nswrapper.sh %_DEST%\bin\nswrapper ..\%__SRC%\misc\mozwrapper.sh %_DEST%\bin\mozwrapper +..\%__SRC%\misc\gdbtrace %_DEST%\bin\gdbtrace mkdir: %COMMON_DEST%\pck\brand mkdir: %COMMON_DEST%\pck\brand_dev diff --git a/desktop/scripts/gdbtrace b/desktop/scripts/gdbtrace new file mode 100644 index 000000000000..548ffe6512e9 --- /dev/null +++ b/desktop/scripts/gdbtrace @@ -0,0 +1,12 @@ +set pagination off +echo log will be saved as gdbtrace.log, this will take some time, patience...\n +set logging redirect on +set logging file gdbtrace.log +set logging on +set logging overwrite on +run +bt +thread apply all bt +quit +set logging off +echo log is saved as gdbtrace.log\n diff --git a/desktop/scripts/makefile.mk b/desktop/scripts/makefile.mk index 5c412f818702..ce0c9b8ed292 100755 --- a/desktop/scripts/makefile.mk +++ b/desktop/scripts/makefile.mk @@ -47,7 +47,8 @@ UNIXTEXT= \ $(MISC)$/swriter.sh \ $(MISC)$/mozwrapper.sh \ $(MISC)$/unoinfo.sh \ - $(MISC)$/unopkg.sh + $(MISC)$/unopkg.sh \ + $(MISC)$/gdbtrace .IF "$(OS)" != "MACOSX" diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh index d7578de5fd68..2610d321e2ba 100755 --- a/desktop/scripts/soffice.sh +++ b/desktop/scripts/soffice.sh @@ -72,6 +72,61 @@ if [ -e $sd_prog/ooenv ] ; then . $sd_prog/ooenv fi +# try to get some debug output? +GDBTRACECHECK= +STRACECHECK= +VALGRINDCHECK= + +# count number of selected checks; only one is allowed +checks= +# force the --valgrind option if the VALGRIND variable is set +test -n "$VALGRIND" && VALGRINDOPT="--vagrind" || VALGRINDOPT= + +for arg in $@ $VALGRINDOPT ; do + case "$arg" in + --backtrace) + if which gdb >/dev/null 2>&1 ; then + GDBTRACECHECK="gdb -nx --command=$sd_prog/gdbtrace --args" + checks="c$checks" + else + echo "Error: Can't find the tool \"gdb\", --backtrace option will be ignored." + exit 1 + fi + ;; + --strace) + if which strace >/dev/null 2>&1 ; then + STRACECHECK="strace -o strace.log -f -tt -s 256" + checks="c$checks" + else + echo "Error: Can't find the tool \"strace\", --strace option will be ignored." + exit 1; + fi + ;; + --valgrind) + test -n "$VALGRINDCHECK" && continue; + if which valgrind >/dev/null 2>&1 ; then + # another valgrind tool might be forced via the environment variable + test -z "$VALGRIND" && VALGRIND="memcheck" + VALGRINDCHECK="valgrind --tool=$VALGRIND --log-file=valgrind.log --trace-children=yes --num-callers=50 --error-exitcode=101" + checks="c$checks" + if [ "$VALGRIND" = "memcheck" ] ; then + export G_SLICE=always-malloc + export GLIBCXX_FORCE_NEW=1 + fi + else + echo "Error: Can't find the tool \"valgrind\", --valgrind option will be ignored" + exit 1 + fi + ;; + esac +done + +if echo "$checks" | grep -q "cc" ; then + echo "Error: The debug options --backtrace, --strace, and --valgrind cannot be used together." + echo " Please, use them one by one." + exit 1; +fi + if [ "$VALGRIND" != "" ]; then VALGRINDCHECK="valgrind --tool=$VALGRIND --trace-children=yes --trace-children-skip=*/java --error-exitcode=101" export VALGRINDCHECK @@ -101,5 +156,10 @@ AIX) ;; esac +# run soffice.bin directly when you want to get the backtrace +if [ -n "$GDBTRACECHECK" ] ; then + exec $GDBTRACECHECK "$sd_prog/soffice.bin" "$@" +fi + # oosplash does the rest: forcing pages in, javaldx etc. are -exec $VALGRINDCHECK "$sd_prog/oosplash.bin" "$@" +exec $VALGRINDCHECK $STRACECHECK "$sd_prog/oosplash.bin" "$@" |