aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-10-17 11:35:26 +0200
committerJan Beulich <jbeulich@suse.com>2013-10-17 11:35:26 +0200
commitf72cb6bbc10348f4f7671428e5db509731e9e6a5 (patch)
tree5d14389112b4fdab59b71ac07ab7261b494196d9
parenta65299c87b057dff6bc4c8490e15827a854d9d28 (diff)
downloadxen-f72cb6bbc10348f4f7671428e5db509731e9e6a5.tar.gz
xen-f72cb6bbc10348f4f7671428e5db509731e9e6a5.tar.bz2
xen-f72cb6bbc10348f4f7671428e5db509731e9e6a5.zip
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@suse.com> Acked-by: Keir Fraser <keir@xen.org>
-rw-r--r--xen/arch/x86/traps.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 8dcb70a98f..77c200b86c 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -945,7 +945,7 @@ void do_invalid_op(struct cpu_user_regs *regs)
{
const struct bug_frame *bug;
u8 bug_insn[2];
- const char *filename, *predicate, *eip = (char *)regs->eip;
+ const char *prefix = "", *filename, *predicate, *eip = (char *)regs->eip;
unsigned long fixup;
int id, lineno;
static const struct bug_frame *const stop_frames[] = {
@@ -996,21 +996,27 @@ void do_invalid_op(struct cpu_user_regs *regs)
filename = bug_ptr(bug);
if ( !is_kernel(filename) )
goto die;
+ fixup = strlen(filename);
+ if ( fixup > 50 )
+ {
+ filename += fixup - 47;
+ prefix = "...";
+ }
lineno = bug_line(bug);
switch ( id )
{
case 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;
case 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);
case BUGFRAME_assert:
/* ASSERT: decode the predicate string pointer. */
@@ -1018,12 +1024,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: