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. Debug and attach to a process

Debug and attach to a process

Scheduled Pinned Locked Moved C / C++ / MFC
debuggingquestion
8 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.
  • D Offline
    D Offline
    deyadav
    wrote on last edited by
    #1

    i m trying to debug a dll and when i try to attach it to a running process, i don't see any process in the process dialog box WHY? steps: 1: create new dll project 2: do anything..... 3: from the debug menu select start debug option 4: then select attach to process 5: now the process dialog box appears now i have to select a process from the list but on my system i don't see any process in this process dialog. Dev Dev

    M M 2 Replies Last reply
    0
    • D deyadav

      i m trying to debug a dll and when i try to attach it to a running process, i don't see any process in the process dialog box WHY? steps: 1: create new dll project 2: do anything..... 3: from the debug menu select start debug option 4: then select attach to process 5: now the process dialog box appears now i have to select a process from the list but on my system i don't see any process in this process dialog. Dev Dev

      M Offline
      M Offline
      Monty2
      wrote on last edited by
      #2

      deyadav wrote: i don't see any process in this process dialog i have no idea why is that happening but as far as i can remember if you are trying to debug a dll then the process attached should load ur dll explicitly or implicitly only then the DllMain gets called, so make a super simple app which calls LoadLibrary("urdll"); and then in dll project put the exe path Hope it helps :) C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

      D 1 Reply Last reply
      0
      • M Monty2

        deyadav wrote: i don't see any process in this process dialog i have no idea why is that happening but as far as i can remember if you are trying to debug a dll then the process attached should load ur dll explicitly or implicitly only then the DllMain gets called, so make a super simple app which calls LoadLibrary("urdll"); and then in dll project put the exe path Hope it helps :) C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

        D Offline
        D Offline
        deyadav
        wrote on last edited by
        #3

        i made a sample application and before i try to debug the dll i run the sample application so that i can select it from the process dialog, but there i don't see anything..... :confused:

        M 1 Reply Last reply
        0
        • D deyadav

          i made a sample application and before i try to debug the dll i run the sample application so that i can select it from the process dialog, but there i don't see anything..... :confused:

          M Offline
          M Offline
          Monty2
          wrote on last edited by
          #4

          after making the dll press f5 to debug it a messagbox will come asking for the location of the exe to load enter the path of the executable in that hope that helps :) C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

          D 1 Reply Last reply
          0
          • M Monty2

            after making the dll press f5 to debug it a messagbox will come asking for the location of the exe to load enter the path of the executable in that hope that helps :) C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

            D Offline
            D Offline
            deyadav
            wrote on last edited by
            #5

            thankx for ur reply but my problem is I DON'T SEE the processes in the process dialog.... Build|Start debug|Attach to process... now in the process dialog all the running processes r there.... but on my system it's blank(not a single process is there)..... YYYYYYY is my question.... do i have to make any settings for this?????? :zzz:

            A 1 Reply Last reply
            0
            • D deyadav

              thankx for ur reply but my problem is I DON'T SEE the processes in the process dialog.... Build|Start debug|Attach to process... now in the process dialog all the running processes r there.... but on my system it's blank(not a single process is there)..... YYYYYYY is my question.... do i have to make any settings for this?????? :zzz:

              A Offline
              A Offline
              Antti Keskinen
              wrote on last edited by
              #6

              This command allows you to attach the debugger into an existing process. It does not allow you to attach your DLL into an existing process. What you need to do is create a simple application that loads your DLL. Then set a breakpoint into the DLL's DllMain function. Now, run the sample application in debug mode, and after the LoadLibrary call, the DllMain's breakpoint gets fired. At least on my computer I was able to attach the debugger into a remote process, break it, run through a set of assembly code lines, and then terminate it. Might it be that you don't have any processes running, or that your user has no rights to see them ? Check CTRL+ALT+DEL and Task Manager. Can you see the processes there ? -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

              D 1 Reply Last reply
              0
              • A Antti Keskinen

                This command allows you to attach the debugger into an existing process. It does not allow you to attach your DLL into an existing process. What you need to do is create a simple application that loads your DLL. Then set a breakpoint into the DLL's DllMain function. Now, run the sample application in debug mode, and after the LoadLibrary call, the DllMain's breakpoint gets fired. At least on my computer I was able to attach the debugger into a remote process, break it, run through a set of assembly code lines, and then terminate it. Might it be that you don't have any processes running, or that your user has no rights to see them ? Check CTRL+ALT+DEL and Task Manager. Can you see the processes there ? -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

                D Offline
                D Offline
                deyadav
                wrote on last edited by
                #7

                no i have the admistrative rights and when i do CTRL+ALT+DEL i can see all the running processes in the Task Manager.

                1 Reply Last reply
                0
                • D deyadav

                  i m trying to debug a dll and when i try to attach it to a running process, i don't see any process in the process dialog box WHY? steps: 1: create new dll project 2: do anything..... 3: from the debug menu select start debug option 4: then select attach to process 5: now the process dialog box appears now i have to select a process from the list but on my system i don't see any process in this process dialog. Dev Dev

                  M Offline
                  M Offline
                  Michael Dunn
                  wrote on last edited by
                  #8

                  If all you want is to debug a DLL, then you're going about it the wrong way. Attaching to a process is used when you want to debug that process. To debug your DLL, you need a program that loads and uses the DLL. When you hit F5 the first time, VC asks you what EXE to run, that's where you tell it the name of the program that will use the DLL. For example, if your DLL were an IE plugin, you would use IE as the program. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- You cannot truly appreciate Dilbert unless you've read it in the original Klingon.

                  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