[Lldb-commits] [PATCH] Being converting usage of off_t to other types

Zachary Turner zturner at google.com
Tue Jul 1 11:33:22 PDT 2014


Hi tfiala, majnemer,

off_t is a type which is used for file offsets.  Even more specifically, it is only used by a limited number of C APIs that deal with files.  Any usage of off_t where the variable is not intended to be used with one of these APIs is a bug, by definition.   This patch corrects some easy mis-uses of off_t, generally by converting them to lldb::offset_t, but sometimes by using other types such as size_t, when appropriate.

The use of off_t to represent these offsets has worked fine in practice on linux-y platforms, since we used _FILE_OFFSET_64 to guarantee that off_t was a uint64.  On Windows, however, _FILE_OFFSET_64 is unrecognized, and off_t will always be 32-bit.  So the usage of off_t on Windows actually leads to legitimate bugs.

http://reviews.llvm.org/D4358

Files:
  include/lldb/Core/Module.h
  include/lldb/Core/ValueObject.h
  include/lldb/Core/ValueObjectChild.h
  include/lldb/Expression/ClangExpressionDeclMap.h
  include/lldb/Expression/ClangExpressionVariable.h
  include/lldb/Symbol/DWARFCallFrameInfo.h
  include/lldb/Symbol/ObjectFile.h
  include/lldb/Target/PathMappingList.h
  source/Core/Module.cpp
  source/Expression/ClangExpressionDeclMap.cpp
  source/Expression/IRForTarget.cpp
  source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
  source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
  source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  source/Symbol/ObjectFile.cpp
  source/Target/PathMappingList.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4358.11004.patch
Type: text/x-patch
Size: 16038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140701/ce3b21b6/attachment.bin>


More information about the lldb-commits mailing list