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. debugging a dll on command line

debugging a dll on command line

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++debuggingjson
10 Posts 4 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.
  • O Offline
    O Offline
    Orkun GEDiK
    wrote on last edited by
    #1

    Hi, I am trying to debug a dll project on VC++ 6.0. Dll file is loading dynamically in the executable (Win32 Console Application) by LoadLibrary API and calling functions by using function pointers. How can I debug this DLL file? Thank you.

    Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

    C A 2 Replies Last reply
    0
    • O Orkun GEDiK

      Hi, I am trying to debug a dll project on VC++ 6.0. Dll file is loading dynamically in the executable (Win32 Console Application) by LoadLibrary API and calling functions by using function pointers. How can I debug this DLL file? Thank you.

      Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      You can specify a executable to be stared when you want to debug your dll. I don't remember exactly where it was for VC6 but it was somewhere in the project properties.


      Cédric Moonen Software developer
      Charting control [v1.2]

      O 1 Reply Last reply
      0
      • C Cedric Moonen

        You can specify a executable to be stared when you want to debug your dll. I don't remember exactly where it was for VC6 but it was somewhere in the project properties.


        Cédric Moonen Software developer
        Charting control [v1.2]

        O Offline
        O Offline
        Orkun GEDiK
        wrote on last edited by
        #3

        Hi Cédric, I tried that method before, but didn't work. This is because, as I emphasised in the message, "DLL is loading by LoadLibrary API" in executable. Is there any other suggestion? Thank you.

        Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

        1 Reply Last reply
        0
        • O Orkun GEDiK

          Hi, I am trying to debug a dll project on VC++ 6.0. Dll file is loading dynamically in the executable (Win32 Console Application) by LoadLibrary API and calling functions by using function pointers. How can I debug this DLL file? Thank you.

          Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

          A Offline
          A Offline
          aks
          wrote on last edited by
          #4

          In MSDEV take Build->Start Debug->Attach To Process. You can see the running process, from which u can select the application which loaded ur dll. open the cpp of ur dll and u can insert breakpoint and can debug. Another way: On Process tab of Task manager right the exe application, which load the dll, and select debug. MsDEV will open, then u can insert break point on ur dll's cpp file and can debug.

          AJay

          C O 2 Replies Last reply
          0
          • A aks

            In MSDEV take Build->Start Debug->Attach To Process. You can see the running process, from which u can select the application which loaded ur dll. open the cpp of ur dll and u can insert breakpoint and can debug. Another way: On Process tab of Task manager right the exe application, which load the dll, and select debug. MsDEV will open, then u can insert break point on ur dll's cpp file and can debug.

            AJay

            C Offline
            C Offline
            carrivick
            wrote on last edited by
            #5

            At the entry point of your DLL include a api call to DebugBreak()

            O 1 Reply Last reply
            0
            • A aks

              In MSDEV take Build->Start Debug->Attach To Process. You can see the running process, from which u can select the application which loaded ur dll. open the cpp of ur dll and u can insert breakpoint and can debug. Another way: On Process tab of Task manager right the exe application, which load the dll, and select debug. MsDEV will open, then u can insert break point on ur dll's cpp file and can debug.

              AJay

              O Offline
              O Offline
              Orkun GEDiK
              wrote on last edited by
              #6

              Hi Ajay, I can't attach to the process, because of dll is calling at the begining of the fork. Thank you.

              Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

              1 Reply Last reply
              0
              • C carrivick

                At the entry point of your DLL include a api call to DebugBreak()

                O Offline
                O Offline
                Orkun GEDiK
                wrote on last edited by
                #7

                Thank you. Is there any way to see C code instead of assembly?

                Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

                C 1 Reply Last reply
                0
                • O Orkun GEDiK

                  Thank you. Is there any way to see C code instead of assembly?

                  Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

                  C Offline
                  C Offline
                  carrivick
                  wrote on last edited by
                  #8

                  Do you have the .PDB file generated during the build of the dll otherwise enable generation of debug info which can be for release or debug. Try using a DEebug build if you are struggling. Try using WinDebug rather than Visual studio, allthough it does have a learning curve.

                  O 1 Reply Last reply
                  0
                  • C carrivick

                    Do you have the .PDB file generated during the build of the dll otherwise enable generation of debug info which can be for release or debug. Try using a DEebug build if you are struggling. Try using WinDebug rather than Visual studio, allthough it does have a learning curve.

                    O Offline
                    O Offline
                    Orkun GEDiK
                    wrote on last edited by
                    #9

                    Thank you for your precious feedback. Of course, I have PDB file for executable and dll files. By using this file, can I debug dll file in WinDbg? If I can, how to? Thank you.

                    Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

                    C 1 Reply Last reply
                    0
                    • O Orkun GEDiK

                      Thank you for your precious feedback. Of course, I have PDB file for executable and dll files. By using this file, can I debug dll file in WinDbg? If I can, how to? Thank you.

                      Orkun GEDiK Senior SAP R/3 Basis and Development Consultant ASTRON

                      C Offline
                      C Offline
                      carrivick
                      wrote on last edited by
                      #10

                      WinDbg has a symbol search path and a source search path. both of these need to be set up correctly. You can also download symbols for windows DLL's for various OS. You can also specify a debugger for any executable image which will get loaded automatically when the program executes. Very useful for debugging services. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options" create a key called "debugger" with a value like "C:\Program Files\Debugging Tools for Windows\windbg.exe" -g

                      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