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

invalid settings error when using with gef-extras #823

Closed
4 tasks done
ebubekirtrkr opened this issue Feb 14, 2022 · 2 comments · Fixed by #824
Closed
4 tasks done

invalid settings error when using with gef-extras #823

ebubekirtrkr opened this issue Feb 14, 2022 · 2 comments · Fixed by #824
Labels

Comments

@ebubekirtrkr
Copy link
Contributor

ebubekirtrkr commented Feb 14, 2022

  • Did you use the latest version of GEF from dev branch?
  • Is your bug specific to GEF (not GDB)? - Try to reproduce it running gdb -nx
  • Did you read the documentation first?
  • Did you check issues (including
    the closed ones) - and the PR?

Step 1: Describe your environment

  • GEF version (including the Python library version) run version in GEF.
GEF: rev:6508a99f91bf7cdd2f1ea5af6fb2d4921d42a669 (Git - clean)
SHA256(/home/XXXX/gef/gef.py): 6b115fcaac5ff2748ce785f1be12c0445fbcd64d3fdca2b23ebfb279afdec997
GDB: 9.2
GDB-Python: 3.8

Step 2: Describe your problem

There are bunch of errors after any change in configration when use gef with gef-extras .

GEF for linux ready, type `gef' to start, `gef config' to configure
96 commands loaded for GDB 9.2 using Python engine 3.8
[*] Invalid setting 'gef.use-windbg-prompt': 'gef.use-windbg-prompt'
[*] Invalid setting 'ida-rpyc.host': 'ida-rpyc.host'
[*] Invalid setting 'ida-rpyc.port': 'ida-rpyc.port'
[*] Invalid setting 'ida-rpyc.sync_cursor': 'ida-rpyc.sync_cursor'
[*] Invalid setting 'retdec.path': 'retdec.path'
[*] Invalid setting 'retdec.retdec_path': 'retdec.retdec_path'
[*] Invalid setting 'retdec.theme': 'retdec.theme'
[*] Invalid setting 'rpyc-remote.host': 'rpyc-remote.host'
[*] Invalid setting 'rpyc-remote.port': 'rpyc-remote.port'
[*] Invalid setting 'vereference.max_recursion': 'vereference.max_recursion'
[+] Configuration from '/home/XXXXX/.gef.rc' restored
[+] 34 extra commands added from '/home/XXXXX/.config/gef-extras/scripts'

Steps to reproduce

  1. install gef dev
  2. install gef-extras dev
  3. run gdb
  4. gef save --> this will add settings related to the gef-extras to .gef.rc
  5. exit
  6. run gdb

Traces

opening gef debug won't change output

Thoughts

I think these error occur due to L10255 in GefCommand's setup function. __load_extra_plugins() executed after gdb.execute("gef restore") so there are invalid keys in config at L10615.
When I change order, or commented L10255 out errors doesn't occur again. Changing order not solves issue, it just removes all configuration.

gef/gef.py

Lines 10254 to 10264 in 18c7ba4

# load the saved settings
gdb.execute("gef restore")
# restore the autosave/autoreload breakpoints policy (if any)
self.__reload_auto_breakpoints()
# load plugins from `extra_plugins_dir`
if self.__load_extra_plugins() > 0:
# if here, at least one extra plugin was loaded, so we need to restore
# the settings once more
gdb.execute("gef restore quiet")

gef/gef.py

Lines 10614 to 10618 in 18c7ba4

try:
setting = gef.config.raw_entry(key)
except Exception as e:
warn(f"Invalid setting '{key}': {e}")
continue

@ebubekirtrkr ebubekirtrkr changed the title invalid settings error when using with gef-extras invalid settings error when using with gef-extras Feb 14, 2022
@hugsy
Copy link
Owner

hugsy commented Feb 14, 2022

Great catch: that warn line was meant for debugging during the last code refactoring.
To explain the reason is that at the initial loading of gef those extra plugins don't exist yet (not loaded), hence the warning. We load plugins only after the first initialization part of GEF is complete (no point to be load them if GEF fails to load).

However it was added for debug purposes and it is unecessary now, you can totally remove it (feel free to PR that). That won't prevent your settings to be loaded (even the ones from your plugins in gef-extras).

Thanks for letting us know, I'll keep this ticket open until we remove that line.

@ebubekirtrkr
Copy link
Contributor Author

Thanks for reply, I 've created a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants