pid_t is int32_t on FreeBSD, not uint64_t. I think it's better committing a small sin her rather than changing it globally.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I'm not sure it's uint64_t anywhere, actually, and I think PseudoTerminal::Fork ought to return a ::pid_t as well. But this change is OK as long as it works - specifically, the if ((pid = terminal.Fork(err_str, err_len)) == -1)
Just for the records, it's uint64_t as defined in lldb_types.h. pid_t is int32_t at least on FreeBSD and Mac OS (didn't check Linux). Also, clang complains about signed vs unsigned comparison:
../tools/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp:973:49: warning: comparison of integers of different signs: 'lldb::pid_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
if ((pid = terminal.Fork(err_str, err_len)) == -1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
so actually this change make the logic correct in case fork() fails and therefore returns -1 to the parent.
all of the lldb:: types are 64 bit because it needs to be able to hold a
pid of any platform (if you are remote debugging for example). You need to
cast to and from ::pid_t inside your host layer
Thank for the clarification Zachary. While at it, are you OK with this patch or you have ohter comments?