What is the meaning of: "Search tree file's format version number (0) is not supported"?

Diven Lee picture Diven Lee · Sep 28, 2017 · Viewed 9.3k times · Source

In macOS 10.13 High Sierra on Xcode 9 I get this log message:

2017-09-28 15:19:28.246511+0800 wr[5376:128702] MessageTracer: load_domain_whitelist_search_tree:73: Search tree file's format version number (0) is not supported 2017-09-28 15:19:28.246541+0800 wr[5376:128702] MessageTracer: Falling back to default whitelist

What is the meaning of this message?

Answer

Tora picture Tora · Oct 20, 2017

Those messages come from a function msgtracer_domain_new in /usr/lib/libDiagnosticMessagesClient.dylib.

  1. Run your application on Xcode 9.
  2. Stop it.
  3. In the the Debug navigator, click on NSApplicationMain just above main
  4. Set a breakpoint at the first line pushq %rbp
  5. Run your app again.
  6. When the breakpoint hits, set another breakpoint by typing breakpoint set -n msgtracer_domain_new
  7. Continue program execution.

As the breakpoint hits, look into the assembler code. you will see:

libDiagnosticMessagesClient.dylib`msgtracer_domain_new:
->  0x7fff667c7f08 <+0>:    pushq  %rbp
    0x7fff667c7f09 <+1>:    movq   %rsp, %rbp
    0x7fff667c7f0c <+4>:    pushq  %r15

(omit)

    0x7fff667c7ff1 <+233>:  leaq   0xc1d(%rip), %rdi         ; "/Library/Application Support/CrashReporter/SubmitDiagInfo.domains"
    0x7fff667c7ff8 <+240>:  xorl   %r13d, %r13d
    0x7fff667c7ffb <+243>:  movl   $0x20, %esi
    0x7fff667c8000 <+248>:  xorl   %eax, %eax
    0x7fff667c8002 <+250>:  callq  0x7fff667c8990            ; symbol stub for: open

(omit)

    0x7fff667c801d <+277>:  leaq   0xc33(%rip), %rsi         ; "format_version"
    0x7fff667c8024 <+284>:  movl   $0x4, %ecx
    0x7fff667c8029 <+289>:  xorl   %r8d, %r8d
    0x7fff667c802c <+292>:  xorl   %r9d, %r9d
    0x7fff667c802f <+295>:  movl   %r15d, %edi
    0x7fff667c8032 <+298>:  movq   %r12, %rdx
    0x7fff667c8035 <+301>:  callq  0x7fff667c895a            ; symbol stub for: fgetxattr
    0x7fff667c803a <+306>:  cmpl   %r13d, (%r12)
    0x7fff667c803e <+310>:  jne    0x7fff667c808b            ; <+387>
    0x7fff667c8040 <+312>:  movl   $0x0, (%rsp)
    0x7fff667c8047 <+319>:  leaq   0xc18(%rip), %rcx         ; "MessageTracer: %s:%d: Search tree file's format version number (%u) is not supported"
    0x7fff667c804e <+326>:  leaq   0xb9e(%rip), %r8          ; "load_domain_whitelist_search_tree"

(omit)

    0x7fff667c808f <+391>:  leaq   0xc25(%rip), %rcx         ; "MessageTracer: Falling back to default whitelist"
    0x7fff667c8096 <+398>:  xorl   %edi, %edi
    0x7fff667c8098 <+400>:  xorl   %esi, %esi
    0x7fff667c809a <+402>:  movl   $0x6, %edx
    0x7fff667c809f <+407>:  xorl   %eax, %eax
    0x7fff667c80a1 <+409>:  callq  0x7fff667c8924            ; symbol stub for: asl_log

In my case, MacBook Pro late 2011 running High Sierra 10.13:

$ ls -l@ "/Library/Application Support/CrashReporter/SubmitDiagInfo.domains"
-rw-rw-r--@ 1 root  admin  12988 Sep 21  2014 /Library/Application Support/CrashReporter/SubmitDiagInfo.domains
    com.apple.TextEncoding     15 
    os_version     12 

That file does not have a xattr format_version expected by the function msgtracer_domain_new

Does anyone know how to update it?

Appended:

Tips for looking into the similar phenomenon.

Find a process id of your app.

$ ps -ef | grep your_app_name | grep -v grep
  999 86803 86804   0  1:34AM ??         0:00.97 /Users/xxx/Library/Developer/Xcode/DerivedData/....

Obtain file paths that your app has loaded.

$ vmmap 86803 | perl -ne 'print "$1\n" if m{(/\S*)\Z}' | sort -u > z

Edit the temporary file as needed to remove irreverent file paths.

Find the file which includes the message.

$ cat z | xargs grep -l -b 'Search tree file' 2> /dev/null
/usr/lib/libDiagnosticMessagesClient.dylib

Confirm if the message exists.

$ strings /usr/lib/libDiagnosticMessagesClient.dylib | grep 'Search tree file'
MessageTracer: %s:%d: Search tree file's format version number (%u) is not supported

Produce debugger commands, and then apply them.

$ nm /usr/lib/libDiagnosticMessagesClient.dylib | grep " T " | sort -u | perl -pe 's/.* _/breakpoint set -n /'
breakpoint set -n msgtracer_domain_new
breakpoint set -n msgtracer_domain_free
breakpoint set -n msgtracer_msg_new
breakpoint set -n msgtracer_set
breakpoint set -n msgtracer_msg_free
breakpoint set -n msgtracer_vlog
breakpoint set -n msgtracer_log
breakpoint set -n msgtracer_vlog_with_keys_skip_nulls
breakpoint set -n msgtracer_vlog_with_keys
breakpoint set -n msgtracer_log_with_keys
breakpoint set -n msgtracer_log_with_keys_skip_nulls
breakpoint set -n msgtracer_uuid_create

The way mentioned above is not perfect. It does not take care of white spaces in a file path. As long as it works, it would be fine. I love to use perl to manipulate texts. You will use your favorite ones.