flat assembler
Message board for the users of flat assembler.

Index > Windows > adding windows debug info into .obj file generated fasm

Goto page 1, 2, 3  Next
Author
Thread Post new topic Reply to topic
strap89



Joined: 15 Feb 2009
Posts: 23
Location: Russia
strap89
Hi!
I'm writing utility that adds debug info in codeview format to coff object file generated by fasm, using .fas file from fasm.
Utility is based on information from YASM source files and documentation, and some information from MASM generated object files.
I'm testing it only on files in my project and not sure if it works on all code from fasm.
Object file generated by utility works fine in VS2005 debugger in mixed asm/c++ application.
Maybe it will be useful for somebody. Best regards.


Description: Added alternative in-macro debugging ability. See howto.txt for using rules.
Download
Filename: pecvt15-03-09-SE.zip
Filesize: 50.21 KB
Downloaded: 560 Time(s)

Description: Added in-macro debugging ability. See howto.txt for using rules.
Download
Filename: pecvt15-03-09.zip
Filesize: 49.91 KB
Downloaded: 471 Time(s)

Description: Added multiple code sections support and timestamp checking. See howto.txt for using rules.
Download
Filename: pecvt060309.zip
Filesize: 48.1 KB
Downloaded: 486 Time(s)



Last edited by strap89 on 15 Mar 2009, 16:00; edited 5 times in total
Post 15 Feb 2009, 18:27
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17327
Location: In your JS exploiting you and your system
revolution
Nice. A lot of people here use a free tool called Ollydbg for debugging.
Post 16 Feb 2009, 00:39
View user's profile Send private message Visit poster's website Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
Hi strap89!
Thank you for your source code. I think that FASM needs source level debugger to outrun MASM. I have bin thinking about it for a while and looked the 'Fresh' source level debugger which is written in FASM but unfortunately has some bugs so that it can't be used.
Ollydbg is great but it is unfortunately not the source level debugger, so when I write some program I write it first in MASM assembler (because I can debug it with the WinDbg) and then translate it to FASM and debug both programs parallel with the Ollydbg to rid of bugs in FASM.
So, if there was source level debugger for FASM, I would not depend any more on MASM.

Would you please give some hints how to use your program

regards
Post 19 Feb 2009, 14:20
View user's profile Send private message Reply with quote
strap89



Joined: 15 Feb 2009
Posts: 23
Location: Russia
strap89
Hi habran!
1. compile fasm -s XXX.fas XXX.asm XXX.o (Inside asm use 'format MS COFF')
2. run pecvt XXX.fas or pecvt -v XXX.fas. File XXX.obj will be produced.
Switch -v print on terminal information from XXX.fas in almost readable form - very slow process!
Program not fast and not heavy tested, so MASM depend continue.
Information about codeview format you can read in YASM source.
Best regards.
Post 19 Feb 2009, 16:04
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
good work, but MORE ERROR CHECKING! Your app crashes if output file name is empty.
Post 19 Feb 2009, 16:24
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
strap89



Joined: 15 Feb 2009
Posts: 23
Location: Russia
strap89
Yes. It's my mistake. Necessary run: pecvt XXX.fas XXX.obj . Sorry.
Post 20 Feb 2009, 04:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
general linker question moved here: How to use linker
Post 26 Feb 2009, 22:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
Does it work with WinDbg/cdb/kd? (The Microsoft Debugging Tools).
Post 27 Feb 2009, 14:33
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
strap89



Joined: 15 Feb 2009
Posts: 23
Location: Russia
strap89
I'm use it only in VS2005 IDE debugger. It must work (IMHO), but i'm not shure.
Post 27 Feb 2009, 16:02
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
VS debugger uses dbgeng/dbghelp, which are the MSFT Debugging Tools, so yes it should work too
Post 28 Feb 2009, 10:34
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
Hi strap89!

Congratulations, your pecvt.exe is exelent tool, now I can create .pdb files and am able to debug fasm coff object programs with WinDbg in source mode.

But you have to link it with newer linker. I have used :
"Microsoft (R) Incremental Linker Version 8.00.50727.42"

Thank you

best regards

_________________
down under
Post 01 Mar 2009, 00:06
View user's profile Send private message Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
Hi strap89!

I have bin trying to build my MdiRichEditor for debugging using your pecvt but I have link error "fatal error LNK1000: Internal error during IMAGE::Pass2"

