Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can I put a breakpoint in DLL?

How can I put a breakpoint in DLL?

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingquestion
13 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Kamis

    for effecient debug

    A Offline
    A Offline
    Antony M Kancidrowski
    wrote on last edited by
    #2

    You need to set the DLL as the active project. Then use the appropriate executable when you run the DLL. Breakpoints in the DLL code will then work. Ant. I'm hard, yet soft.
    I'm coloured, yet clear.
    I'm fruity and sweet.
    I'm jelly, what am I? Muse on it further, I shall return!
    - David Williams (Little Britain)

    K 1 Reply Last reply
    0
    • K Kamis

      for effecient debug

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #3

      Is it your DLL (you have the code)? A system DLL? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

      K 1 Reply Last reply
      0
      • K Kamis

        for effecient debug

        W Offline
        W Offline
        wb
        wrote on last edited by
        #4

        the best way is as posted by Antony M Kancidrowski, but if you have a project with 5 dlls and you want to debug all of them :wtf: you can put this in the dll code

        _asm int 3;

        and the debuger will stop at that line. but now you MUST start the app with a debuger attached, or you will get an exception!

        K 1 Reply Last reply
        0
        • A Antony M Kancidrowski

          You need to set the DLL as the active project. Then use the appropriate executable when you run the DLL. Breakpoints in the DLL code will then work. Ant. I'm hard, yet soft.
          I'm coloured, yet clear.
          I'm fruity and sweet.
          I'm jelly, what am I? Muse on it further, I shall return!
          - David Williams (Little Britain)

          K Offline
          K Offline
          Kamis
          wrote on last edited by
          #5

          How can I set DLL as the active project? Well I don't get what you mean. Can you explain more detailed please?

          A 1 Reply Last reply
          0
          • J jmkhael

            Is it your DLL (you have the code)? A system DLL? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

            K Offline
            K Offline
            Kamis
            wrote on last edited by
            #6

            My DLL. But what's the difference if it wasn't?

            J 1 Reply Last reply
            0
            • W wb

              the best way is as posted by Antony M Kancidrowski, but if you have a project with 5 dlls and you want to debug all of them :wtf: you can put this in the dll code

              _asm int 3;

              and the debuger will stop at that line. but now you MUST start the app with a debuger attached, or you will get an exception!

              K Offline
              K Offline
              Kamis
              wrote on last edited by
              #7

              Thanks I`ll try that.

              1 Reply Last reply
              0
              • K Kamis

                My DLL. But what's the difference if it wasn't?

                J Offline
                J Offline
                jmkhael
                wrote on last edited by
                #8

                If its my dll i would go for a hardcoded breakpoint like pointed by wb For System DLLs you need the function name and the dll name of course. you can Determine the exact, unmangled name of the function then Set BP on {,,dllname}Function <=- special syntax To Find the true function name u can use dumpbin. Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                K 1 Reply Last reply
                0
                • K Kamis

                  for effecient debug

                  N Offline
                  N Offline
                  Neville Franks
                  wrote on last edited by
                  #9

                  Use Edit|Breakpoints (Alt+F9) and put in the name of the function. Or load the file into VC++, go to the line where you want the BP, right click and use Insert/Remove Breakpoint. Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com

                  1 Reply Last reply
                  0
                  • J jmkhael

                    If its my dll i would go for a hardcoded breakpoint like pointed by wb For System DLLs you need the function name and the dll name of course. you can Determine the exact, unmangled name of the function then Set BP on {,,dllname}Function <=- special syntax To Find the true function name u can use dumpbin. Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                    K Offline
                    K Offline
                    Kamis
                    wrote on last edited by
                    #10

                    Thanks, but why isn't it possible to use the same syntax {,,dllname}Function for my DLLS?

                    J 1 Reply Last reply
                    0
                    • K Kamis

                      How can I set DLL as the active project? Well I don't get what you mean. Can you explain more detailed please?

                      A Offline
                      A Offline
                      Antony M Kancidrowski
                      wrote on last edited by
                      #11

                      I normally have a workspace with the executable and all DLL projects loaded into the IDE. With such a workspace you need to choose the Active Project (right click on workspace project and Set Active Project or Set as Startup Project depending on IDE). You could just generate a workspace for that DLL. NOTE: If there is only one project in a workspace it is always the active project. It is necessary to point the DLL at an executable that uses it in order to debug the DLL. The IDE will ask you for this when you run the DLL. Ant. I'm hard, yet soft.
                      I'm coloured, yet clear.
                      I'm fruity and sweet.
                      I'm jelly, what am I? Muse on it further, I shall return!
                      - David Williams (Little Britain)

                      K 1 Reply Last reply
                      0
                      • K Kamis

                        Thanks, but why isn't it possible to use the same syntax {,,dllname}Function for my DLLS?

                        J Offline
                        J Offline
                        jmkhael
                        wrote on last edited by
                        #12

                        Yeah it surely works too, but i would go for a hardcoded breakpoint at the line of my choice :) Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                        1 Reply Last reply
                        0
                        • A Antony M Kancidrowski

                          I normally have a workspace with the executable and all DLL projects loaded into the IDE. With such a workspace you need to choose the Active Project (right click on workspace project and Set Active Project or Set as Startup Project depending on IDE). You could just generate a workspace for that DLL. NOTE: If there is only one project in a workspace it is always the active project. It is necessary to point the DLL at an executable that uses it in order to debug the DLL. The IDE will ask you for this when you run the DLL. Ant. I'm hard, yet soft.
                          I'm coloured, yet clear.
                          I'm fruity and sweet.
                          I'm jelly, what am I? Muse on it further, I shall return!
                          - David Williams (Little Britain)

                          K Offline
                          K Offline
                          Kamis
                          wrote on last edited by
                          #13

                          It works! Thanks

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups