[PATCH] [compiler-rt] atos symbolizer for OS X

Kuba Brecka kuba.brecka at gmail.com
Wed Dec 17 12:55:26 PST 2014


================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_mac.cc:31
@@ +30,3 @@
+  // Use forkpty to disable buffering in the new terminal.
+  int pid = forkpty(&fd, 0, 0, 0);
+  if (pid == -1) {
----------------
glider wrote:
> This blew my mind out ;)
> I'm curious whether using the same fd to write commands to the symbolizer and read the output actually works.
> Is it in any sense better than having ye olde pipes or a socketpair like in StartSymbolizerSubprocess() in sanitizer_symbolizer_posix_libcdep.cc?
> 
> Anyway, I think we need to use the same code to spawn the subprocesses for both the addr2line and atos symbolizers. Not sure which version is better.
The reason to use forkpty is because `atos` doesn't flush its output fd after it gives a response. So using regular pipes doesn't work here, because the response gets buffered within the C library. To disable this, we make a new pseudo-terminal which makes all output from atos unbuffered. This is not a problem for llvm-symbolizer, because it does a outs().flush() after each response.

http://reviews.llvm.org/D6588

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list