[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.3] x86: print relevant (tail) part of filename for warnings and crashes



commit a002c8491b8dcc81633f1f9b0177c2b44593ba89
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Nov 11 16:20:51 2013 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Nov 11 16:20:51 2013 +0100

    x86: print relevant (tail) part of filename for warnings and crashes
    
    In particular when the origin construct is in a header file (and
    hence the file name is an absolute path instead of just the file name
    portion) the information can otherwise become rather useless when the
    build tree isn't sitting relatively close to the file system root.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
    master commit: f72cb6bbc10348f4f7671428e5db509731e9e6a5
    master date: 2013-10-17 11:35:26 +0200
---
 xen/arch/x86/traps.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index adc5009..fec382b 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -953,7 +953,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
 {
     struct bug_frame bug;
     struct bug_frame_str bug_str;
-    const char *p, *filename, *predicate, *eip = (char *)regs->eip;
+    const char *p, *prefix = "", *filename, *predicate, *eip = (char 
*)regs->eip;
     unsigned long fixup;
     int id, lineno;
 
@@ -995,12 +995,19 @@ void do_invalid_op(struct cpu_user_regs *regs)
     }
 
     /* WARN, BUG or ASSERT: decode the filename pointer and line number. */
-    filename = p;
+    fixup = strlen(p);
+    if ( fixup > 50 )
+    {
+        filename = p + fixup - 47;
+        prefix = "...";
+    }
+    else
+        filename = p;
     lineno = bug.id >> 2;
 
     if ( id == BUGFRAME_warn )
     {
-        printk("Xen WARN at %.50s:%d\n", filename, lineno);
+        printk("Xen WARN at %s%s:%d\n", prefix, filename, lineno);
         show_execution_state(regs);
         regs->eip = (unsigned long)eip;
         return;
@@ -1008,10 +1015,10 @@ void do_invalid_op(struct cpu_user_regs *regs)
 
     if ( id == BUGFRAME_bug )
     {
-        printk("Xen BUG at %.50s:%d\n", filename, lineno);
+        printk("Xen BUG at %s%s:%d\n", prefix, filename, lineno);
         DEBUGGER_trap_fatal(TRAP_invalid_op, regs);
         show_execution_state(regs);
-        panic("Xen BUG at %.50s:%d\n", filename, lineno);
+        panic("Xen BUG at %s%s:%d\n", prefix, filename, lineno);
     }
 
     /* ASSERT: decode the predicate string pointer. */
@@ -1025,12 +1032,12 @@ void do_invalid_op(struct cpu_user_regs *regs)
 
     if ( !is_kernel(predicate) )
         predicate = "<unknown>";
-    printk("Assertion '%s' failed at %.50s:%d\n",
-           predicate, filename, lineno);
+    printk("Assertion '%s' failed at %s%s:%d\n",
+           predicate, prefix, filename, lineno);
     DEBUGGER_trap_fatal(TRAP_invalid_op, regs);
     show_execution_state(regs);
-    panic("Assertion '%s' failed at %.50s:%d\n",
-          predicate, filename, lineno);
+    panic("Assertion '%s' failed at %s%s:%d\n",
+          predicate, prefix, filename, lineno);
 
  die:
     if ( (fixup = search_exception_table(regs->eip)) != 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.3

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.