Closed ekilmer closed 7 years ago
I also noticed that fclose
has a different method of obtaining fd
:
# Resolve file descriptor
fd_offset = io_file_data_for_arch(self.state.arch)['fd']
fileno = self.state.mem[fd_p + fd_offset:].int.resolved
Yeah, it's using the typed memory access, which it probably should not be. We'll probably want to fix it...
@salls, would you mind taking a look at the diff in this PR? IIRC, you're the one that made this fd lookup code. Looks good to me, but as we probably don't have testcases for this, I just want to make sure :-)
Cool, thanks! @ekilmer, could you make the addition that salls suggested?
I couldn't find any examples using SimTypePointer
, so I copied and pasted @salls suggestion [1], which seems to work. self.argument_types = {0: SimTypePointer(f)}
also worked [2], but self.argument_types = {0: SimtypePointer()}
didn't. Which of the two working implementations is more correct, [1] or [2]? Or does it not matter?
The other simprocedures create an instance of the type for their argument_types
.
Thank you.
It looks like you can do self.ty_ptr(SimTypeTop())
to make a SimTypePointer.
Thanks! This has been merged. Github won't see that it was merged because I squashed a couple commits
This is based off where the
fopen
procedure placesfd
in the struct.I'm not sure what to put for
self.argument_types
since there isn't any indication of whatfopen
uses.