Skip to contentSkip to conversation

tools: build debug qemu-xen in debug tools builds

PATCH In review Matthew Daley 4 participants 6 messages Sep 3, 2013 – Sep 9, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: build debug qemu-xen in debug tools builds

When building tools in debug mode (debug=y), pass --enable-debug when configuring qemu-xen to enable some debug support (namely, to prevent symbols from being stripped).

---
 tools/Makefile |    7 +++++++
 1 file changed, 7 insertions(+)
tools/Makefile +7 -0
index 0531f48..066df66 100644
@@ -173,6 +173,12 @@ qemu-xen-dir-force-update:
 		$(GIT) reset --hard $(QEMU_UPSTREAM_REVISION); \
 	fi
 
+ifeq ($(debug),y)
+QEMU_XEN_ENABLE_DEBUG := --enable-debug
+else
+QEMU_XEN_ENABLE_DEBUG :=
+endif
+
 subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	if test -d $(QEMU_UPSTREAM_URL) ; then \
 		source=$(QEMU_UPSTREAM_URL); \
@@ -181,6 +187,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	fi; \
 	cd qemu-xen-dir; \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
+		$(QEMU_XEN_ENABLE_DEBUG) \
 		--prefix=$(PREFIX) \
 		--source-path=$$source \
 		--extra-cflags="-I$(XEN_ROOT)/tools/include \
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 3 lines · Matthew Daley

When building tools in debug mode (debug=y), pass --enable-debug when configuring qemu-xen to enable some debug support (namely, to prevent symbols from being stripped).

This is from the installed binaries I suppose? Is this the only affect or are there others?

I'd like some feedback from the qemu maintainers about whether this is an OK thing to do or not. Stefano/Anthony?

Is it something we could consider doing unconditionally?

Ian.

Quoted 31 lines
---
 tools/Makefile |    7 +++++++
 1 file changed, 7 insertions(+)
tools/Makefile +7 -0
index 0531f48..066df66 100644
@@ -173,6 +173,12 @@ qemu-xen-dir-force-update:
 		$(GIT) reset --hard $(QEMU_UPSTREAM_REVISION); \
 	fi
 
+ifeq ($(debug),y)
+QEMU_XEN_ENABLE_DEBUG := --enable-debug
+else
+QEMU_XEN_ENABLE_DEBUG :=
+endif
+
 subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	if test -d $(QEMU_UPSTREAM_URL) ; then \
 		source=$(QEMU_UPSTREAM_URL); \
@@ -181,6 +187,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	fi; \
 	cd qemu-xen-dir; \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
+		$(QEMU_XEN_ENABLE_DEBUG) \
 		--prefix=$(PREFIX) \
 		--source-path=$$source \
 		--extra-cflags="-I$(XEN_ROOT)/tools/include \
#2 lore raw
Quoted 6 lines · Ian Campbell
Quoted 3 lines · Matthew Daley
Quoted 3 lines

When building tools in debug mode (debug=y), pass --enable-debug when configuring qemu-xen to enable some debug support (namely, to prevent symbols from being stripped).

This is from the installed binaries I suppose? Is this the only affect or are there others?

The other difference is not having -O2 in the CFLAGS for QEMU, I don't think there is anything else (beyond an debug option related to TCG which we don't use).

Quoted 4 lines

I'd like some feedback from the qemu maintainers about whether this is an OK thing to do or not. Stefano/Anthony?

Is it something we could consider doing unconditionally?

I've run several time qemu-xen with --enable-debug without any issue, so I think it's fine to have this.

Signature · 1 line
Anthony PERARD
#3 lore raw
In reply to Ian Campbell
Quoted 6 lines · Ian Campbell
Quoted 3 lines · Matthew Daley

When building tools in debug mode (debug=y), pass --enable-debug when configuring qemu-xen to enable some debug support (namely, to prevent symbols from being stripped).

This is from the installed binaries I suppose?

Right, it stops the symbols from being stripped from the installed binaries. The ones left in the build directory are not stripped regardless.

Quoted 1 line

Is this the only affect or are there others?

