[PATCH] D63828: Add FileWriter to GSYM and encode/decode functions to AddressRange and AddressRanges

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 13:39:39 PDT 2019


clayborg added a comment.

> Let's ask the underlying question: Which of the above use-cases does a GSYM writer need, and why isn't the StringRef case sufficient?

Couldn't tell if I needed to still comment on this, but here goes. The function:

  void FileWriter::writeData(llvm::ArrayRef<uint8_t> Data)

will write exactly the bytes that are in Data. The function:

  void FileWriter::writeNullTerminated(llvm::StringRef Str);

Will write out a the contents of the Str as a NULL terminated C string where the NULL termination doesn't need to be part of the string. Using StringRef for data means we usually have to use static cast:

  writer.writeNullTerminated(StringRef(static_cast<const char *>(...), ...);

So GSYM uses the writeNullTerminated for standard C strings in the string table which include the NULL termination, and uses writeData for raw data when writing out the swapped values.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63828/new/

https://reviews.llvm.org/D63828





More information about the llvm-commits mailing list