Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade minidump-stackwalk's frontend and teach it to emit JSON #151

Merged
merged 2 commits into from
May 6, 2021

Conversation

Gankra
Copy link
Collaborator

@Gankra Gankra commented May 4, 2021

A lot of stuff is just stubbed out, but this gets the basic skeleton setup to iterate on. Fixes #150.

@Gankra
Copy link
Collaborator Author

Gankra commented May 4, 2021

Current output for testdata/test.dmp:
{
  "time": "2007-02-14T19:13:55Z",
  "process_create_time": "2007-02-14T19:13:55Z",
  "crash_reason": "Unknown",
  "crash_address": 69,
  "assertion": null,
  "requesting_thread": 0,
  "threads": [
    {
      "frames": [
        {
          "instruction": 4211358,
          "module": {
            "name": "c:\\test_app.exe"
          },
          "function_name": null,
          "function_base": null,
          "source_file_name": null,
          "source_line": null,
          "source_line_base": null,
          "trust": "Context",
          "context": {
            "raw": {
              "X86": {
                "context_flags": 65599,
                "dr0": 0,
                "dr1": 0,
                "dr2": 0,
                "dr3": 0,
                "dr6": 0,
                "dr7": 0,
                "float_save": {
                  "control_word": 4294902399,
                  "status_word": 4294901760,
                  "tag_word": 4294967295,
                  "error_offset": 0,
                  "error_selector": 2228224,
                  "data_offset": 0,
                  "data_selector": 4294901760,
                  "cr0_npx_state": 0
                },
                "gs": 0,
                "fs": 59,
                "es": 35,
                "ds": 35,
                "edi": 2600,
                "esi": 2,
                "ebx": 2088807361,
                "edx": 4373592,
                "ecx": 1244820,
                "eax": 69,
                "ebp": 1244808,
                "eip": 4211358,
                "cs": 27,
                "eflags": 66118,
                "esp": 1244804,
                "ss": 35
              }
            },
            "valid": "All"
          }
        },
        {
          "instruction": 4211199,
          "module": {
            "name": "c:\\test_app.exe"
          },
          "function_name": null,
          "function_base": null,
          "source_file_name": null,
          "source_line": null,
          "source_line_base": null,
          "trust": "FramePointer",
          "context": {
            "raw": {
              "X86": {
                "context_flags": 0,
                "dr0": 0,
                "dr1": 0,
                "dr2": 0,
                "dr3": 0,
                "dr6": 0,
                "dr7": 0,
                "float_save": {
                  "control_word": 0,
                  "status_word": 0,
                  "tag_word": 0,
                  "error_offset": 0,
                  "error_selector": 0,
                  "data_offset": 0,
                  "data_selector": 0,
                  "cr0_npx_state": 0
                },
                "gs": 0,
                "fs": 0,
                "es": 0,
                "ds": 0,
                "edi": 0,
                "esi": 0,
                "ebx": 0,
                "edx": 0,
                "ecx": 0,
                "eax": 0,
                "ebp": 1245040,
                "eip": 4211200,
                "cs": 0,
                "eflags": 0,
                "esp": 1244816,
                "ss": 0
              }
            },
            "valid": {
              "Some": [
                "esp",
                "ebp",
                "eip"
              ]
            }
          }
        },
        {
          "instruction": 4215787,
          "module": {
            "name": "c:\\test_app.exe"
          },
          "function_name": null,
          "function_base": null,
          "source_file_name": null,
          "source_line": null,
          "source_line_base": null,
          "trust": "FramePointer",
          "context": {
            "raw": {
              "X86": {
                "context_flags": 0,
                "dr0": 0,
                "dr1": 0,
                "dr2": 0,
                "dr3": 0,
                "dr6": 0,
                "dr7": 0,
                "float_save": {
                  "control_word": 0,
                  "status_word": 0,
                  "tag_word": 0,
                  "error_offset": 0,
                  "error_selector": 0,
                  "data_offset": 0,
                  "data_selector": 0,
                  "cr0_npx_state": 0
                },
                "gs": 0,
                "fs": 0,
                "es": 0,
                "ds": 0,
                "edi": 0,
                "esi": 0,
                "ebx": 0,
                "edx": 0,
                "ecx": 0,
                "eax": 0,
                "ebp": 1245120,
                "eip": 4215788,
                "cs": 0,
                "eflags": 0,
                "esp": 1245048,
                "ss": 0
              }
            },
            "valid": {
              "Some": [
                "eip",
                "ebp",
                "esp"
              ]
            }
          }
        },
        {
          "instruction": 2088857558,
          "module": {
            "name": "C:\\WINDOWS\\system32\\kernel32.dll"
          },
          "function_name": null,
          "function_base": null,
          "source_file_name": null,
          "source_line": null,
          "source_line_base": null,
          "trust": "FramePointer",
          "context": {
            "raw": {
              "X86": {
                "context_flags": 0,
                "dr0": 0,
                "dr1": 0,
                "dr2": 0,
                "dr3": 0,
                "dr6": 0,
                "dr7": 0,
                "float_save": {
                  "control_word": 0,
                  "status_word": 0,
                  "tag_word": 0,
                  "error_offset": 0,
                  "error_selector": 0,
                  "data_offset": 0,
                  "data_selector": 0,
                  "cr0_npx_state": 0
                },
                "gs": 0,
                "fs": 0,
                "es": 0,
                "ds": 0,
                "edi": 0,
                "esi": 0,
                "ebx": 0,
                "edx": 0,
                "ecx": 0,
                "eax": 0,
                "ebp": 1245168,
                "eip": 2088857559,
                "cs": 0,
                "eflags": 0,
                "esp": 1245128,
                "ss": 0
              }
            },
            "valid": {
              "Some": [
                "eip",
                "esp",
                "ebp"
              ]
            }
          }
        }
      ],
      "info": "Ok"
    },
    {
      "frames": [],
      "info": "DumpThreadSkipped"
    }
  ],
  "system_info": {
    "os": "Windows",
    "os_version": null,
    "cpu": "X86",
    "cpu_info": null,
    "cpu_count": 1
  },
  "modules": {
    "modules": [
      {
        "name": "c:\\test_app.exe"
      },
      {
        "name": "C:\\WINDOWS\\system32\\ntdll.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\kernel32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\ole32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\advapi32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\rpcrt4.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\gdi32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\user32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\msvcrt.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\imm32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\dbghelp.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\version.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\psapi.dll"
      }
    ]
  }
}

