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

Fix Capstone plugin #110

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Fix Capstone plugin #110

wants to merge 3 commits into from

Conversation

hugsy
Copy link
Owner

@hugsy hugsy commented Apr 23, 2024

Description/Motivation/Screenshots

How Has This Been Tested ?

"Tested" indicates that the PR works and the unit test (i.e. make test) run passes without issue.

  • x86-32
  • x86-64
  • ARM
  • AARCH64
  • MIPS
  • POWERPC
  • SPARC
  • RISC-V

Checklist

  • My code follows the code style of this project.
  • My change includes a change to the documentation, if required.
  • If my change adds new code,
    adequate tests have been added.
  • I have read and agree to the
    CONTRIBUTING document.

@therealdreg therealdreg self-requested a review April 27, 2024 09:25
@therealdreg therealdreg added this to the 2024.05 milestone Apr 27, 2024
Copy link
Sponsor Collaborator

@therealdreg therealdreg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation refers to the alias "cs," but the alias being registered in the code is "cs-dis"

image

https://hugsy.github.io/gef-extras/commands/capstone-disassemble/

image

image

@@ -182,7 +182,7 @@ def do_invoke(self, _: List[str], **kwargs: Any) -> None:
args = kwargs["arguments"]
show_opcodes = args.show_opcodes
length = args.length or gef.config["context.nb_lines_code"]
location = parse_address(args.location)
location = int(gdb.parse_and_eval(args.location).address)
Copy link
Sponsor Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
location = int(gdb.parse_and_eval(args.location).address)
location = parse_address(args.location)

@hugsy int(gdb.parse_and_eval(args.location).address) is not working on my setup (GDB 13.1 Python engine 3.11), with this suggestion cs-dis command works again:

image

image

Copy link
Sponsor Collaborator

@therealdreg therealdreg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value from the configuration file is not taken into account.

So, capstone-disassemble.use-capstone is always False (on every boot)

here my conf file:

[capstone-disassemble]
use-capstone = True
gef➤  gef config capstone-disassemble.use-capstone 
──────────────────────────────────────── GEF configuration setting: capstone-disassemble.use-capstone ────────────────────────────────────────
capstone-disassemble.use-capstone (bool) = False

Description:
	Replace the GDB disassembler in the `context` with Capstone
gef➤  

@hugsy Is it possible that this issue is happening with more plugins?

@hugsy
Copy link
Owner Author

hugsy commented Apr 27, 2024

The value from the configuration file is not taken into account.

So, capstone-disassemble.use-capstone is always False (on every boot)

here my conf file:

[capstone-disassemble]
use-capstone = True
gef➤  gef config capstone-disassemble.use-capstone 
──────────────────────────────────────── GEF configuration setting: capstone-disassemble.use-capstone ────────────────────────────────────────
capstone-disassemble.use-capstone (bool) = False

Description:
	Replace the GDB disassembler in the `context` with Capstone
gef➤  

@hugsy Is it possible that this issue is happening with more plugins?

This is what I explained to you and partially fixed in #1090

image

All gef-extras settings are impacted

@therealdreg
Copy link
Sponsor Collaborator

therealdreg commented Apr 27, 2024

The value from the configuration file is not taken into account.
So, capstone-disassemble.use-capstone is always False (on every boot)
here my conf file:

[capstone-disassemble]
use-capstone = True
gef➤  gef config capstone-disassemble.use-capstone 
──────────────────────────────────────── GEF configuration setting: capstone-disassemble.use-capstone ────────────────────────────────────────
capstone-disassemble.use-capstone (bool) = False

Description:
	Replace the GDB disassembler in the `context` with Capstone
gef➤  

@hugsy Is it possible that this issue is happening with more plugins?

This is what I explained to you and partially fixed in #1090

image

All gef-extras settings are impacted

And what can we do to fix this? I wouldn’t like to release the next version with this issue... And I know you don’t like dirty hacks

@hugsy
Copy link
Owner Author

hugsy commented Apr 27, 2024

And what can we do to fix this?

gef restore

But I think this should not happen with the latest change to gef because now loading gef-extras with on_changed callback should result in a config reloading.

@therealdreg
Copy link
Sponsor Collaborator

And what can we do to fix this?

gef restore

But I think this should not happen with the latest change to gef because now loading gef-extras with on_changed callback should result in a config reloading.

I am using the last version (GEF+EXTRAS) and the problem is still here :\

@gordonmessmer gordonmessmer mentioned this pull request May 6, 2024
12 tasks
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 this pull request may close these issues.

None yet

2 participants