Results 1 to 9 of 9

Thread: Tracing source code

  1. #1
    warg
    Guest

    Tracing source code

    noobie question here:

    I'm trying to trace a masm program I wrote. I got Ollydbg to follow along the main source code file in the source window, but how do I get it show and follow along in included files also?
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  2. #2
    Super Moderator
    Join Date
    Dec 2004
    Posts
    1,524
    Blog Entries
    15
    what include file ? can you be more clearer ?

    do you mean kernel32.inc , user32.inc ?

    if you have sources for them then they should all show up

    look at view -> sources -> see what files ollydbg are looking for
    and reporting as absent

    you can follow only source files that are referanced by debug information

  3. #3
    warg
    Guest
    Well, for example, I have the file xx.asm
    In that file I have the line " include yy.asm"
    where yy.asm contains some extra procs I'm calling from xx.asm
    Ollydbg happily steps through xx.asm, but knows nothing about yy.asm and does not show it in the source window.

    my assemble options are: /Zi /Zd /c /coff /Cp /nologo /Fl /Sn /Fm /Sg

    my link options are: /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /VERSION:4.0 /INCREMENTAL:NO
    Last edited by warg; July 11th, 2007 at 13:54. Reason: fixed typo and brain glitch
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  4. #4
    OllyDbg really isn't a source-level debugger. But since it's Asm, your "source" is going to be nearly the same as what you see in the disassembly anyway. Since you're writing in Asm you should recognise the code quite well enough as-is.

  5. #5
    warg
    Guest
    Ok, thanks, if it was possible, I wanted to know how.
    For a large program, it's pretty difficult to know which proc you are in just from the disassembly, which also makes it hard to set break points.
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  6. #6
    Super Moderator
    Join Date
    Dec 2004
    Posts
    1,524
    Blog Entries
    15
    warg
    if it is your asm file ollydbg should find it

    i thought you were looking for kernel32.inc files sources from your first post

    anyway ill give an example here see whats wrong with your project if ollydbg cant find your own include file

    Code:
     
    iczelions tut-02 msgbox.exe source code taken as base example 
    
    .386
    .model flat, stdcall
    option casemap:none
    include \masm32\include\windows.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\user32.inc
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib
    
    .data
    MsgCaption      db "Iczelion's tutorial no.2",0
    MsgBoxText      db "Win32 Assembly is Great!",0
    
    .code
    start:
          include blah.asm  <------- addded blah.asm to this code
    	invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
    	invoke ExitProcess,NULL
    
    end start
    blah.asm contains these lines

    Code:
    mov eax,30h
    mov ebx,4h
    add eax,ebx
    i compiled and linked it like this

    Code:
    \masm32\bin\ml /c /coff /Zi "msgbox.asm"
    
    \masm32\bin\Link /PDB:MSGBOX.PDB /PDBTYPE:SEPT /DEBUG /DEBUGTYPE:CV /SUBSYSTEM:WINDOWS /RELEASE "msgbox.obj"
    output like this

    Code:
    test:\>dir /b
    msgbox.asm
    blah.asm
    makeit.bat
    
    test:\>makeit.bat
    
    test:\>\masm32\bin\ml /c /coff /Zi "msgbox.asm"
    Microsoft (R) Macro Assembler Version 6.14.8444
    Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.
    
     Assembling: msgbox.asm
    
    test:\>
    test:\>\masm32\bin\Link /PDB:MSGBOX.PDB /PDBTYPE:SEPT /DEBUG /DEBUGTYPE:CV /SUBS
    YSTEM:WINDOWS /RELEASE "msgbox.obj"
    Microsoft (R) Incremental Linker Version 5.12.8078
    Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
    
    
    test:\>
    test:\>dir /b
    msgbox.asm
    blah.asm
    makeit.bat
    msgbox.obj
    msgbox.exe
    MSGBOX.PDB
    
    test:\>
    lets load this file in ollydbg

    ollydbg finds both the sources

    Code:
    Source files
    Module     Source            Source path
    MSGBOX     BLAH.ASM          D:\MASM32\ICZTUTES\TUTE02\WITHDEBUGINFO\blah.asm
    MSGBOX     MSGBOX.ASM        D:\MASM32\ICZTUTES\TUTE02\WITHDEBUGINFO\msgbox.asm
    in disassembly window

    Code:
    EAX=00401000 (MSGBOX.<ModuleEntryPoint>)
    blah.asm:1.  mov eax,30h
    
    
    msgbox.asm:17.  invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
    a picture
    Attached Images Attached Images  

  7. #7
    warg
    Guest
    Thank you. That works perfectly. I just spent an hour trying to find out why my code doesn't work. I let you know when I figure it out.
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  8. #8
    warg
    Guest
    Ok, finally found it. Try adding the /Fl option to your assembly. Removing that solved my problem. I can't think of any reason generating a listing would mess up the pdb or whatever Olly uses to determine the source files????!? I'm using masm 6.15 by the way if it matters.
    I promise that I have read the FAQ and tried to use the Search to answer my question.

  9. #9
    Super Moderator
    Join Date
    Dec 2004
    Posts
    1,524
    Blog Entries
    15
    dunno never listed anything

    but, in my opinion, it should not be hindering any pdb information creation.

Similar Threads

  1. Tracing into interrupt handler code
    By areverser in forum The Newbie Forum
    Replies: 3
    Last Post: November 3rd, 2010, 06:30
  2. Dll source code
    By w_a_r_1 in forum The Newbie Forum
    Replies: 6
    Last Post: July 1st, 2009, 15:07
  3. Using the disasm source code
    By drPL in forum OllyDbg Support Forums
    Replies: 14
    Last Post: October 14th, 2008, 18:36
  4. I want to look at source code
    By mdhakk in forum The Newbie Forum
    Replies: 7
    Last Post: March 19th, 2005, 22:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •