Fix insertion of breakpoints on Thumb code.

When a program has been built in Thumb mode, global symbols will
have their low bit set.  Ensure that breakpoints are set at the
correct address and using Thumb instructions.

Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
diff --git a/breakpoints.c b/breakpoints.c
index 2b77e02..1ea406a 100644
--- a/breakpoints.c
+++ b/breakpoints.c
@@ -23,6 +23,12 @@
 		  struct library_symbol *libsym) {
 	Breakpoint *sbp;
 
+#ifdef __arm__
+	int thumb_mode = (int)addr & 1;
+	if (thumb_mode)
+		addr = (void *)((int)addr & ~1);
+#endif
+
 	debug(DEBUG_FUNCTION, "insert_breakpoint(pid=%d, addr=%p, symbol=%s)", proc->pid, addr, libsym ? libsym->name : "NULL");
 	debug(1, "symbol=%s, addr=%p", libsym?libsym->name:"(nil)", addr);
 
@@ -43,7 +49,7 @@
 		sbp->libsym = libsym;
 	}
 #ifdef __arm__
-	sbp->thumb_mode = proc->thumb_mode;
+	sbp->thumb_mode = thumb_mode | proc->thumb_mode;
 	proc->thumb_mode = 0;
 #endif
 	sbp->enabled++;