Closed casept closed 1 year ago
On further testing, it seems like for whatever reason the response is empty when analyzing Windows targets. Changing to draft until I figure it out.
@casept sounds good. If you're unable to figure it out, I'm still willing to merge it, since Linux support is top priority.
@mahaloz I've done some more investigation. It seems like the failure is unrelated to the platform, what matters is the number of structs defined in a program. If I impose a limit on how many structs are sent, it works. My guess is that Apache's XMLRPC library has some annoying size limitation hidden somewhere.
I can't find a setting to tweak this anywhere, so I think the only reasonable solution is to paginate the API. That'd need to be done for the IDA implementation as well though, to remain consistent.
By the way, I'll also need access to unions and type aliases for my use case.
Would you be willing to accept another PR implementing them for Ghidra without also adding support in the other decompilers?
@casept yup that sounds good to me
Also, make this PR ready when you are ready for review.
Still waiting on your OK for the pagination workaround, then it should be ready.
Ah I see. For the pagation workaround it'd be nice if you knew some kind of upperbound of how much can fit in one "page". Just add it to the PR and I'll check it out
It's hard to know for sure, as I don't even know what part of the stack exactly imposes the limit (could be the HTTP server or the actual XMLRPC serializer). In my experiments with a fairly "average" program it seems like about 250 structs is the limit. Therefore, I'd propose a limit of 100 per page.
It's getting late here, so I'll polish and push the code tomorrow.
Fixed.
Turned out that the cause was completely different than suspected - OOAnalyzer sometimes generates classes with fields that have null names, which XMLRPC doesn't support. I mistook this for a size limitation because these structs were returned quite late. Worked around by generating surrogate names for fields in this case.
I also studied the IDA code more closely - seems like it puts all structures into a struct_info
subfield. This behaviour is reflected now.
Should be ready for merge.
LGTM!
Implement the
structs()
endpoint for Ghidra. It should behave the same as for IDA Pro, but I can't test that as I don't have access to it.This is what the output looks like for
/usr/bin/ls
on a Fedora system using Python's xmlrpc library: