sdb should detect vmlinux version from crash dump#286
Open
PaulZ-98 wants to merge 1 commit intodelphix:masterfrom
Open
sdb should detect vmlinux version from crash dump#286PaulZ-98 wants to merge 1 commit intodelphix:masterfrom
PaulZ-98 wants to merge 1 commit intodelphix:masterfrom
Conversation
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
sdimitro
suggested changes
May 23, 2022
Comment on lines
+198
to
+206
| def is_core(filename: str) -> bool: | ||
| """ | ||
| Parse beginning of the given file to see if it starts with 'KDUMP' | ||
| """ | ||
| match = "KDUMP" | ||
| for s in strings(filename, len(match), 64): | ||
| if s.startswith(match): | ||
| return True | ||
| return False |
Contributor
There was a problem hiding this comment.
This is a bit hacky. How about we use the Python API of https://github.com/ptesarik/libkdumpfile to first check if it is a valid kdump file and then use query its build-id parameter/property to get our matching?
Contributor
Author
There was a problem hiding this comment.
Can you give me some hints on which API calls I could use? I'm not able to find a clean way to do this with libkdumpfile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
= Problem
sdb does not automatically determine the vmlinux file from the crash dump
#41
= Solution
When a crash dump is supplied but the vmlinux file is not supplied on the command line, parse the crash dump to find the OS version, then scan /usr/lib/debug and /root for the vmlinux file matching that version. This follows the solution proposed by @prakashsurya. Other options require changes outside of sdb/drgn.
root@ub-20:~/sdb_detect/sdb# sdb -s /root/objs /root/dump-orig/dump.202102031354
sdb using ['/root/dumps/vmlinux-5.8.0-41-generic'] auto-detected from core file
sdb>
Tested with a core referencing a vmlinux that can be found in /root or /usr/lib/debug, and with one that is not located in /root or /usr/lib/debug. Tested existing method of specifying the actual vmlinux still works.
Closes #41