qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Cc: qemu-devel@nongnu.org, Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: [PATCH 6/7] contrib/elf2dmp: Continue even contexts are lacking
Date: Sun, 03 Mar 2024 19:50:40 +0900	[thread overview]
Message-ID: <20240303-elf2dmp-v1-6-bea6649fe3e6@daynix.com> (raw)
In-Reply-To: <20240303-elf2dmp-v1-0-bea6649fe3e6@daynix.com>

Contexts of some CPUs may be lacking or corrupted due to premature boot,
but the output may still contain valuable information of other CPUs and
memory.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 contrib/elf2dmp/main.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
index 432f8629f321..33066310b9fa 100644
--- a/contrib/elf2dmp/main.c
+++ b/contrib/elf2dmp/main.c
@@ -332,7 +332,7 @@ static int fill_header(WinDumpHeader64 *hdr, struct pa_space *ps,
     return 0;
 }
 
-static int fill_context(KDDEBUGGER_DATA64 *kdbg,
+static void fill_context(KDDEBUGGER_DATA64 *kdbg,
         struct va_space *vs, QEMU_Elf *qe)
 {
     int i;
@@ -346,7 +346,7 @@ static int fill_context(KDDEBUGGER_DATA64 *kdbg,
         if (va_space_rw(vs, kdbg->KiProcessorBlock + sizeof(Prcb) * i,
                     &Prcb, sizeof(Prcb), 0)) {
             eprintf("Failed to read CPU #%d PRCB location\n", i);
-            return 1;
+            continue;
         }
 
         if (!Prcb) {
@@ -357,7 +357,7 @@ static int fill_context(KDDEBUGGER_DATA64 *kdbg,
         if (va_space_rw(vs, Prcb + kdbg->OffsetPrcbContext,
                     &Context, sizeof(Context), 0)) {
             eprintf("Failed to read CPU #%d ContextFrame location\n", i);
-            return 1;
+            continue;
         }
 
         printf("Filling context for CPU #%d...\n", i);
@@ -365,11 +365,9 @@ static int fill_context(KDDEBUGGER_DATA64 *kdbg,
 
         if (va_space_rw(vs, Context, &ctx, sizeof(ctx), 1)) {
             eprintf("Failed to fill CPU #%d context\n", i);
-            return 1;
+            continue;
         }
     }
-
-    return 0;
 }
 
 static int pe_get_data_dir_entry(uint64_t base, void *start_addr, int idx,
@@ -624,10 +622,7 @@ int main(int argc, char *argv[])
         goto out_kdbg;
     }
 
-    if (fill_context(kdbg, &vs, &qemu_elf)) {
-        err = 1;
-        goto out_kdbg;
-    }
+    fill_context(kdbg, &vs, &qemu_elf);
 
     if (write_dump(&ps, &header, argv[2])) {
         eprintf("Failed to save dump\n");

-- 
2.44.0



  parent reply	other threads:[~2024-03-03 10:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-03 10:50 [PATCH 0/7] contrib/elf2dmp: Improve robustness Akihiko Odaki
2024-03-03 10:50 ` [PATCH 1/7] contrib/elf2dmp: Always check for PA resolution failure Akihiko Odaki
2024-03-04 17:47   ` Peter Maydell
2024-03-03 10:50 ` [PATCH 2/7] contrib/elf2dmp: Always destroy PA space Akihiko Odaki
2024-03-04 17:47   ` Peter Maydell
2024-03-03 10:50 ` [PATCH 3/7] contrib/elf2dmp: Ensure segment fits in file Akihiko Odaki
2024-03-04 17:52   ` Peter Maydell
2024-03-05  3:53     ` Akihiko Odaki
2024-03-03 10:50 ` [PATCH 4/7] contrib/elf2dmp: Use lduw_le_p() to read PDB Akihiko Odaki
2024-03-04 17:56   ` Peter Maydell
2024-03-03 10:50 ` [PATCH 5/7] contrib/elf2dmp: Use rol64() to decode Akihiko Odaki
2024-03-04 17:59   ` Peter Maydell
2024-03-03 10:50 ` Akihiko Odaki [this message]
2024-03-04 18:02   ` [PATCH 6/7] contrib/elf2dmp: Continue even contexts are lacking Peter Maydell
2024-03-03 10:50 ` [PATCH 7/7] MAINTAINERS: Add Akihiko Odaki as a elf2dmp reviewer Akihiko Odaki
2024-03-04 17:52   ` Peter Maydell
2024-03-04 18:03 ` [PATCH 0/7] contrib/elf2dmp: Improve robustness Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240303-elf2dmp-v1-6-bea6649fe3e6@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=viktor.prutyanov@phystech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).