GithubHelp home page GithubHelp logo

Comments (5)

fmagin avatar fmagin commented on May 13, 2024

So, this is implemented in ./Ghidra/Features/Python/data/python-src/ghidradoc.py. Bridging the Helper class will probably not work because it might just end up printing on the wrong side of the bridge.

Given that the information is just loaded from a zipfile (GhidraAPI_javadoc.zip) I see two options:

  • Some way to request the information over the bridge
  • Just getting the path and checking if the file exists on the client side too and using that

To avoid confusion I would suggest adding a bridge specific help function to get the doc for a bridged object that works in a similar way as the builtin. So help(currentProgram) still gives the doc for the BridgedObject class but b.help(currentProgram) returns the doc for the ProgramDB class gathered from the ghidra docs.

This still leaves the issue of controlling the IPython magic for currentProgram?, but the Attribute Errors in the bridge server indicate that a few things are being checked, one of them being getdoc which might be something that can be implemented properly.

from ghidra_bridge.

justfoxing avatar justfoxing commented on May 13, 2024

I've got a pretty smooth implementation that hooks print on the ghidra side to capture the output from the Helper class as a string and return that (much easier than trying to re-implement their code and finding the right file to run it against).

BridgedObjects are meant to be as transparent as possible, so I'm not keen on them having their own help, especially at the cost of being harder to get help for the Ghidra objects that people will actually care about. So, my implementation just straight up replaces help() and punts help for bridged objects across the bridge. Check out feature-ghidra-help for a sneak preview - I still want to come up with some tests before I merge that.

Not sure about the ipython magic, but I'll take a look at those errors.

from ghidra_bridge.

fmagin avatar fmagin commented on May 13, 2024

Nice this does seem like a good start. One thing I am missing is that the output is not paged, which is fairly annoying for long output. The only change necessary would probably be print(help_output) to whatever makes the output paged.

I might be able to look into the IPython ? magic today.

In general I think that the approach of working with the JSON instead of the parsed and pretty printed output could be better though, if we can use it to populate whatever variables the inspect modules checks this could allow for more powerful introspection in IPython e.g. suggestion of (optional) parameters. I will play around with this and see if I can make it work.

Your approach bridging help is entirely sufficient though for the typical use, so I am in favor of merging that and not waiting for all the IPython specific stuff.

from ghidra_bridge.

fmagin avatar fmagin commented on May 13, 2024

For paged output you can use pydoc.pager(help_output)

from ghidra_bridge.

fmagin avatar fmagin commented on May 13, 2024

Fixed by 9c1c7a0

from ghidra_bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.