- Get Eclipse 3.7.2 CDT - Import existing code as Makefile (a wine component or a standalone - winelib program) - Check "Automate discovery" in project properties/C/C++ Build/Discovery - Create a standart C/C++ Application debug configuration - Set *.exe.so as application - Set winedbg-eclipse as GDB debugger - fix bugs faster!
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType"> <booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/> <listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/> <stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="/media/ARCHLINUXOLD/1/builds/wine/src/wine/winedbg-eclipse"/> <booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/> <stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/> <booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/> <booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/> <listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/> <booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/> <booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/> <intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/> <stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/> <booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/> <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/> <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="regedit.exe.so"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="regedit"/> <booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/> <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="0.1052470212"/> <booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listEntry value="/regedit"/> </listAttribute> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listEntry value="4"/> </listAttribute> <stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList context="reserved-for-future-use"/> "/> </launchConfiguration>
#!/bin/bash # # winedbg-eclipse - winedbg wrapper for Eclipse IDE # # 2012-04-14 first draft #
GDB=gdb SETSID=setsid MKTEMPU="mktemp --tmpdir -u winedbg-eclipse.XXXXXXXXXX" TRACEFILE="$HOME/winedbg-eclipse.log" # debug with installed wine WINECMD=/usr/bin/wine WINEBINARY=/usr/bin/wine # debug with wine sources #export WINEPREFIX=~/.winetest # don't mess up my ~/.wine #WINEBUILDDIR="/media/ARCHLINUXOLD/1/builds/wine/src/wine" #WINECMD="$WINEBUILDDIR/wine" #WINEBINARY="$WINEBUILDDIR/loader/wine" set -e case "$*" in "--version") exec $GDB "$@" ;; "--interpreter mi2 --nx") ;; *) echo unknown arguments: "$@" >&2 exit 1 ;; esac fn_commandfilter() { while read -r s; do printf 'you wrote: %s\n' "$s" >&3 set -- $s case "$1" in *-file-exec-and-symbols) echo "recognized command: -file-exec-and-symbols" >&3 s="$1 $WINEBINARY" printf 'I send: %s\n' "$s" >&3 printf '%s\n' "$s" [ "$2" != "--thread-group" ] || shift 2 file=$2 # need to send 'target remote' immediatly, so breakpoints properly restored fifo=`$MKTEMPU` mkfifo $fifo set -- "$WINECMD" winedbg --gdb --no-start "$file" echo "executing command: $SETSID" "$@" "</dev/null >$fifo &" >&3 # run winedbg protected from C^c $SETSID "$@" </dev/null >$fifo 2>&1 & winedbg_pid=$! echo "waiting 10 seconds for 'target remote'" >&3 { sleep 10 echo "wait timeout. killing winedbg" >&3 kill $winedbg_pid } & killer_pid=$! while read -r s <$fifo ; do printf 'winedbg: %s\n' "$s" >&3 case "$s" in "target "*) #s="$numcmd-target-select ${s/target /}" printf 'I send: %s\n' "$s" >&3 printf '%s\n' "$s" break; ;; esac done kill $killer_pid echo "reading winedbg in background" >&3 while read -r s <$fifo ; do printf 'winedbg: %s\n' "$s" >&3 done & rm $fifo continue ;; *-exec-run) echo "recognized command: -exec-run" >&3 # dummy command because eclipse expects $numcmd^done numcmd=${s/-*/} echo $numcmd^done >&4 continue ;; esac printf 'I send: %s\n' "$s" >&3 printf '%s\n' "$s" done } exec 3>>"$TRACEFILE" # save original stdout for fake GDB replies exec 4>&1 { echo -------------------------------------- echo echo echo } >&3 fifo=`$MKTEMPU` echo "mkfifo $fifo" >&3 mkfifo $fifo fn_commandfilter <&0 >$fifo & commandfilter_pid=$! trap 'kill $commandfilter_pid 2>/dev/null' EXIT trap 'echo INT 1 >&3' INT exec 5<$fifo rm $fifo $GDB "$@" <&5 #| { #trap 'echo INT 3 >&3' INT #while read -r s; do # printf 'GDB replies: %s\n' "$s" >&3 # printf '%s\n' "$s" #done #}