Adding check to bypass decoding pdbs that have no sequence points. (#19815)
commit7490cc0e2b5b88d98587d24820ab5842bed7a535
authorAlex Thibodeau <alexthibodeau@unity3d.com>
Thu, 21 May 2020 18:24:12 +0000 (21 14:24 -0400)
committerGitHub <noreply@github.com>
Thu, 21 May 2020 18:24:12 +0000 (21 14:24 -0400)
tree174e0c1f045aad88eb0e301c810d0116770038e5
parent2f56fc19dcfc3dfbcc031f92240e323e0946b9a7
Adding check to bypass decoding pdbs that have no sequence points. (#19815)

Unity has a pdb with zero sequence points somehow. If a user added a reference to the library and then attempted to set a managed breakpoint mono would hit an assert and crash when it would attempt to decode this pdb.

Call stack would look like:
```
> mono-2.0-boehm.dll!mono_ppdb_get_seq_points(_MonoDebugMethodInfo * minfo, char * * source_file, _GPtrArray * * source_file_list, int * * source_files, MonoSymSeqPoint * * seq_points, int * n_seq_points) Line 508 C
  mono-2.0-boehm.dll!mono_debug_get_seq_points(_MonoDebugMethodInfo * minfo, char * * source_file, _GPtrArray * * source_file_list, int * * source_files, MonoSymSeqPoint * * seq_points, int * n_seq_points) Line 1093 C
  mono-2.0-boehm.dll!get_source_files_for_type(_MonoClass * klass) Line 6920 C
  mono-2.0-boehm.dll!get_types_for_source_file(void * key, void * value, void * user_data) Line 7003 C
  mono-2.0-boehm.dll!monoeg_g_hash_table_foreach(_GHashTable * hash, void(*)(void *, void *, void *) func, void * user_data) Line 364 C
  mono-2.0-boehm.dll!mono_de_foreach_domain(void(*)(void *, void *, void *) func, void * user_data) Line 95 C
  mono-2.0-boehm.dll!vm_commands(int command, int id, unsigned char * p, unsigned char * end, Buffer * buf) Line 7341 C
  mono-2.0-boehm.dll!debugger_thread(void * arg) Line 10323 C
  mono-2.0-boehm.dll!start_wrapper_internal(StartInfo * start_info, unsigned __int64 * stack_ptr) Line 1241 C
  mono-2.0-boehm.dll!start_wrapper(void * data) Line 1315 C
  kernel32.dll!00007ffc12017bd4() Unknown
  ntdll.dll!00007ffc121ece51() Unknown
```

Adding a check to ignore pdbs like this prevents the crash and debugging can continue normally.

Related unity issue: https://issuetracker.unity3d.com/issues/macos-editor-crashes-on-mono-log-write-logfile-when-attaching-a-debugger-and-then-setting-a-breakpoint
mono/metadata/debug-mono-ppdb.c