This is an archive of the discontinued LLVM Phabricator instance.

Add NetBSD support in sanitizer_procmaps_freebsd.cc
ClosedPublic

Authored by krytarowski on Jul 18 2017, 5:09 AM.

Details

Summary

This adds NetBSD specific:

  • ReadProcMaps()
  • MemoryMappingLayout::Next()

This code is largely shared with FreeBSD.

Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Jul 18 2017, 5:09 AM
vitalybuka added inline comments.
lib/sanitizer_common/sanitizer_procmaps_netbsd.cc
40 ↗(On Diff #107072)

MemoryMappingLayout::Next interface was changed

vitalybuka added inline comments.Jul 19 2017, 3:01 PM
lib/sanitizer_common/sanitizer_procmaps_netbsd.cc
40 ↗(On Diff #107072)

And entire file looks very similar to sanitizer_procmaps_freebsd.cc

krytarowski added inline comments.Jul 19 2017, 3:20 PM
lib/sanitizer_common/sanitizer_procmaps_netbsd.cc
40 ↗(On Diff #107072)

I'm going to rebase it.

Right, FreeBSD is similar.

fjricci added inline comments.Jul 19 2017, 3:31 PM
lib/sanitizer_common/sanitizer_procmaps_netbsd.cc
40 ↗(On Diff #107072)

If freebsd is sufficiently similar, it's probably worth it to just combine them and #ifdef any small differences (this is frequently done for Linux+Freebsd).

filcab requested changes to this revision.Jul 19 2017, 9:47 PM

This should be merged with the FreeBSD one. The differences are minor and it looks like you can cover all of them with two or three simple conditional operators or ifs.

This revision now requires changes to proceed.Jul 19 2017, 9:47 PM
krytarowski edited edge metadata.
krytarowski retitled this revision from Introduce sanitizer_procmaps_netbsd.cc to Add NetBSD support in sanitizer_procmaps_freebsd.cc.
krytarowski edited the summary of this revision. (Show Details)
fjricci added inline comments.Aug 4 2017, 6:29 AM
lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
36

The sanitizers already have a macro for this, ARRAY_SIZE, I believe

Use ARRAY_SIZE.

krytarowski marked an inline comment as done.Aug 4 2017, 6:36 AM
fjricci accepted this revision.Aug 4 2017, 6:57 AM

Please update the commit message and one style comment, otherwise lgtm.

lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
53

Did you run clang-format on this? Looks like a different format from the original array (but I don't know which is correct myself).

krytarowski marked an inline comment as done.Aug 4 2017, 6:59 AM
krytarowski added inline comments.
lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
53

This format was selected by git-clang-format.

krytarowski marked an inline comment as done.Aug 4 2017, 6:59 AM
fjricci added inline comments.Aug 4 2017, 7:25 AM
lib/sanitizer_common/sanitizer_procmaps_freebsd.cc
53

Awesome

This revision was automatically updated to reflect the committed changes.