@Gankra Gankra force-pushed the json branch 2 times, most recently from a669410 to 1837f92 Compare May 4, 2021 01:43
@Gankra
Copy link
Collaborator Author

Gankra commented May 4, 2021

Oh here's a run with symbols
{
  "time": "2007-02-14T19:13:55Z",
  "process_create_time": "2007-02-14T19:13:55Z",
  "crash_reason": "Unknown",
  "crash_address": 69,
  "assertion": null,
  "requesting_thread": 0,
  "threads": [
    {
      "frames": [
        {
          "instruction": 4211358,
          "module": {
            "name": "c:\\test_app.exe"
          },
          "function_name": "`anonymous namespace'::CrashFunction",
          "function_base": 4211344,
          "source_file_name": "c:\\test_app.cc",
          "source_line": 58,
          "source_line_base": 4211355,
          "trust": "Context",
          "context": {
            "raw": {
              "X86": {
                "context_flags": 65599,
                "dr0": 0,
                "dr1": 0,
                "dr2": 0,
                "dr3": 0,
                "dr6": 0,
                "dr7": 0,
                "float_save": {
                  "control_word": 4294902399,
                  "status_word": 4294901760,
                  "tag_word": 4294967295,
                  "error_offset": 0,
                  "error_selector": 2228224,
                  "data_offset": 0,
                  "data_selector": 4294901760,
                  "cr0_npx_state": 0
                },
                "gs": 0,
                "fs": 59,
                "es": 35,
                "ds": 35,
                "edi": 2600,
                "esi": 2,
                "ebx": 2088807361,
                "edx": 4373592,
                "ecx": 1244820,
                "eax": 69,
                "ebp": 1244808,
                "eip": 4211358,
                "cs": 27,
                "eflags": 66118,
                "esp": 1244804,
                "ss": 35
              }
            },
            "valid": "All"
          }
        },
        {
          "instruction": 4211199,
          "module": {
            "name": "c:\\test_app.exe"
          },
          "function_name": "main",
          "function_base": 4211120,
          "source_file_name": "c:\\test_app.cc",
          "source_line": 65,
          "source_line_base": 4211195,
          "trust": "FramePointer",
          "context": {
            "raw": {
              "X86": {
                "context_flags": 0,
                "dr0": 0,
                "dr1": 0,
                "dr2": 0,
                "dr3": 0,
                "dr6": 0,
                "dr7": 0,
                "float_save": {
                  "control_word": 0,
                  "status_word": 0,
                  "tag_word": 0,
                  "error_offset": 0,
                  "error_selector": 0,
                  "data_offset": 0,
                  "data_selector": 0,
                  "cr0_npx_state": 0
                },
                "gs": 0,
                "fs": 0,
                "es": 0,
                "ds": 0,
                "edi": 0,
                "esi": 0,
                "ebx": 0,
                "edx": 0,
                "ecx": 0,
                "eax": 0,
                "ebp": 1245040,
                "eip": 4211200,
                "cs": 0,
                "eflags": 0,
                "esp": 1244816,
                "ss": 0
              }
            },
            "valid": {
              "Some": [
                "esp",
                "ebp",
                "eip"
              ]
            }
          }
        },
        {
          "instruction": 4215787,
          "module": {
            "name": "c:\\test_app.exe"
          },
          "function_name": "__tmainCRTStartup",
          "function_base": 4215437,
          "source_file_name": "f:\\sp\\vctools\\crt_bld\\self_x86\\crt\\src\\crt0.c",
          "source_line": 327,
          "source_line_base": 4215770,
          "trust": "FramePointer",
          "context": {
            "raw": {
              "X86": {
                "context_flags": 0,
                "dr0": 0,
                "dr1": 0,
                "dr2": 0,
                "dr3": 0,
                "dr6": 0,
                "dr7": 0,
                "float_save": {
                  "control_word": 0,
                  "status_word": 0,
                  "tag_word": 0,
                  "error_offset": 0,
                  "error_selector": 0,
                  "data_offset": 0,
                  "data_selector": 0,
                  "cr0_npx_state": 0
                },
                "gs": 0,
                "fs": 0,
                "es": 0,
                "ds": 0,
                "edi": 0,
                "esi": 0,
                "ebx": 0,
                "edx": 0,
                "ecx": 0,
                "eax": 0,
                "ebp": 1245120,
                "eip": 4215788,
                "cs": 0,
                "eflags": 0,
                "esp": 1245048,
                "ss": 0
              }
            },
            "valid": {
              "Some": [
                "esp",
                "ebp",
                "eip"
              ]
            }
          }
        },
        {
          "instruction": 2088857558,
          "module": {
            "name": "C:\\WINDOWS\\system32\\kernel32.dll"
          },
          "function_name": null,
          "function_base": null,
          "source_file_name": null,
          "source_line": null,
          "source_line_base": null,
          "trust": "FramePointer",
          "context": {
            "raw": {
              "X86": {
                "context_flags": 0,
                "dr0": 0,
                "dr1": 0,
                "dr2": 0,
                "dr3": 0,
                "dr6": 0,
                "dr7": 0,
                "float_save": {
                  "control_word": 0,
                  "status_word": 0,
                  "tag_word": 0,
                  "error_offset": 0,
                  "error_selector": 0,
                  "data_offset": 0,
                  "data_selector": 0,
                  "cr0_npx_state": 0
                },
                "gs": 0,
                "fs": 0,
                "es": 0,
                "ds": 0,
                "edi": 0,
                "esi": 0,
                "ebx": 0,
                "edx": 0,
                "ecx": 0,
                "eax": 0,
                "ebp": 1245168,
                "eip": 2088857559,
                "cs": 0,
                "eflags": 0,
                "esp": 1245128,
                "ss": 0
              }
            },
            "valid": {
              "Some": [
                "esp",
                "eip",
                "ebp"
              ]
            }
          }
        }
      ],
      "info": "Ok"
    },
    {
      "frames": [],
      "info": "DumpThreadSkipped"
    }
  ],
  "system_info": {
    "os": "Windows",
    "os_version": null,
    "cpu": "X86",
    "cpu_info": null,
    "cpu_count": 1
  },
  "modules": {
    "modules": [
      {
        "name": "c:\\test_app.exe"
      },
      {
        "name": "C:\\WINDOWS\\system32\\ntdll.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\kernel32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\ole32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\advapi32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\rpcrt4.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\gdi32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\user32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\msvcrt.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\imm32.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\dbghelp.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\version.dll"
      },
      {
        "name": "C:\\WINDOWS\\system32\\psapi.dll"
      }
    ]
  }
}

Gankra added 2 commits May 6, 2021 13:54
A lot of stuff is just stubbed out, but this gets the basic skeleton setup to iterate on. Fixes #150.
@Gankra Gankra merged commit 357e064 into rust-minidump:master May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Teach minidump-processor to emit JSON
1 participant