-
Notifications
You must be signed in to change notification settings - Fork 95
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
Missing features #27
Comments
Something seems to be wonky with |
Another common issue that may be worth considering changing: Because the default integer size is 'int', on 64-bit architectures bare pointer values are truncated to 32-bit values and cause instant segfaults. If we change the default integer size to |
As long as I'm here — it would be nice to have some easy conversions back and forth between bash and C strings. |
Anywhere, here's the little project: https://github.com/cemeyer/httpd.sh There's a start at some C stdlib API wrappers in there that you're welcome to use or adapt in some way for ctypes.sh. |
Nice! Parsing dwarf data is an interesting idea, maybe we could at least make templates for humans to edit....I'll think about it. |
Sure, it's just a sketch of what stdlib-ey stuff might look like. It'd sure be nice to make structs automated, though. It'd also be nice to have a short-cut way of creating a zeroed instance of a struct. Today you must:
|
I've been thinking about making -g the default, if you want something else you can do -h $handle, what do you think? This will break existing scripts, but best to get it out of the way before first release :-) I think it will make things less verbose, which is usually a plus for shell scripts. |
Well, I went ahead and did it. I think it makes things look cleaner. I updated the documentation and sent you a pull request to fix httpd.sh. :-) Do you think we should just get a first release out, or should we finish a basic stdlib first? |
Sounds fine to me. I don't have a preference on ordering release vs stdlib. This'll be fairly Thanks, On Sun, Aug 23, 2015, 15:44 Tavis Ormandy notifications@github.com wrote:
|
I thought about your dwarf idea today. The utility pahole almost does what we want. Here's an example of pahole output:
it can also expand types into primitive types (like long, int, etc) with --expand-types. I think if we import it we can make builtin command
Where |
I'll move this into a separate issue. |
I'm making a simple small project in ctypes.sh and there are a couple missing features I notice that really hurt:
alloca()
or automatic stack memory that we can reference via pointer. (I should clarify — it does not matter at all where the memory lives. Just that the release is automatic on function return.)sizeof()
, both for primitives and structs.Additionally, "structs" in ctypes.sh are more like prototype objects than types. That's ok, just sort of confusing coming from C. I don't know if this could be done better. It seems very desirable to not have to hand-code libc structures. Maybe we could infer it from DWARF debuginfo? This would be a major project. Just something to consider.
Documentation is also kind of sparse. I'm digging into the C sources in order to find usage of
unpack
, for example.The text was updated successfully, but these errors were encountered: