Visual Studio 2015 更新 1 C++ "The breakpoint failed to bind"

Visual Studio 2015 Update 1 C++ "The breakpoint failed to bind"

我在最新 Visual Studio 中遇到断点问题。即使使用最简单的代码也不绑定:

#include "stdafx.h"


int main()
{
    int ololo = 0;
    return 0;
}

断点设置在行:

int ololo = 0;

我试图通过互联网查看问题出在哪里,但老实说找不到任何符合我的情况的答案,人们的情况通常比这更复杂。

编辑: 新来源:

#include "stdafx.h"
#include <iostream>

volatile int TestGlobal;

void Foo()
{
    TestGlobal = 289173;
    int test = 90823;
}
int main()
{
    Foo();
    int notworking = 0;
    int in = 23;
    std::cin >> in;
    return 0;
}

生成的 ASM:

; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.23506.0 

include listing.inc

INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES

PUBLIC  ?TestGlobal@@3HC                ; TestGlobal
_BSS    SEGMENT
?TestGlobal@@3HC DD 01H DUP (?)             ; TestGlobal
_BSS    ENDS
PUBLIC  ?__empty_global_delete@@YAXPEAX@Z       ; __empty_global_delete
PUBLIC  ?__empty_global_delete@@YAXPEAX_K@Z     ; __empty_global_delete
PUBLIC  ?Foo@@YAXXZ                 ; Foo
PUBLIC  main
EXTRN   __imp_??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAH@Z:PROC
EXTRN   _RTC_CheckStackVars:PROC
EXTRN   _RTC_InitBase:PROC
EXTRN   _RTC_Shutdown:PROC
EXTRN   __imp_?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A:BYTE
;   COMDAT pdata
pdata   SEGMENT
$pdata$?__empty_global_delete@@YAXPEAX@Z DD imagerel $LN3
    DD  imagerel $LN3+50
    DD  imagerel $unwind$?__empty_global_delete@@YAXPEAX@Z
pdata   ENDS
;   COMDAT pdata
pdata   SEGMENT
$pdata$?__empty_global_delete@@YAXPEAX_K@Z DD imagerel $LN3
    DD  imagerel $LN3+55
    DD  imagerel $unwind$?__empty_global_delete@@YAXPEAX_K@Z
pdata   ENDS
;   COMDAT pdata
pdata   SEGMENT
$pdata$?Foo@@YAXXZ DD imagerel $LN3
    DD  imagerel $LN3+55
    DD  imagerel $unwind$?Foo@@YAXXZ
pdata   ENDS
;   COMDAT pdata
pdata   SEGMENT
$pdata$main DD  imagerel $LN3
    DD  imagerel $LN3+98
    DD  imagerel $unwind$main
pdata   ENDS
;   COMDAT rtc$TMZ
rtc$TMZ SEGMENT
_RTC_Shutdown.rtc$TMZ DQ FLAT:_RTC_Shutdown
rtc$TMZ ENDS
;   COMDAT rtc$IMZ
rtc$IMZ SEGMENT
_RTC_InitBase.rtc$IMZ DQ FLAT:_RTC_InitBase
rtc$IMZ ENDS
;   COMDAT xdata
xdata   SEGMENT
$unwind$main DD 025051e01H
    DD  010a230fH
    DD  070030025H
    DD  05002H
xdata   ENDS
;   COMDAT CONST
CONST   SEGMENT
main$rtcName[=15=] DB 069H
    DB  06eH
    DB  00H
    ORG $+13
main$rtcVarDesc DD 044H
    DD  04H
    DQ  FLAT:main$rtcName[=15=]
    ORG $+48
main$rtcFrameData DD 01H
    DD  00H
    DQ  FLAT:main$rtcVarDesc
CONST   ENDS
;   COMDAT xdata
xdata   SEGMENT
$unwind$?Foo@@YAXXZ DD 05051c01H
    DD  010a030dH
    DD  07003001dH
    DD  05002H
xdata   ENDS
;   COMDAT xdata
xdata   SEGMENT
$unwind$?__empty_global_delete@@YAXPEAX_K@Z DD 05052d01H
    DD  01130316H
    DD  0700c0019H
    DD  0500bH
xdata   ENDS
;   COMDAT xdata
xdata   SEGMENT
$unwind$?__empty_global_delete@@YAXPEAX@Z DD 05052801H
    DD  010e0311H
    DD  070070019H
    DD  05006H
xdata   ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File c:\users\lukasz\documents\visual studio 2015\projects\breakpointtest\breakpointtest\breakpointtest.cpp
;   COMDAT main
_TEXT   SEGMENT
notworking$ = 4
in$ = 36
main    PROC                        ; COMDAT

