Browse Source

feat: Add support for Portable PDB debug files and .NET symbolication (#39610)

- This will allow `sentry-cli` to upload Portable PDB debug files. The
companion PR is https://github.com/getsentry/sentry-cli/pull/1345.
- It also allows symbolicator to query/download Portable PDB files.
- The PR also adds support for the protocol types specified in [RFC
0013](https://github.com/getsentry/rfcs/pull/13)

Co-authored-by: Arpad Borsos <arpad.borsos@sentry.io>
Sebastian Zivota 2 years ago
parent
commit
dec6ac5265

+ 1 - 0
src/sentry/api/endpoints/chunk.py

@@ -30,6 +30,7 @@ CHUNK_UPLOAD_ACCEPT = (
     "sources",  # Source artifact bundle upload
     "bcsymbolmaps",  # BCSymbolMaps and associated PLists/UuidMaps
     "il2cpp",  # Il2cpp LineMappingJson files
+    "portablepdbs",  # Portable PDB debug file
 )
 
 

+ 1 - 0
src/sentry/constants.py

@@ -292,6 +292,7 @@ KNOWN_DIF_FORMATS: Dict[str, str] = {
     "application/x-bcsymbolmap": "bcsymbolmap",
     "application/x-debugid-map": "uuidmap",
     "application/x-il2cpp-json": "il2cpp",
+    "application/x-portable-pdb": "portablepdb",
 }
 
 NATIVE_UNKNOWN_STRING = "<unknown>"

+ 2 - 0
src/sentry/lang/native/processing.py

@@ -52,6 +52,8 @@ def _merge_frame(new_frame, symbolicated, platform="native"):
             new_frame["function"] = func
     if symbolicated.get("instruction_addr"):
         new_frame["instruction_addr"] = symbolicated["instruction_addr"]
+    if symbolicated.get("function_id"):
+        new_frame["function_id"] = symbolicated["function_id"]
     if symbolicated.get("symbol"):
         new_frame["symbol"] = symbolicated["symbol"]
     if symbolicated.get("abs_path"):

+ 4 - 2
src/sentry/lang/native/utils.py

@@ -12,8 +12,9 @@ logger = logging.getLogger(__name__)
 WINDOWS_PATH_RE = re.compile(r"^([a-z]:\\|\\\\)", re.IGNORECASE)
 
 # Event platforms that could contain native stacktraces
-# il2cpp events have the "csharp" platform, and we do need to run those
-# through symbolicator to correctly symbolicate il2cpp stack frames.
+# "csharp" events are also considered "native" as they are processed by symbolicator.
+# This includes il2cpp events that are symbolicated using native debug files,
+# as well as .NET with Portable PDB files which are handled by symbolicator.
 NATIVE_PLATFORMS = ("cocoa", "native", "csharp")
 
 # Debug image types that can be handled by the symbolicator
@@ -23,6 +24,7 @@ NATIVE_IMAGE_TYPES = (
     "elf",  # Linux
     "macho",  # macOS, iOS
     "pe",  # Windows
+    "pe_dotnet",  # Portable PDB
     "wasm",  # WASM
 )
 

+ 2 - 1
src/sentry/models/debugfile.py

@@ -184,7 +184,7 @@ class ProjectDebugFile(Model):  # type: ignore
             return "" if self.file_type == "exe" else ".debug"
         if self.file_format == "pe":
             return ".exe" if self.file_type == "exe" else ".dll"
-        if self.file_format == "pdb":
+        if self.file_format == "pdb" or self.file_format == "portablepdb":
             return ".pdb"
         if self.file_format == "sourcebundle":
             return ".src.zip"
@@ -275,6 +275,7 @@ def create_dif_from_id(
         "elf",
         "pdb",
         "pe",
+        "portablepdb",
         "wasm",
         "sourcebundle",
         "bcsymbolmap",

+ 1 - 0
static/app/views/settings/projectDebugFiles/index.tsx

@@ -72,6 +72,7 @@ class ProjectDebugSymbols extends AsyncView<Props, State> {
               'bcsymbolmap',
               'uuidmap',
               'il2cpp',
+              'portablepdb',
             ],
           },
         },