Skip to contentSkip to conversation

extend qemu-dm.debug to use ddd for device model debugging

PATCH In review Andrew D. Ball 2 participants 2 messages Jan 6, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extend qemu-dm.debug to use ddd for device model debugging

This patch modifies the qemu-dm.debug shell script to call ddd. I have tested it with xm-test against xen-unstable.hg changeset 8497, with no evidence of regression.

Andrew

==================
Andrew D. Ball
[email protected]
'Festina lente'

Add support to the qemu-dm.debug script to launch a ddd window running gdb on the device model for fully virtualized domU's.

tools/examples/xmexample.vmx +9 -0
diff -r 9efe7eb108e1 tools/examples/xmexample.vmx
@@ -100,6 +100,15 @@
 
 # New stuff
 device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
+# Use this instead for device model debugging [launches ddd in a new window 
+# for qemu-dm]
+#
+# To get debugging symbols in qemu-dm, you can copy 
+#   tools/ioemu/target-i386-dm/qemu-dm from a built Xen source tree to
+# /usr/lib/xen/bin/qemu-dm or /usr/lib64/xen/bin/qemu-dm , depending
+# on where your qemu-dm sits
+#device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm.debug'
+
 
 #-----------------------------------------------------------------------------
 # Disk image for 
tools/ioemu/target-i386-dm/qemu-dm.debug +25 -4
diff -r 9efe7eb108e1 tools/ioemu/target-i386-dm/qemu-dm.debug
@@ -1,5 +1,26 @@
-#!/bin/sh
+#!/bin/bash
+# Subject to GPL version 2 license.
+#
+# Chip Blach <[email protected]>
+# Andrew D. Ball <[email protected]>
+ 
+cd ~root # why does ~ mean '/' instead of '/root' here?
 
-echo $* > /tmp/args
-echo $DISPLAY >> /tmp/args
-exec /usr/lib/xen/bin/qemu-dm $*
+if [[ -z "$IOEMU" ]]
+then 
+	# Guess where the device model (qemu-dm) sits, based
+	# on architecture
+	if [[ $(uname -p) == 'x86_64' ]]
+	then
+    		IOEMU=/usr/lib64/xen/bin/qemu-dm
+	else
+    		IOEMU=/usr/lib/xen/bin/qemu-dm
+	fi
+fi
+	
+# set up gdb
+echo "file $IOEMU" > ioemu_debug
+echo "set args $@" >> ioemu_debug
+echo "break main" >> ioemu_debug
+
+nohup ddd --gdb --debugger "gdb -x ioemu_debug" &

Add support to the qemu-dm.debug script to launch a ddd window running gdb on the device model for fully virtualized domU's.

tools/examples/xmexample.vmx +9 -0
diff -r 9efe7eb108e1 tools/examples/xmexample.vmx
@@ -100,6 +100,15 @@
 
 # New stuff
 device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
+# Use this instead for device model debugging [launches ddd in a new window 
+# for qemu-dm]
+#
+# To get debugging symbols in qemu-dm, you can copy 
+#   tools/ioemu/target-i386-dm/qemu-dm from a built Xen source tree to
+# /usr/lib/xen/bin/qemu-dm or /usr/lib64/xen/bin/qemu-dm , depending
+# on where your qemu-dm sits
+#device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm.debug'
+
 
 #-----------------------------------------------------------------------------
 # Disk image for 
tools/ioemu/target-i386-dm/qemu-dm.debug +25 -4
diff -r 9efe7eb108e1 tools/ioemu/target-i386-dm/qemu-dm.debug
@@ -1,5 +1,26 @@
-#!/bin/sh
+#!/bin/bash
+# Subject to GPL version 2 license.
+#
+# Chip Blach <[email protected]>
+# Andrew D. Ball <[email protected]>
+ 
+cd ~root # why does ~ mean '/' instead of '/root' here?
 
-echo $* > /tmp/args
-echo $DISPLAY >> /tmp/args
-exec /usr/lib/xen/bin/qemu-dm $*
+if [[ -z "$IOEMU" ]]
+then 
+	# Guess where the device model (qemu-dm) sits, based
+	# on architecture
+	if [[ $(uname -p) == 'x86_64' ]]
+	then
+    		IOEMU=/usr/lib64/xen/bin/qemu-dm
+	else
+    		IOEMU=/usr/lib/xen/bin/qemu-dm
+	fi
+fi
+	
+# set up gdb
+echo "file $IOEMU" > ioemu_debug
+echo "set args $@" >> ioemu_debug
+echo "break main" >> ioemu_debug
+
+nohup ddd --gdb --debugger "gdb -x ioemu_debug" &

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 39 lines · Andrew D. Ball

This patch modifies the qemu-dm.debug shell script to call ddd. I have tested it with xm-test against xen-unstable.hg changeset 8497, with no evidence of regression.

