{"action":"created","comment":{"url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/comments/27266854","id":27266854,"diff_hunk":"@@ -0,0 +1,81 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Diagnostics;\n+using System.IO;\n+using System.Linq;\n+using System.Net;\n+using System.Text;\n+using System.Text.RegularExpressions;\n+using System.Threading.Tasks;\n+\n+namespace principia {\n+namespace stacktrace_decoder {\n+\n+class StackTraceDecoder {\n+\n+  const string kDBH =\n+      @\"\\Program Files (x86)\\Windows Kits\\8.1\\Debuggers\\x86\\dbh.exe\";\n+\n+  private static void Main(string[] args) {\n+    if (args.Length != 2) {\n+      Console.WriteLine(\"Usage: stacktrace_decoder <info_file_uri> <pdb_file>\");\n+      return;\n+    }\n+    string info_file_uri = args[0];\n+    string pdb_file = args[1];\n+    var web_client = new WebClient();\n+    var stream = new StreamReader(web_client.OpenRead(info_file_uri));\n+    var version_regex = new Regex(\n+        @\"^I.*\\] Principia version \" + \n+        @\"([0-9]{10}-[A-Za-z]+)-[0-9]+-g([0-9a-f]{40}) built\");\n+    Match version_match;\n+    do {\n+      version_match = version_regex.Match(stream.ReadLine());\n+    } while (!version_match.Success);\n+    string tag = version_match.Groups[1].ToString();\n+    string commit = version_match.Groups[2].ToString();\n+    var base_address_regex = new Regex(@\"^I.*\\] Base address is ([0-9A-F]+)$\");\n+    string base_address_string =\n+        base_address_regex.Match(stream.ReadLine()).Groups[1].ToString();\n+    Int64 base_address = Convert.ToInt64(base_address_string, 16);\n+    var stack_regex = new Regex(\n+        @\"^\\s+@\\s+[0-9A-F]+\\s+\\(No symbol\\) \\[0x([0-9A-F]+)\\]\");\n+    Match stack_match;\n+    do {\n+      stack_match = stack_regex.Match(stream.ReadLine());\n+    } while (!stack_match.Success);\n+    var file_regex = new Regex(\n+        @\"file\\s+:\\s+.*\\\\principia\\\\([a-z_]+)\\\\([a-z_]+\\.[ch]pp)\");\n+    var line_regex = new Regex(@\"line\\s+:\\s+([0-9]+)\");\n+    for (;\n+         stack_match.Success;\n+         stack_match = stack_regex.Match(stream.ReadLine())) {\n+      Int64 address = Convert.ToInt64(stack_match.Groups[1].ToString(), 16);\n+      string rebased_address =\n+          Convert.ToString(address - base_address + 0x1000000, 16);","path":"stacktrace_decoder/stacktrace_decoder.cs","position":55,"original_position":55,"commit_id":"f5b70f3c25ed4eadcef9e4e2705ea14a17e8b375","original_commit_id":"f5b70f3c25ed4eadcef9e4e2705ea14a17e8b375","user":{"login":"eggrobin","id":2284290,"avatar_url":"https://avatars.githubusercontent.com/u/2284290?v=3","gravatar_id":"","url":"https://api.github.com/users/eggrobin","html_url":"https://github.com/eggrobin","followers_url":"https://api.github.com/users/eggrobin/followers","following_url":"https://api.github.com/users/eggrobin/following{/other_user}","gists_url":"https://api.github.com/users/eggrobin/gists{/gist_id}","starred_url":"https://api.github.com/users/eggrobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggrobin/subscriptions","organizations_url":"https://api.github.com/users/eggrobin/orgs","repos_url":"https://api.github.com/users/eggrobin/repos","events_url":"https://api.github.com/users/eggrobin/events{/privacy}","received_events_url":"https://api.github.com/users/eggrobin/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2015-03-26T23:44:03Z","updated_at":"2015-03-26T23:44:03Z","html_url":"https://github.com/mockingbirdnest/Principia/pull/485#discussion_r27266854","pull_request_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/485","_links":{"self":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/comments/27266854"},"html":{"href":"https://github.com/mockingbirdnest/Principia/pull/485#discussion_r27266854"},"pull_request":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/485"}}},"pull_request":{"url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/485","id":32061670,"html_url":"https://github.com/mockingbirdnest/Principia/pull/485","diff_url":"https://github.com/mockingbirdnest/Principia/pull/485.diff","patch_url":"https://github.com/mockingbirdnest/Principia/pull/485.patch","issue_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues/485","number":485,"state":"open","locked":false,"title":"Stactrace decoder script","user":{"login":"eggrobin","id":2284290,"avatar_url":"https://avatars.githubusercontent.com/u/2284290?v=3","gravatar_id":"","url":"https://api.github.com/users/eggrobin","html_url":"https://github.com/eggrobin","followers_url":"https://api.github.com/users/eggrobin/followers","following_url":"https://api.github.com/users/eggrobin/following{/other_user}","gists_url":"https://api.github.com/users/eggrobin/gists{/gist_id}","starred_url":"https://api.github.com/users/eggrobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggrobin/subscriptions","organizations_url":"https://api.github.com/users/eggrobin/orgs","repos_url":"https://api.github.com/users/eggrobin/repos","events_url":"https://api.github.com/users/eggrobin/events{/privacy}","received_events_url":"https://api.github.com/users/eggrobin/received_events","type":"User","site_admin":false},"body":"Example:\r\n```powershell\r\n.\\stacktrace_decoder\\bin\\Release\\stacktrace_decoder.exe \"https://gist.githubusercontent.com/eggrobin/8958ef1a2b394bd3ab67/raw/65a9703dd86026745bf56c51baaf64467904a226/tetryds%20INFO\" \"..\\..\\KSP_win 0.90.0\\GameData\\Principia\\principia.pdb\"\r\n```\r\nOutput:\r\n```markdown\r\n[`base/map_util.hpp:50`](https://github.com/mockingbirdnest/Principia/blob/3f25c9d7bb1294ca9eda63ed19e6676bba06c34d/base/map_util.hpp#L50)\r\n[`ksp_plugin/plugin.cpp:502`](https://github.com/mockingbirdnest/Principia/blob/3f25c9d7bb1294ca9eda63ed19e6676bba06c34d/ksp_plugin/plugin.cpp#L502)\r\n[`ksp_plugin/plugin.cpp:262`](https://github.com/mockingbirdnest/Principia/blob/3f25c9d7bb1294ca9eda63ed19e6676bba06c34d/ksp_plugin/plugin.cpp#L262)\r\n[`ksp_plugin/interface.cpp:311`](https://github.com/mockingbirdnest/Principia/blob/3f25c9d7bb1294ca9eda63ed19e6676bba06c34d/ksp_plugin/interface.cpp#L311)\r\n```\r\nRendered:\r\n[`base/map_util.hpp:50`](https://github.com/mockingbirdnest/Principia/blob/3f25c9d7bb1294ca9eda63ed19e6676bba06c34d/base/map_util.hpp#L50)\r\n[`ksp_plugin/plugin.cpp:502`](https://github.com/mockingbirdnest/Principia/blob/3f25c9d7bb1294ca9eda63ed19e6676bba06c34d/ksp_plugin/plugin.cpp#L502)\r\n[`ksp_plugin/plugin.cpp:262`](https://github.com/mockingbirdnest/Principia/blob/3f25c9d7bb1294ca9eda63ed19e6676bba06c34d/ksp_plugin/plugin.cpp#L262)\r\n[`ksp_plugin/interface.cpp:311`](https://github.com/mockingbirdnest/Principia/blob/3f25c9d7bb1294ca9eda63ed19e6676bba06c34d/ksp_plugin/interface.cpp#L311)\r\n","created_at":"2015-03-26T21:18:27Z","updated_at":"2015-03-26T23:44:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"698751e7c2dc1fdc00da65dd243664cc8cef9a55","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/485/commits","review_comments_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/485/comments","review_comment_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues/485/comments","statuses_url":"https://api.github.com/repos/mockingbirdnest/Principia/statuses/f5b70f3c25ed4eadcef9e4e2705ea14a17e8b375","head":{"label":"eggrobin:stacktrace-decoder","ref":"stacktrace-decoder","sha":"f5b70f3c25ed4eadcef9e4e2705ea14a17e8b375","user":{"login":"eggrobin","id":2284290,"avatar_url":"https://avatars.githubusercontent.com/u/2284290?v=3","gravatar_id":"","url":"https://api.github.com/users/eggrobin","html_url":"https://github.com/eggrobin","followers_url":"https://api.github.com/users/eggrobin/followers","following_url":"https://api.github.com/users/eggrobin/following{/other_user}","gists_url":"https://api.github.com/users/eggrobin/gists{/gist_id}","starred_url":"https://api.github.com/users/eggrobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggrobin/subscriptions","organizations_url":"https://api.github.com/users/eggrobin/orgs","repos_url":"https://api.github.com/users/eggrobin/repos","events_url":"https://api.github.com/users/eggrobin/events{/privacy}","received_events_url":"https://api.github.com/users/eggrobin/received_events","type":"User","site_admin":false},"repo":{"id":19360849,"name":"Principia","full_name":"eggrobin/Principia","owner":{"login":"eggrobin","id":2284290,"avatar_url":"https://avatars.githubusercontent.com/u/2284290?v=3","gravatar_id":"","url":"https://api.github.com/users/eggrobin","html_url":"https://github.com/eggrobin","followers_url":"https://api.github.com/users/eggrobin/followers","following_url":"https://api.github.com/users/eggrobin/following{/other_user}","gists_url":"https://api.github.com/users/eggrobin/gists{/gist_id}","starred_url":"https://api.github.com/users/eggrobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eggrobin/subscriptions","organizations_url":"https://api.github.com/users/eggrobin/orgs","repos_url":"https://api.github.com/users/eggrobin/repos","events_url":"https://api.github.com/users/eggrobin/events{/privacy}","received_events_url":"https://api.github.com/users/eggrobin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eggrobin/Principia","description":"N-Body Gravitation and Better Integrators for Kerbal Space Program","fork":true,"url":"https://api.github.com/repos/eggrobin/Principia","forks_url":"https://api.github.com/repos/eggrobin/Principia/forks","keys_url":"https://api.github.com/repos/eggrobin/Principia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eggrobin/Principia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eggrobin/Principia/teams","hooks_url":"https://api.github.com/repos/eggrobin/Principia/hooks","issue_events_url":"https://api.github.com/repos/eggrobin/Principia/issues/events{/number}","events_url":"https://api.github.com/repos/eggrobin/Principia/events","assignees_url":"https://api.github.com/repos/eggrobin/Principia/assignees{/user}","branches_url":"https://api.github.com/repos/eggrobin/Principia/branches{/branch}","tags_url":"https://api.github.com/repos/eggrobin/Principia/tags","blobs_url":"https://api.github.com/repos/eggrobin/Principia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eggrobin/Principia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eggrobin/Principia/git/refs{/sha}","trees_url":"https://api.github.com/repos/eggrobin/Principia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eggrobin/Principia/statuses/{sha}","languages_url":"https://api.github.com/repos/eggrobin/Principia/languages","stargazers_url":"https://api.github.com/repos/eggrobin/Principia/stargazers","contributors_url":"https://api.github.com/repos/eggrobin/Principia/contributors","subscribers_url":"https://api.github.com/repos/eggrobin/Principia/subscribers","subscription_url":"https://api.github.com/repos/eggrobin/Principia/subscription","commits_url":"https://api.github.com/repos/eggrobin/Principia/commits{/sha}","git_commits_url":"https://api.github.com/repos/eggrobin/Principia/git/commits{/sha}","comments_url":"https://api.github.com/repos/eggrobin/Principia/comments{/number}","issue_comment_url":"https://api.github.com/repos/eggrobin/Principia/issues/comments{/number}","contents_url":"https://api.github.com/repos/eggrobin/Principia/contents/{+path}","compare_url":"https://api.github.com/repos/eggrobin/Principia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eggrobin/Principia/merges","archive_url":"https://api.github.com/repos/eggrobin/Principia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eggrobin/Principia/downloads","issues_url":"https://api.github.com/repos/eggrobin/Principia/issues{/number}","pulls_url":"https://api.github.com/repos/eggrobin/Principia/pulls{/number}","milestones_url":"https://api.github.com/repos/eggrobin/Principia/milestones{/number}","notifications_url":"https://api.github.com/repos/eggrobin/Principia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eggrobin/Principia/labels{/name}","releases_url":"https://api.github.com/repos/eggrobin/Principia/releases{/id}","created_at":"2014-05-01T23:29:34Z","updated_at":"2015-02-23T19:32:16Z","pushed_at":"2015-03-26T21:10:53Z","git_url":"git://github.com/eggrobin/Principia.git","ssh_url":"git@github.com:eggrobin/Principia.git","clone_url":"https://github.com/eggrobin/Principia.git","svn_url":"https://github.com/eggrobin/Principia","homepage":"http://forum.kerbalspaceprogram.com/threads/68502-WIP-Principia-N-Body-Gravitation-and-Better-Integrators-for-Kerbal-Space-Program","size":19156,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"mockingbirdnest:master","ref":"master","sha":"f74c224d4fa524a39aa04ba634e64730179b137e","user":{"login":"mockingbirdnest","id":7462691,"avatar_url":"https://avatars.githubusercontent.com/u/7462691?v=3","gravatar_id":"","url":"https://api.github.com/users/mockingbirdnest","html_url":"https://github.com/mockingbirdnest","followers_url":"https://api.github.com/users/mockingbirdnest/followers","following_url":"https://api.github.com/users/mockingbirdnest/following{/other_user}","gists_url":"https://api.github.com/users/mockingbirdnest/gists{/gist_id}","starred_url":"https://api.github.com/users/mockingbirdnest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockingbirdnest/subscriptions","organizations_url":"https://api.github.com/users/mockingbirdnest/orgs","repos_url":"https://api.github.com/users/mockingbirdnest/repos","events_url":"https://api.github.com/users/mockingbirdnest/events{/privacy}","received_events_url":"https://api.github.com/users/mockingbirdnest/received_events","type":"Organization","site_admin":false},"repo":{"id":16634370,"name":"Principia","full_name":"mockingbirdnest/Principia","owner":{"login":"mockingbirdnest","id":7462691,"avatar_url":"https://avatars.githubusercontent.com/u/7462691?v=3","gravatar_id":"","url":"https://api.github.com/users/mockingbirdnest","html_url":"https://github.com/mockingbirdnest","followers_url":"https://api.github.com/users/mockingbirdnest/followers","following_url":"https://api.github.com/users/mockingbirdnest/following{/other_user}","gists_url":"https://api.github.com/users/mockingbirdnest/gists{/gist_id}","starred_url":"https://api.github.com/users/mockingbirdnest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockingbirdnest/subscriptions","organizations_url":"https://api.github.com/users/mockingbirdnest/orgs","repos_url":"https://api.github.com/users/mockingbirdnest/repos","events_url":"https://api.github.com/users/mockingbirdnest/events{/privacy}","received_events_url":"https://api.github.com/users/mockingbirdnest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mockingbirdnest/Principia","description":"N-Body Gravitation and Better Integrators for Kerbal Space Program","fork":false,"url":"https://api.github.com/repos/mockingbirdnest/Principia","forks_url":"https://api.github.com/repos/mockingbirdnest/Principia/forks","keys_url":"https://api.github.com/repos/mockingbirdnest/Principia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mockingbirdnest/Principia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mockingbirdnest/Principia/teams","hooks_url":"https://api.github.com/repos/mockingbirdnest/Principia/hooks","issue_events_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues/events{/number}","events_url":"https://api.github.com/repos/mockingbirdnest/Principia/events","assignees_url":"https://api.github.com/repos/mockingbirdnest/Principia/assignees{/user}","branches_url":"https://api.github.com/repos/mockingbirdnest/Principia/branches{/branch}","tags_url":"https://api.github.com/repos/mockingbirdnest/Principia/tags","blobs_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mockingbirdnest/Principia/statuses/{sha}","languages_url":"https://api.github.com/repos/mockingbirdnest/Principia/languages","stargazers_url":"https://api.github.com/repos/mockingbirdnest/Principia/stargazers","contributors_url":"https://api.github.com/repos/mockingbirdnest/Principia/contributors","subscribers_url":"https://api.github.com/repos/mockingbirdnest/Principia/subscribers","subscription_url":"https://api.github.com/repos/mockingbirdnest/Principia/subscription","commits_url":"https://api.github.com/repos/mockingbirdnest/Principia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mockingbirdnest/Principia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mockingbirdnest/Principia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mockingbirdnest/Principia/contents/{+path}","compare_url":"https://api.github.com/repos/mockingbirdnest/Principia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mockingbirdnest/Principia/merges","archive_url":"https://api.github.com/repos/mockingbirdnest/Principia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mockingbirdnest/Principia/downloads","issues_url":"https://api.github.com/repos/mockingbirdnest/Principia/issues{/number}","pulls_url":"https://api.github.com/repos/mockingbirdnest/Principia/pulls{/number}","milestones_url":"https://api.github.com/repos/mockingbirdnest/Principia/milestones{/number}","notifications_url":"https://api.github.com/repos/mockingbirdnest/Principia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mockingbirdnest/Principia/labels{/name}","releases_url":"https://api.github.com/repos/mockingbirdnest/Principia/releases{/id}","created_at":"2014-02-08T02:55:32Z","updated_at":"2015-03-25T11:31:58Z","pushed_at":"2015-03-26T22:06:09Z","git_url":"git://github.com/mockingbirdnest/Principia.git","ssh_url":"git@github.com:mockingbirdnest/Principia.git","clone_url":"https://github.com/mockingbirdnest/Principia.git","svn_url":"https://github.com/mockingbirdnest/Principia","homepage":"http://forum.kerbalspaceprogram.com/threads/68502-WIP-Principia-N-Body-Gravitation-and-Better-Integrators-for-Kerbal-Space-Program","size":19869,"stargazers_count":60,"watchers_count":60,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":26,"forks":5,"open_issues":26,"watchers":60,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/485"},"html":{"href":"https://github.com/mockingbirdnest/Principia/pull/485"},"issue":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/issues/485"},"comments":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/issues/485/comments"},"review_comments":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/485/comments"},"review_comment":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/pulls/485/commits"},"statuses":{"href":"https://api.github.com/repos/mockingbirdnest/Principia/statuses/f5b70f3c25ed4eadcef9e4e2705ea14a17e8b375"}}}}