Thread: Anyone know how to log register values of a process?

  1. #1
    Registered User WebSnozz's Avatar
    Join Date
    Oct 2001
    Posts
    102

    Anyone know how to log register values of a process?

    Anyone know how to log the values of a register while debugging a process in VC++?

    I want to log the EIP register which will basically give me program flow from offsets.
    WebSnozz-
    Cats have no butt cheeks.
    If one farted, then it would make a flute noise.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Yes you could use inline assembler. THis is kind of handy too:

    Code:
    register unsigned long *EIP asm("EIP");
    ...
    printf("%ld", *EIP);

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Since I wasn't familiar with the EIP registers I tried some code...I couldn't get anything to work. Here is a working example though:

    Code:
    //note: use all lowercase in the asm
    register unsigned long *EAX asm("eax");
    ...
    printf("%ld\n", *EAX);
    If someone knows about the EIP thing they can help you but this should give you a step in the right direction. By the way your debugger most likely allows you to dump registers. Try that too.

  4. #4
    Registered User WebSnozz's Avatar
    Join Date
    Oct 2001
    Posts
    102
    Thanks, I cam do a
    mov EAX, EIP
    just before I output. Only thing is I think this will only show me values of EIP in my process. There's something special that VC++ and other debuggers do to attach to another process.
    WebSnozz-
    Cats have no butt cheeks.
    If one farted, then it would make a flute noise.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. IRC-type logger with files based on three values
    By Lechx in forum C Programming
    Replies: 4
    Last Post: 08-27-2008, 04:42 PM
  2. process termination
    By George2 in forum Windows Programming
    Replies: 1
    Last Post: 07-16-2008, 12:48 AM
  3. Replies: 1
    Last Post: 02-03-2005, 03:33 AM
  4. register variables
    By Draco in forum C Programming
    Replies: 7
    Last Post: 08-21-2002, 01:01 PM
  5. Register
    By sean345 in forum C Programming
    Replies: 7
    Last Post: 05-08-2002, 03:06 PM