diff mbox

[v2,6/6] xen/arm: Remove dependency on __LINE__ for release builds

Message ID 1488995215-7647-7-git-send-email-ross.lagerwall@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ross Lagerwall March 8, 2017, 5:46 p.m. UTC
When using LivePatch, use of __LINE__ can generate spurious changes in
functions due to embedded line numbers.  For release builds with
LivePatch enabled, remove the use of these line numbers and print the
current text address instead.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/arch/arm/traps.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 614501f..059afe7 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -82,14 +82,28 @@  static inline void check_stack_alignment_constraints(void) {
  * Compared with regular BUG_ON it dumps the guest vcpu state instead
  * of Xen's state.
  */
+#if defined(NDEBUG) && defined(CONFIG_LIVEPATCH)
+#define guest_bug_on_failed(p)                          \
+do {                                                    \
+    panic("Guest Bug: %pv: '%s', address %pS\n",        \
+          current, p, current_text_addr());             \
+} while (0)
+#else
 #define guest_bug_on_failed(p)                          \
 do {                                                    \
-    show_execution_state(guest_cpu_user_regs());        \
     panic("Guest Bug: %pv: '%s', line %d, file %s\n",   \
           current, p, __LINE__, __FILE__);              \
 } while (0)
-#define GUEST_BUG_ON(p) \
-    do { if ( unlikely(p) ) guest_bug_on_failed(#p); } while (0)
+#endif
+
+#define GUEST_BUG_ON(p)                                 \
+do {                                                    \
+    if ( unlikely(p) )                                  \
+    {                                                   \
+        show_execution_state(guest_cpu_user_regs());    \
+        guest_bug_on_failed(#p);                        \
+    }                                                   \
+} while (0)
 
 #ifdef CONFIG_ARM_32
 static int debug_stack_lines = 20;