diff mbox

[v3,15/23] xsplice: Print build_id in keyhandler.

Message ID 1455300361-13092-16-git-send-email-konrad.wilk@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk Feb. 12, 2016, 6:05 p.m. UTC
As it should be an useful debug mechanism.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/common/xsplice.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Andrew Cooper Feb. 16, 2016, 8:13 p.m. UTC | #1
On 12/02/16 18:05, Konrad Rzeszutek Wilk wrote:
> As it should be an useful debug mechanism.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  xen/common/xsplice.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c
> index 65b1f11..34719fc 100644
> --- a/xen/common/xsplice.c
> +++ b/xen/common/xsplice.c
> @@ -13,6 +13,7 @@
>  #include <xen/smp.h>
>  #include <xen/softirq.h>
>  #include <xen/spinlock.h>
> +#include <xen/version.h>
>  #include <xen/wait.h>
>  #include <xen/xsplice_elf.h>
>  #include <xen/xsplice.h>
> @@ -99,7 +100,22 @@ static const char *state2str(int32_t state)
>  static void xsplice_printall(unsigned char key)
>  {
>      struct payload *data;
> -    unsigned int i;
> +    char *binary_id = NULL;
> +    unsigned int len = 0, i;
> +    int rc;
> +
> +    rc = xen_build_id(&binary_id, &len);
> +    printk("build-id: ");

This line should only be printed if a buildid is included.  Otherwise,
you will repeatedly see -ENODATA if the linker was lacking.

> +    if ( !rc )
> +    {
> +        for ( i = 0; i < len; i++ )
> +        {
> +                   uint8_t c = binary_id[i];
> +                   printk("%02x", c);

Indentation.

Also, the buildid will want printing in the start of day banner.

~Andrew

> +        }
> +           printk("\n");
> +    } else if ( rc < 0 )
> +        printk("rc = %d\n", rc);
>  
>      spin_lock(&payload_lock);
>
diff mbox

Patch

diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c
index 65b1f11..34719fc 100644
--- a/xen/common/xsplice.c
+++ b/xen/common/xsplice.c
@@ -13,6 +13,7 @@ 
 #include <xen/smp.h>
 #include <xen/softirq.h>
 #include <xen/spinlock.h>
+#include <xen/version.h>
 #include <xen/wait.h>
 #include <xen/xsplice_elf.h>
 #include <xen/xsplice.h>
@@ -99,7 +100,22 @@  static const char *state2str(int32_t state)
 static void xsplice_printall(unsigned char key)
 {
     struct payload *data;
-    unsigned int i;
+    char *binary_id = NULL;
+    unsigned int len = 0, i;
+    int rc;
+
+    rc = xen_build_id(&binary_id, &len);
+    printk("build-id: ");
+    if ( !rc )
+    {
+        for ( i = 0; i < len; i++ )
+        {
+                   uint8_t c = binary_id[i];
+                   printk("%02x", c);
+        }
+           printk("\n");
+    } else if ( rc < 0 )
+        printk("rc = %d\n", rc);
 
     spin_lock(&payload_lock);