If I Assemble source with FASM to .obj there is no problem to link it to exe
only if I try to create obj with the pecvt I can't.
There is no problem to build obj with pecvt if it is very small program only if it is bigger it doesn't work
I think that it is a problem with the memory allocation

best regards

_________________
down under
Post 05 Mar 2009, 14:15
View user's profile Send private message Reply with quote
strap89



Joined: 15 Feb 2009
Posts: 23
Location: Russia
strap89
Hi habran!
Biggest project that i have in fasm now is fasm itself. I'm convert it into coff format and add startup code in "C". It not work (because i do conversion simply) but compiled ok. It compiled ok in release, compiled ok with debug info, and debugger can come into start point of fasm and stop at my breakpoint (later it break out similary as release).
I think it can be a few problems:
1. It may be big source file as you say. Fasm generate very very long symbol table in fas. Not used names also included and no info about it's usage so pecvt need to include all symbols. Source line count as i think not can cause problem.
2. Word MdiRichEdittor say that you probably use some external dll library in this file. Fasm also include names from dll and compiled but i'm dont know how you do this import. May be some name import operations in fasm generate in obj or fas file info not supported by pecvt.
3. It may be simply some error in pecvt. My linker, if i write wrong debug info in coff, say warning and discard debug information but link successfully.
Error at link come when coff format wrong. Can you check you obj file with tool like 'pedump'? Use "pedump /A you.obj >you.log". And for original file too.
Best regards.


Description:
Download
Filename: PEDUMP.zip
Filesize: 26.06 KB
Downloaded: 345 Time(s)

Post 05 Mar 2009, 16:47
View user's profile Send private message Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
Hi strap89!
I tried PEDUMP but information I get doesn't make me smarter

here I am sending you my source code if you want to look at:

regards


Description:
Download
Filename: MDIRichEditFasm.zip
Filesize: 132.98 KB
Downloaded: 315 Time(s)


_________________
down under
Post 05 Mar 2009, 22:15
View user's profile Send private message Reply with quote
strap89



Joined: 15 Feb 2009
Posts: 23
Location: Russia
strap89
Hi habran!
I have fast solution: comment all '.code' lines at the begining of your .asm files except main file. After that program compiled normaly as in release as in debug mode. Or you can compile each file separately (more complicated solution).
To solve problem at all i need some time.
For each line: "section '.text' " fasm generate separated sections in obj file with identical name. pecvt also do that but in debug info (as i suppose) this section mixed in wrong way.
I will try to find solution.
Best regards.
Post 06 Mar 2009, 10:41
View user's profile Send private message Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
Hi strap89!

I tried to comment .code and I have the same link error.

Did you link the .obj to .exe and if you have did you use my makeit.bat?

Would joy post .obj that you created with the pecvt so that I try to link it to .exe

I am very exited about having .pdb files in FASM and looking forward to it.

I have an old version of MdiRichEditor wich has only one .asm file and which I succeeded to link successfully. If you are interested I can post it to you

best regards

_________________
down under
Post 06 Mar 2009, 13:27
View user's profile Send private message Reply with quote
strap89



Joined: 15 Feb 2009
Posts: 23
Location: Russia
strap89
I'm check again. At first time linker also crash. but after i repeat link it run success. I think when i in VS press Save All, i need to wait for complete, but i run immediately and file not fully writed. After then i try repeat this situation but unsuccessfully.
Additional change that i forgot is: i'm remove line
include '\fasm\INCLUDE\Api\shlwapi.inc' in win32axp.inc
because i'm not have such file.
I'm attach files. See linkit.bat for used options. I'm try to keep your options.
Best regards.


Description:
Download
Filename: MDIRichEditFasm.zip
Filesize: 408.39 KB
Downloaded: 336 Time(s)

Post 06 Mar 2009, 15:32
View user's profile Send private message Reply with quote
strap89



Joined: 15 Feb 2009
Posts: 23
Location: Russia
strap89
Hi, habran!
I'm solve problem with multiple code sections. You can try updated version (see top post of topic). At least in your project it work. I check rapidly - if you will use it, write result please.
Best regards.
Post 07 Mar 2009, 09:25
View user's profile Send private message Reply with quote
habran



Joined: 31 Aug 2008
Posts: 82
Location: South Australia
habran
Hallelujah!!!

Excellent!

Best regards
Post 07 Mar 2009, 10:54
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17327
Location: In your JS exploiting you and your system
revolution
I think this thread should be made sticky.
Post 07 Mar 2009, 11:00
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.