The other changes I can see are to set CONFIG_DEBUG_{TCG,MONITOR,EXEC}=y and, as Anthony said, to not add -O2 to CFLAGS (-g is added unconditionally).

AFAIK Xen doesn't use the subsystems where TCG/EXEC are mentioned, and MONITOR just enables some extra error messages in the QEMU monitor code anyway.

Quoted 5 lines

I'd like some feedback from the qemu maintainers about whether this is an OK thing to do or not. Stefano/Anthony?

Is it something we could consider doing unconditionally?

We could perhaps just configure with --disable-strip if we want to do it unconditionally but still have optimization (for debug=n builds). Debugging with -O2 isn't bad, but without symbols it's definitely more annoying.

Looking at the current setup (without --enable-debug, FWIW) on my machine, an unstripped binary is 18MB, while stripped is 4MB.

Quoted 36 lines

Ian.

Quoted 31 lines
---
 tools/Makefile |    7 +++++++
 1 file changed, 7 insertions(+)
tools/Makefile +7 -0
index 0531f48..066df66 100644
@@ -173,6 +173,12 @@ qemu-xen-dir-force-update:
              $(GIT) reset --hard $(QEMU_UPSTREAM_REVISION); \
      fi
 
+ifeq ($(debug),y)
+QEMU_XEN_ENABLE_DEBUG := --enable-debug
+else
+QEMU_XEN_ENABLE_DEBUG :=
+endif
+
 subdir-all-qemu-xen-dir: qemu-xen-dir-find
      if test -d $(QEMU_UPSTREAM_URL) ; then \
              source=$(QEMU_UPSTREAM_URL); \
@@ -181,6 +187,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
      fi; \
      cd qemu-xen-dir; \
      $$source/configure --enable-xen --target-list=i386-softmmu \
+             $(QEMU_XEN_ENABLE_DEBUG) \
              --prefix=$(PREFIX) \
              --source-path=$$source \
              --extra-cflags="-I$(XEN_ROOT)/tools/include \
#4 lore raw
Quoted 14 lines · Matthew Daley
Quoted 6 lines · Ian Campbell
Quoted 3 lines · Matthew Daley

When building tools in debug mode (debug=y), pass --enable-debug when configuring qemu-xen to enable some debug support (namely, to prevent symbols from being stripped).

This is from the installed binaries I suppose?

Right, it stops the symbols from being stripped from the installed binaries. The ones left in the build directory are not stripped regardless.

Quoted 1 line

Is this the only affect or are there others?

Quoted 7 lines

The other changes I can see are to set CONFIG_DEBUG_{TCG,MONITOR,EXEC}=y and, as Anthony said, to not add -O2 to CFLAGS (-g is added unconditionally).

AFAIK Xen doesn't use the subsystems where TCG/EXEC are mentioned, and MONITOR just enables some extra error messages in the QEMU monitor code anyway.

It seems reasonable.

#5 lore raw
In reply to Matthew Daley
Quoted 5 lines · Matthew Daley

When building tools in debug mode (debug=y), pass --enable-debug when configuring qemu-xen to enable some debug support (namely, to prevent symbols from being stripped).

Neither Stefano nor Anthony offered formal acks but they seem happy with so I've applied it.

Quoted 29 lines
---
 tools/Makefile |    7 +++++++
 1 file changed, 7 insertions(+)
tools/Makefile +7 -0
index 0531f48..066df66 100644
@@ -173,6 +173,12 @@ qemu-xen-dir-force-update:
 		$(GIT) reset --hard $(QEMU_UPSTREAM_REVISION); \
 	fi
 
+ifeq ($(debug),y)
+QEMU_XEN_ENABLE_DEBUG := --enable-debug
+else
+QEMU_XEN_ENABLE_DEBUG :=
+endif
+
 subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	if test -d $(QEMU_UPSTREAM_URL) ; then \
 		source=$(QEMU_UPSTREAM_URL); \
@@ -181,6 +187,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	fi; \
 	cd qemu-xen-dir; \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
+		$(QEMU_XEN_ENABLE_DEBUG) \
 		--prefix=$(PREFIX) \
 		--source-path=$$source \
 		--extra-cflags="-I$(XEN_ROOT)/tools/include \