; 15   : {

$LN3:
    push    rbp
    push    rdi
    sub rsp, 296                ; 00000128H
    lea rbp, QWORD PTR [rsp+32]
    mov rdi, rsp
    mov ecx, 74                 ; 0000004aH
    mov eax, -858993460             ; ccccccccH
    rep stosd

; 16   :    Foo();

    call    ?Foo@@YAXXZ             ; Foo

; 17   :    int notworking = 0;

    mov DWORD PTR notworking$[rbp], 0

; 18   :    int in = 23;

    mov DWORD PTR in$[rbp], 23

; 19   :    std::cin >> in;

    lea rdx, QWORD PTR in$[rbp]
    mov rcx, QWORD PTR __imp_?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A
    call    QWORD PTR __imp_??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAH@Z

; 20   :     return 0;

    xor eax, eax

; 21   : }

    mov edi, eax
    lea rcx, QWORD PTR [rbp-32]
    lea rdx, OFFSET FLAT:main$rtcFrameData
    call    _RTC_CheckStackVars
    mov eax, edi
    lea rsp, QWORD PTR [rbp+264]
    pop rdi
    pop rbp
    ret 0
main    ENDP
_TEXT   ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File c:\users\lukasz\documents\visual studio 2015\projects\breakpointtest\breakpointtest\breakpointtest.cpp
;   COMDAT ?Foo@@YAXXZ
_TEXT   SEGMENT
test$ = 4
?Foo@@YAXXZ PROC                    ; Foo, COMDAT

; 10   : {

$LN3:
    push    rbp
    push    rdi
    sub rsp, 232                ; 000000e8H
    mov rbp, rsp
    mov rdi, rsp
    mov ecx, 58                 ; 0000003aH
    mov eax, -858993460             ; ccccccccH
    rep stosd

; 11   :    TestGlobal = 289173;

    mov DWORD PTR ?TestGlobal@@3HC, 289173  ; TestGlobal, 00046995H

; 12   :    int test = 90823;

    mov DWORD PTR test$[rbp], 90823     ; 000162c7H

; 13   : }

    lea rsp, QWORD PTR [rbp+232]
    pop rdi
    pop rbp
    ret 0
?Foo@@YAXXZ ENDP                    ; Foo
_TEXT   ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File c:\users\lukasz\documents\visual studio 2015\projects\breakpointtest\breakpointtest\breakpointtest.cpp
;   COMDAT ?__empty_global_delete@@YAXPEAX_K@Z
_TEXT   SEGMENT
__formal$ = 224
__formal$ = 232
?__empty_global_delete@@YAXPEAX_K@Z PROC        ; __empty_global_delete, COMDAT

$LN3:
    mov QWORD PTR [rsp+16], rdx
    mov QWORD PTR [rsp+8], rcx
    push    rbp
    push    rdi
    sub rsp, 200                ; 000000c8H
    mov rbp, rsp
    mov rdi, rsp
    mov ecx, 50                 ; 00000032H
    mov eax, -858993460             ; ccccccccH
    rep stosd
    mov rcx, QWORD PTR [rsp+232]
    lea rsp, QWORD PTR [rbp+200]
    pop rdi
    pop rbp
    ret 0
?__empty_global_delete@@YAXPEAX_K@Z ENDP        ; __empty_global_delete
_TEXT   ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File c:\users\lukasz\documents\visual studio 2015\projects\breakpointtest\breakpointtest\breakpointtest.cpp
;   COMDAT ?__empty_global_delete@@YAXPEAX@Z
_TEXT   SEGMENT
__formal$ = 224
?__empty_global_delete@@YAXPEAX@Z PROC          ; __empty_global_delete, COMDAT

$LN3:
    mov QWORD PTR [rsp+8], rcx
    push    rbp
    push    rdi
    sub rsp, 200                ; 000000c8H
    mov rbp, rsp
    mov rdi, rsp
    mov ecx, 50                 ; 00000032H
    mov eax, -858993460             ; ccccccccH
    rep stosd
    mov rcx, QWORD PTR [rsp+232]
    lea rsp, QWORD PTR [rbp+200]
    pop rdi
    pop rbp
    ret 0
?__empty_global_delete@@YAXPEAX@Z ENDP          ; __empty_global_delete
_TEXT   ENDS
END

问题出现在最新的 Windows 10 build (14251) 恢复到 11099 后一切又开始工作了。

您可能会发现此问题已通过升级得到解决。

当我在 "Windows 10 Pro Insider Preview" 上遇到同样的问题并且甚至无法调试简单的 "Hello world" 时,通过更新到 OS Build 14257 release 160131 解决了这个问题。