{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/comments/189255006","pull_request_review_id":121401472,"id":189255006,"diff_hunk":"@@ -104,21 +141,84 @@ pub fn unwind_backtrace(frames: &mut [Frame])\n     Ok((i, backtrace_context))\n }\n \n-type SymInitializeFn =\n-    unsafe extern \"system\" fn(c::HANDLE, *mut c_void,\n-                              c::BOOL) -> c::BOOL;\n-type SymCleanupFn =\n-    unsafe extern \"system\" fn(c::HANDLE) -> c::BOOL;\n+fn set_frames_64(\n+    StackWalk64: StackWalk64Fn,\n+    frames: &mut [Frame],\n+    backtrace_context: BacktraceContext,\n+    process: c::HANDLE,\n+) -> io::Result<(usize, BacktraceContext)> {\n+    let thread = unsafe { c::GetCurrentProcess() };\n+    let mut context: c::CONTEXT = unsafe { mem::zeroed() };\n+    unsafe { c::RtlCaptureContext(&mut context) };\n+\n+    let mut frame: c::STACKFRAME64 = unsafe { mem::zeroed() };\n+    let image = init_frame_64(&mut frame, &context);\n \n-type StackWalkExFn =\n-    unsafe extern \"system\" fn(c::DWORD, c::HANDLE, c::HANDLE,\n-                              *mut c::STACKFRAME_EX, *mut c::CONTEXT,\n-                              *mut c_void, *mut c_void,\n-                              *mut c_void, *mut c_void, c::DWORD) -> c::BOOL;\n+    // Start from -1 to avoid printing this stack frame, which will\n+    // always be exactly the same.\n+    let mut i = 0;\n+    unsafe {\n+        while i < frames.len()\n+            && StackWalk64(\n+                image,\n+                process,\n+                thread,\n+                &mut frame,\n+                &mut context,\n+                ptr::null_mut(),\n+                ptr::null_mut(),\n+                ptr::null_mut(),\n+                ptr::null_mut(),\n+            ) == c::TRUE\n+        {\n+            let addr = frame.AddrPC.Offset;\n+            if addr == frame.AddrReturn.Offset || addr == 0 || frame.AddrReturn.Offset == 0","path":"src/libstd/sys/windows/backtrace/mod.rs","position":null,"original_position":151,"commit_id":"de94d13e961d8b9d0ec4bcf5cf64acd2065ba3fb","original_commit_id":"cff693f5d0ec462cae35c5d413c0db2b2d551f2a","user":{"login":"moxian","id":7831163,"avatar_url":"https://avatars2.githubusercontent.com/u/7831163?v=4","gravatar_id":"","url":"https://api.github.com/users/moxian","html_url":"https://github.com/moxian","followers_url":"https://api.github.com/users/moxian/followers","following_url":"https://api.github.com/users/moxian/following{/other_user}","gists_url":"https://api.github.com/users/moxian/gists{/gist_id}","starred_url":"https://api.github.com/users/moxian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moxian/subscriptions","organizations_url":"https://api.github.com/users/moxian/orgs","repos_url":"https://api.github.com/users/moxian/repos","events_url":"https://api.github.com/users/moxian/events{/privacy}","received_events_url":"https://api.github.com/users/moxian/received_events","type":"User","site_admin":false},"body":"Removed the cumbersome logic.","created_at":"2018-05-18T12:39:38Z","updated_at":"2018-05-18T12:39:38Z","html_url":"https://github.com/rust-lang/rust/pull/50526#discussion_r189255006","pull_request_url":"https://api.github.com/repos/rust-lang/rust/pulls/50526","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments/189255006"},"html":{"href":"https://github.com/rust-lang/rust/pull/50526#discussion_r189255006"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/50526"}},"in_reply_to_id":188031069},"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/50526","id":186547854,"html_url":"https://github.com/rust-lang/rust/pull/50526","diff_url":"https://github.com/rust-lang/rust/pull/50526.diff","patch_url":"https://github.com/rust-lang/rust/pull/50526.patch","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/50526","number":50526,"state":"open","locked":false,"title":"Add a fallback for stacktrace printing for older Windows versions.","user":{"login":"moxian","id":7831163,"avatar_url":"https://avatars2.githubusercontent.com/u/7831163?v=4","gravatar_id":"","url":"https://api.github.com/users/moxian","html_url":"https://github.com/moxian","followers_url":"https://api.github.com/users/moxian/followers","following_url":"https://api.github.com/users/moxian/following{/other_user}","gists_url":"https://api.github.com/users/moxian/gists{/gist_id}","starred_url":"https://api.github.com/users/moxian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moxian/subscriptions","organizations_url":"https://api.github.com/users/moxian/orgs","repos_url":"https://api.github.com/users/moxian/repos","events_url":"https://api.github.com/users/moxian/events{/privacy}","received_events_url":"https://api.github.com/users/moxian/received_events","type":"User","site_admin":false},"body":"Some time ago we switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context.\r\nUnfortunately, said new alternatives are not present in older dbghelp.dll versions.\r\nIn particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends.\r\n\r\nTested on my Windows 7 - both msvc and gnu versions produce a readable stacktrace.\r\n\r\nFixes #50138","created_at":"2018-05-08T07:24:38Z","updated_at":"2018-05-18T12:39:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba59b494f71be57935b43bf53e98a3f0c3567782","assignee":{"login":"Kimundi","id":2903206,"avatar_url":"https://avatars2.githubusercontent.com/u/2903206?v=4","gravatar_id":"","url":"https://api.github.com/users/Kimundi","html_url":"https://github.com/Kimundi","followers_url":"https://api.github.com/users/Kimundi/followers","following_url":"https://api.github.com/users/Kimundi/following{/other_user}","gists_url":"https://api.github.com/users/Kimundi/gists{/gist_id}","starred_url":"https://api.github.com/users/Kimundi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kimundi/subscriptions","organizations_url":"https://api.github.com/users/Kimundi/orgs","repos_url":"https://api.github.com/users/Kimundi/repos","events_url":"https://api.github.com/users/Kimundi/events{/privacy}","received_events_url":"https://api.github.com/users/Kimundi/received_events","type":"User","site_admin":false},"assignees":[{"login":"Kimundi","id":2903206,"avatar_url":"https://avatars2.githubusercontent.com/u/2903206?v=4","gravatar_id":"","url":"https://api.github.com/users/Kimundi","html_url":"https://github.com/Kimundi","followers_url":"https://api.github.com/users/Kimundi/followers","following_url":"https://api.github.com/users/Kimundi/following{/other_user}","gists_url":"https://api.github.com/users/Kimundi/gists{/gist_id}","starred_url":"https://api.github.com/users/Kimundi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kimundi/subscriptions","organizations_url":"https://api.github.com/users/Kimundi/orgs","repos_url":"https://api.github.com/users/Kimundi/repos","events_url":"https://api.github.com/users/Kimundi/events{/privacy}","received_events_url":"https://api.github.com/users/Kimundi/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":583426710,"url":"https://api.github.com/repos/rust-lang/rust/labels/S-waiting-on-review","name":"S-waiting-on-review","color":"d3dddd","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/rust/pulls/50526/commits","review_comments_url":"https://api.github.com/repos/rust-lang/rust/pulls/50526/comments","review_comment_url":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/50526/comments","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/de94d13e961d8b9d0ec4bcf5cf64acd2065ba3fb","head":{"label":"moxian:just-fix","ref":"just-fix","sha":"de94d13e961d8b9d0ec4bcf5cf64acd2065ba3fb","user":{"login":"moxian","id":7831163,"avatar_url":"https://avatars2.githubusercontent.com/u/7831163?v=4","gravatar_id":"","url":"https://api.github.com/users/moxian","html_url":"https://github.com/moxian","followers_url":"https://api.github.com/users/moxian/followers","following_url":"https://api.github.com/users/moxian/following{/other_user}","gists_url":"https://api.github.com/users/moxian/gists{/gist_id}","starred_url":"https://api.github.com/users/moxian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moxian/subscriptions","organizations_url":"https://api.github.com/users/moxian/orgs","repos_url":"https://api.github.com/users/moxian/repos","events_url":"https://api.github.com/users/moxian/events{/privacy}","received_events_url":"https://api.github.com/users/moxian/received_events","type":"User","site_admin":false},"repo":{"id":132428971,"name":"rust","full_name":"moxian/rust","owner":{"login":"moxian","id":7831163,"avatar_url":"https://avatars2.githubusercontent.com/u/7831163?v=4","gravatar_id":"","url":"https://api.github.com/users/moxian","html_url":"https://github.com/moxian","followers_url":"https://api.github.com/users/moxian/followers","following_url":"https://api.github.com/users/moxian/following{/other_user}","gists_url":"https://api.github.com/users/moxian/gists{/gist_id}","starred_url":"https://api.github.com/users/moxian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moxian/subscriptions","organizations_url":"https://api.github.com/users/moxian/orgs","repos_url":"https://api.github.com/users/moxian/repos","events_url":"https://api.github.com/users/moxian/events{/privacy}","received_events_url":"https://api.github.com/users/moxian/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/moxian/rust","description":"A safe, concurrent, practical language.","fork":true,"url":"https://api.github.com/repos/moxian/rust","forks_url":"https://api.github.com/repos/moxian/rust/forks","keys_url":"https://api.github.com/repos/moxian/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moxian/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moxian/rust/teams","hooks_url":"https://api.github.com/repos/moxian/rust/hooks","issue_events_url":"https://api.github.com/repos/moxian/rust/issues/events{/number}","events_url":"https://api.github.com/repos/moxian/rust/events","assignees_url":"https://api.github.com/repos/moxian/rust/assignees{/user}","branches_url":"https://api.github.com/repos/moxian/rust/branches{/branch}","tags_url":"https://api.github.com/repos/moxian/rust/tags","blobs_url":"https://api.github.com/repos/moxian/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moxian/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moxian/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/moxian/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moxian/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/moxian/rust/languages","stargazers_url":"https://api.github.com/repos/moxian/rust/stargazers","contributors_url":"https://api.github.com/repos/moxian/rust/contributors","subscribers_url":"https://api.github.com/repos/moxian/rust/subscribers","subscription_url":"https://api.github.com/repos/moxian/rust/subscription","commits_url":"https://api.github.com/repos/moxian/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/moxian/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/moxian/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/moxian/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/moxian/rust/contents/{+path}","compare_url":"https://api.github.com/repos/moxian/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moxian/rust/merges","archive_url":"https://api.github.com/repos/moxian/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moxian/rust/downloads","issues_url":"https://api.github.com/repos/moxian/rust/issues{/number}","pulls_url":"https://api.github.com/repos/moxian/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/moxian/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/moxian/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moxian/rust/labels{/name}","releases_url":"https://api.github.com/repos/moxian/rust/releases{/id}","deployments_url":"https://api.github.com/repos/moxian/rust/deployments","created_at":"2018-05-07T08:15:57Z","updated_at":"2018-05-08T06:39:13Z","pushed_at":"2018-05-18T12:36:46Z","git_url":"git://github.com/moxian/rust.git","ssh_url":"git@github.com:moxian/rust.git","clone_url":"https://github.com/moxian/rust.git","svn_url":"https://github.com/moxian/rust","homepage":"https://www.rust-lang.org","size":372410,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"295d98069f34dce6f7a88422bfa7fbd0a1425aac","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":724712,"name":"rust","full_name":"rust-lang/rust","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars1.githubusercontent.com/u/5430905?v=4","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/rust","description":"A safe, concurrent, practical language.","fork":false,"url":"https://api.github.com/repos/rust-lang/rust","forks_url":"https://api.github.com/repos/rust-lang/rust/forks","keys_url":"https://api.github.com/repos/rust-lang/rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/rust/teams","hooks_url":"https://api.github.com/repos/rust-lang/rust/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/rust/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/rust/events","assignees_url":"https://api.github.com/repos/rust-lang/rust/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/rust/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/rust/tags","blobs_url":"https://api.github.com/repos/rust-lang/rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/rust/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/rust/languages","stargazers_url":"https://api.github.com/repos/rust-lang/rust/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/rust/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/rust/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/rust/subscription","commits_url":"https://api.github.com/repos/rust-lang/rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/rust-lang/rust/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/rust/merges","archive_url":"https://api.github.com/repos/rust-lang/rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/rust/downloads","issues_url":"https://api.github.com/repos/rust-lang/rust/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/rust/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/rust/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/rust/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/rust/releases{/id}","deployments_url":"https://api.github.com/repos/rust-lang/rust/deployments","created_at":"2010-06-16T20:39:03Z","updated_at":"2018-05-18T12:05:13Z","pushed_at":"2018-05-18T12:36:49Z","git_url":"git://github.com/rust-lang/rust.git","ssh_url":"git@github.com:rust-lang/rust.git","clone_url":"https://github.com/rust-lang/rust.git","svn_url":"https://github.com/rust-lang/rust","homepage":"https://www.rust-lang.org","size":370727,"stargazers_count":28309,"watchers_count":28309,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4922,"mirror_url":null,"archived":false,"open_issues_count":3790,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":4922,"open_issues":3790,"watchers":28309,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/50526"},"html":{"href":"https://github.com/rust-lang/rust/pull/50526"},"issue":{"href":"https://api.github.com/repos/rust-lang/rust/issues/50526"},"comments":{"href":"https://api.github.com/repos/rust-lang/rust/issues/50526/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/50526/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/rust/pulls/50526/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/rust/statuses/de94d13e961d8b9d0ec4bcf5cf64acd2065ba3fb"}},"author_association":"NONE"}}
{"actor":{"display_login":"moxian"}}