Andrew

==================
Andrew D. Ball
[email protected]
'Festina lente'

Add support to the qemu-dm.debug script to launch a ddd window running gdb on the device model for fully virtualized domU's.

diff -r 9efe7eb108e1 tools/examples/xmexample.vmx

tools/examples/xmexample.vmx +0 -0
@@ -100,6 +100,15 @@
 
 # New stuff

device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'

tools/examples/xmexample.vmx +9 -0
+# Use this instead for device model debugging [launches ddd in a new window 
+# for qemu-dm]
+#
+# To get debugging symbols in qemu-dm, you can copy 
+#   tools/ioemu/target-i386-dm/qemu-dm from a built Xen source tree to
+# /usr/lib/xen/bin/qemu-dm or /usr/lib64/xen/bin/qemu-dm , depending
+# on where your qemu-dm sits
+#device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm.debug'
+

#-----------------------------------------------------------------------------
# Disk image for diff -r 9efe7eb108e1 tools/ioemu/target-i386-dm/qemu-dm.debug

tools/ioemu/target-i386-dm/qemu-dm.debug line 8

Quoted 9 lines
tools/ioemu/target-i386-dm/qemu-dm.debug +7 -1
@@ -1,5 +1,26 @@
-#!/bin/sh
+#!/bin/bash
+# Subject to GPL version 2 license.
+#
+# Chip Blach <[email protected]>
+# Andrew D. Ball <[email protected]>
+ 
+cd ~root # why does ~ mean '/' instead of '/root' here?
 

~/ expands to the current users home directory.

~word expands to user word's home directory.

You may want to check for ddd and just invoke gdb if ddd is not available.

Regards,

Anthony Liguori

Quoted 95 lines
tools/ioemu/target-i386-dm/qemu-dm.debug +18 -4
-echo $* > /tmp/args
-echo $DISPLAY >> /tmp/args
-exec /usr/lib/xen/bin/qemu-dm $*
+if [[ -z "$IOEMU" ]]
+then 
+	# Guess where the device model (qemu-dm) sits, based
+	# on architecture
+	if [[ $(uname -p) == 'x86_64' ]]
+	then
+    		IOEMU=/usr/lib64/xen/bin/qemu-dm
+	else
+    		IOEMU=/usr/lib/xen/bin/qemu-dm
+	fi
+fi
+	
+# set up gdb
+echo "file $IOEMU" > ioemu_debug
+echo "set args $@" >> ioemu_debug
+echo "break main" >> ioemu_debug
+
+nohup ddd --gdb --debugger "gdb -x ioemu_debug" &
 
 
 
------------------------------------------------------------------------

Add support to the qemu-dm.debug script to launch a ddd window running gdb on the device model for fully virtualized domU's.

diff -r 9efe7eb108e1 tools/examples/xmexample.vmx

tools/examples/xmexample.vmx +0 -0
@@ -100,6 +100,15 @@
 
 # New stuff

device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'

tools/examples/xmexample.vmx +9 -0
+# Use this instead for device model debugging [launches ddd in a new window 
+# for qemu-dm]
+#
+# To get debugging symbols in qemu-dm, you can copy 
+#   tools/ioemu/target-i386-dm/qemu-dm from a built Xen source tree to
+# /usr/lib/xen/bin/qemu-dm or /usr/lib64/xen/bin/qemu-dm , depending
+# on where your qemu-dm sits
+#device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm.debug'
+

#-----------------------------------------------------------------------------
# Disk image for diff -r 9efe7eb108e1 tools/ioemu/target-i386-dm/qemu-dm.debug

tools/ioemu/target-i386-dm/qemu-dm.debug +25 -5
@@ -1,5 +1,26 @@
-#!/bin/sh
+#!/bin/bash
+# Subject to GPL version 2 license.
+#
+# Chip Blach <[email protected]>
+# Andrew D. Ball <[email protected]>
+ 
+cd ~root # why does ~ mean '/' instead of '/root' here?
 
-echo $* > /tmp/args
-echo $DISPLAY >> /tmp/args
-exec /usr/lib/xen/bin/qemu-dm $*
+if [[ -z "$IOEMU" ]]
+then 
+	# Guess where the device model (qemu-dm) sits, based
+	# on architecture
+	if [[ $(uname -p) == 'x86_64' ]]
+	then
+    		IOEMU=/usr/lib64/xen/bin/qemu-dm
+	else
+    		IOEMU=/usr/lib/xen/bin/qemu-dm
+	fi
+fi
+	
+# set up gdb
+echo "file $IOEMU" > ioemu_debug
+echo "set args $@" >> ioemu_debug
+echo "break main" >> ioemu_debug
+
+nohup ddd --gdb --debugger "gdb -x ioemu_debug" &
 
 
------------------------------------------------------------------------

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel