Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kconfig command #1425

Merged
merged 2 commits into from
Dec 12, 2022
Merged

Add kconfig command #1425

merged 2 commits into from
Dec 12, 2022

Conversation

gsingh93
Copy link
Member

Add a kconfig command to print the current kernel config.

pwndbg> kconfig
CONFIG_GCC_VERSION = 0
CONFIG_CC_IS_CLANG = y
CONFIG_CLANG_VERSION = 140007
pwndbg> kconfig debug_info
CONFIG_DEBUG_INFO = y
pwndbg> kconfig config_debug_info
CONFIG_DEBUG_INFO = y
pwndbg> kconfig CONFIG_DEBUG_INFO
CONFIG_DEBUG_INFO = y
pwndbg> kconfig nonexistent_option
Config CONFIG_NONEXISTENT_OPTION not set
pwndbg> ipi

In [1]: pwndbg.gdblib.kernel.kconfig.debug_info
Out[1]: 'y'

In [2]: pwndbg.gdblib.kernel.kconfig.config_debug_info
Out[2]: 'y'

In [3]: pwndbg.gdblib.kernel.kconfig.nonexistent_option

In [4]: pwndbg.gdblib.kernel.kconfig['nonexistent_option']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In [4], line 1
----> 1 pwndbg.gdblib.kernel.kconfig['nonexistent_option']

File ~/tools/pwndbg/pwndbg/lib/kernel/kconfig.py:51, in Kconfig.__getitem__(self, name)
     48 if key:
     49     return self.data[key]
---> 51 raise KeyError(f"Key {name} not found")

KeyError: 'Key nonexistent_option not found'

@codecov-commenter
Copy link

codecov-commenter commented Dec 11, 2022

Codecov Report

Merging #1425 (307f097) into dev (5e47e34) will decrease coverage by 0.05%.
The diff coverage is 45.45%.

@@            Coverage Diff             @@
##              dev    #1425      +/-   ##
==========================================
- Coverage   58.10%   58.05%   -0.06%     
==========================================
  Files         156      159       +3     
  Lines       19657    19745      +88     
  Branches     1854     1867      +13     
==========================================
+ Hits        11422    11462      +40     
- Misses       7673     7720      +47     
- Partials      562      563       +1     
Impacted Files Coverage Δ
pwndbg/lib/kernel/kconfig.py 34.21% <34.21%> (ø)
pwndbg/commands/kconfig.py 40.90% <40.90%> (ø)
pwndbg/gdblib/kernel/__init__.py 50.00% <50.00%> (ø)
pwndbg/commands/__init__.py 73.15% <75.00%> (+0.05%) ⬆️
pwndbg/gdblib/__init__.py 100.00% <100.00%> (ø)
pwndbg/gdblib/hooks.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@gsingh93 gsingh93 force-pushed the kconfig branch 2 times, most recently from 12dce25 to ee74ea8 Compare December 11, 2022 22:50
@gsingh93 gsingh93 merged commit a575fa7 into pwndbg:dev Dec 12, 2022
@gsingh93 gsingh93 deleted the kconfig branch December 12, 2022 03:02
@gsingh93 gsingh93 added the kernel label Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants