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

[Xen-devel] [PATCH] libelf: improve errors in elf_xen_note_check()



I recently debugged an isolated failure to boot, with no information other
than the logs.

The "Will only load images built for the generic loader or Linux images"
string was missing a newline, leading to the subsequent error being appended
to this line, rather than having its own line with correctly identified
function.

Furthermore, error messages which state "param containing $FOO is not $BAR" is
fairly useless for debugging without identifying which bad $FOO caused the
failure.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Keir Fraser <keir@xxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>

---

I have CC'd both Xen and Tools maintainers as I am not sure who is most
appropriate to review/ack.  Strictly speaking, the code lives in the Xen
subtree, but is arguably more toolstack code than Xen code.
---
 xen/common/libelf/libelf-dominfo.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/libelf/libelf-dominfo.c 
b/xen/common/libelf/libelf-dominfo.c
index 25dd892..6120dd4 100644
--- a/xen/common/libelf/libelf-dominfo.c
+++ b/xen/common/libelf/libelf-dominfo.c
@@ -374,7 +374,9 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary 
*elf,
           strncmp(parms->guest_os, "linux", 5)) )
     {
         elf_err(elf, "%s: ERROR: Will only load images built for the generic "
-                "loader or Linux images", __FUNCTION__);
+                "loader or Linux images (Not '%.*s' and '%.*s')\n",
+                __FUNCTION__, (int)sizeof(parms->loader), parms->loader,
+                (int)sizeof(parms->guest_os), parms->guest_os);
         return -1;
     }
 
@@ -382,7 +384,8 @@ static elf_errorstatus elf_xen_note_check(struct elf_binary 
*elf,
          strncmp(parms->xen_ver, "xen-3.0", 7) )
     {
         elf_err(elf, "%s: ERROR: Xen will only load images built "
-                "for Xen v3.0\n", __FUNCTION__);
+                "for Xen v3.0 (Not '%.*s')\n", __FUNCTION__,
+                (int)sizeof(parms->xen_ver), parms->xen_ver);
         return -1;
     }
     return 0;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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