Debuggen: Funktionen bei "step into" ignorieren



  • Kann man Visual Studio irgendwie dazu bringen bestimmte Funktionen bei "Step Into" per Default zu ignorieren?
    Bei bestimmten Funktionen wie vector::operator [] oder shared_ptr::operator -> nervt es einfach nur, wenn er reinsteppt.



  • kann man soweit ich weiss nicht, du muss eben aus der funktion raus steppen, oder over steppen. hab kein problem damit



  • Ja klar kann man raussteppen.
    Aber sag mir mal wie ich über sowas drübersteppen soll

    mySharedPtr->MyFunction();
    

    wenn ich in MyFunction reinsteppen will?

    Also mich nervt das schon irgendwo.



  • Bingo!

    How to Not Step Into Functions using the Visual C++ Debugger

    Hab's noch nicht ausprobiert, aber sieht nach genau dem aus was ich suche.
    Mal sehen ob ich die shared_ptr etc. damit in den Griff bekomme.



  • * Update *

    Ich hatte heute etwas Zeit mich damit zu beschäftigen, und die Sache funktioniert (nach einigen Anlaufschwierigkeiten) ganz gut.

    Ich hab' erstmal folgende Einträge gemacht (.reg File Format, der Registry-Pfad ist für Visual Studio 2005):

    Windows Registry Editor Version 5.00
    
    ; Remove the whole key to delete all old values
    [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NativeDE\StepOver]
    
    ; Re-create the key
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NativeDE\StepOver]
    
    ; Default stuff, should probably be left alone
    
    "Security check function"="__security_check_cookie"
    "Rpcrt4.dll functions that hinder RPC StepInto"="_ObjectStublessClient.*"
    "Rpcrt4.dll function that hinders RPC StepOut"="_Invoke@12"
    "Run time check function"="_RTC_CheckEsp"
    
    ; CRT
    
    "_Global operator new"="operator new"
    "_Global operator delete"="operator delete"
    
    ; SCL
    
    "_std vector ctors"    ="std\\:\\:vector{\\<.*\\>}\\:\\:vector\\1"
    "_std vector operators"="std\\:\\:vector{\\<.*\\>}\\:\\:operator\\oper:"
    "_std vector functions"="std\\:\\:vector{\\<.*\\>}\\:\\:((begin)|(end)|(size)|(empty)|(at))"
    
    "_std string ctors"    ="std\\:\\:basic_string{\\<.*\\>}\\:\\:basic_string\\1"
    "_std string operators"="std\\:\\:basic_string{\\<.*\\>}\\:\\:operator\\oper:"
    "_std string functions"="std\\:\\:basic_string{\\<.*\\>}\\:\\:((begin)|(end)|(size)|(empty)|(at))"
    
    "_std map ctors"    ="std\\:\\:map{\\<.*\\>}\\:\\:map\\1"
    "_std map operators"="std\\:\\:map{\\<.*\\>}\\:\\:operator\\oper:"
    "_std map functions"="std\\:\\:map{\\<.*\\>}\\:\\:((begin)|(end)|(size)|(empty))"
    
    "_std set operators"="std\\:\\:set{\\<.*\\>}\\:\\:set\\1"
    "_std set operators"="std\\:\\:set{\\<.*\\>}\\:\\:operator\\oper:"
    "_std set functions"="std\\:\\:set{\\<.*\\>}\\:\\:((begin)|(end)|(size)|(empty))"
    
    ; boost
    
    	; smart pointers
    
    "_boost shared_ptr ctors"    ="boost\\:\\:shared_ptr{\\<.*\\>}\\:\\:shared_ptr\\1"
    "_boost shared_ptr operators"="boost\\:\\:shared_ptr{\\<.*\\>}\\:\\:operator\\oper:"
    
    "_boost weak_ptr ctors"    ="boost\\:\\:weak_ptr{\\<.*\\>}\\:\\:weak_ptr\\1"
    "_boost weak_ptr operators"="boost\\:\\:weak_ptr{\\<.*\\>}\\:\\:operator\\oper:"
    
    "_boost intrusive_ptr ctors"    ="boost\\:\\:intrusive_ptr{\\<.*\\>}\\:\\:intrusive_ptr\\1"
    "_boost intrusive_ptr operators"="boost\\:\\:intrusive_ptr{\\<.*\\>}\\:\\:operator\\oper:"
    
    "_boost scoped_ptr ctors"    ="boost\\:\\:scoped_ptr{\\<.*\\>}\\:\\:scoped_ptr\\1"
    "_boost scoped_ptr operators"="boost\\:\\:scoped_ptr{\\<.*\\>}\\:\\:operator\\oper:"
    
    "_boost shared_array ctors"    ="boost\\:\\:shared_array{\\<.*\\>}\\:\\:shared_array\\1"
    "_boost shared_array operators"="boost\\:\\:shared_array{\\<.*\\>}\\:\\:operator\\oper:"
    
    "_boost scoped_array ctors"    ="boost\\:\\:scoped_array{\\<.*\\>}\\:\\:scoped_array\\1"
    "_boost scoped_array operators"="boost\\:\\:scoped_array{\\<.*\\>}\\:\\:operator\\oper:"
    
    "_boost enable_shared_from_this ctors"    ="boost\\:\\:enable_shared_from_this{\\<.*\\>}\\:\\:enable_shared_from_this\\1"
    "_boost enable_shared_from_this operators"="boost\\:\\:enable_shared_from_this{\\<.*\\>}\\:\\:operator\\oper:"
    
    	; other stuff
    
    "_boost noncopyable *"="boost\\:\\:noncopyable_\\:\\:.*"
    
    "_boost static_pointer_cast" ="boost\\:\\:static_pointer_cast\\<.*"
    "_boost const_pointer_cast"  ="boost\\:\\:const_pointer_cast\\<.*"
    "_boost dynamic_pointer_cast"="boost\\:\\:dynamic_pointer_cast\\<.*"
    

    Ein paar Dinge die mir dabei aufgefallen sind:

    • < und > muss man bei MSVC Regexen escapen -> \< \>
    • Back-references kann man bei MSVC nur auf sog. "tagged expressions" setzen, die mit mit {} statt () erzeugt werden müssen (die Referenz selbst geht wie üblich mit \1...\9)
    • Die MSVC-Erweiterungen (wie z.B. "\oper:") sind doch ganz praktisch
    • Die Namen von Operatoren haben kein (!) Leerzeichen nach dem Keyword "operator"
    • Die "=StepInto" und "=NoStepInto" Syntax braucht man nicht (Default ist "=NoStepInto"), und ab Visual Studio 2010 geht sie auch nimmer. Also gar nicht erst anfangen mit Prioritäten und "schmalbandigen" StepInto gefolgt von "breitbandigen" NoStepInto Einträgen zu arbeiten.
    • Man kann hübsche Strings statt dummen Zahlen als Value-Namen verwenden


  • Hey, man. Thanks a lot for this. It's really useful and you've saved me an hour or two on making this list myself. 🙂

    P.S. Sorry... my German sucks, so I answer in English.


Anmelden zum Antworten