forked from oracle-samples/drgn-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'oracle-samples:main' into main
- Loading branch information
Showing
7 changed files
with
254 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (c) 2023, Oracle and/or its affiliates. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ | ||
""" | ||
Helpers for command line | ||
""" | ||
import argparse | ||
|
||
from drgn import Program | ||
|
||
from drgn_tools.corelens import CorelensModule | ||
|
||
|
||
def get_cmdline(prog: Program) -> str: | ||
""" | ||
Returns the kernel command line | ||
""" | ||
str_cmdline = prog["saved_command_line"] | ||
return str_cmdline.string_().decode("utf-8") | ||
|
||
|
||
def show_cmdline(prog: Program) -> None: | ||
""" | ||
Prints the kernel command line | ||
""" | ||
str_cmdline = get_cmdline(prog) | ||
print(str_cmdline) | ||
|
||
|
||
class CmdLine(CorelensModule): | ||
"""Display the kernel command line""" | ||
|
||
name = "cmdline" | ||
|
||
def run(self, prog: Program, args: argparse.Namespace) -> None: | ||
show_cmdline(prog) |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright (c) 2023, Oracle and/or its affiliates. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ | ||
from drgn_tools import cmdline | ||
|
||
|
||
def test_cmdline(prog): | ||
cmdline.get_cmdline(prog) | ||
cmdline.show_cmdline(prog) |
This file contains 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