News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

UASM CodeView V8

Started by LiaoMi, December 13, 2020, 05:21:55 AM

Previous topic - Next topic

LiaoMi

Hi,

are there any plans to add codeview 8 format to UASM? This topic was discussed earlier - https://sourceforge.net/p/jwasm/discussion/927109/thread/7c8e4f32/
Meanwhile, other activists have made support for this debug format:
Nasm
const struct dfmt df_cv8 = {
   62     "Codeview 8+",              /* .fullname */
   63     "cv8",                      /* .shortname */
   64     cv8_init,                   /* .init */
   65     cv8_linenum,                /* .linenum */
   66     cv8_deflabel,               /* .debug_deflabel */
   67     null_debug_directive,       /* .debug_directive */
   68     cv8_typevalue,              /* .debug_typevalue */
   69     cv8_output,                 /* .debug_output */
   70     cv8_cleanup,                /* .cleanup */
   71     NULL                        /* pragma list */
   72 };

https://fossies.org/linux/nasm/output/codeview.c
Yasm
QuoteThis patchset adds support for the Codeview 8 debug format for PE/COFF files.
The first two patches in this set lay the groundwork for the third. The first
patch adds a utility function for converting a relative path to an absolute
path, because Codeview wants absolute paths. Codeview stores an MD5 hash of
the source file, so the second patch adds an implementation that's in the
public domain.

All of the interesting bits in the third patch are in codeview.c. Prior to this
patch, COFF hadn't supported a debug format, so the debugs hooks weren't hooked
up, nor were the necessary bits exposed external to outcoff.c.
As a result, there's an ugly part of the diff for outcoff.c/pecoff.h that hooks
up the debug calls, exports some definitions and variables, and renames the
exported stuff to avoid collisions, e. g., Symbol -> coff_Symbol. I can roll
the ugly part into its own patch if it really bothers people.

So far, I've tested this in WinDbg for both 32- and 64-bit code.

For more information on the Codeview 8 format, see https://github.com/yasm/yasm/blob/master/modules/dbgfmts/codeview/cv8.txt
https://github.com/yasm/yasm/tree/master/modules/dbgfmts/codeview

Description of the old format - http://ftp.openwatcom.org/devel/docs/CodeView.pdf (CV4 documentation)

https://github.com/Terraspace/UASM/blob/3b50ae9dc4a4684346d666ddd637c1e2f5233b43/H/dbgcv.h
#define CV4_SIGNATURE 1
#define CV5_SIGNATURE 2
#define CV8_SIGNATURE 4 /* not yet supported */

#define CV_SIGNATURE CV4_SIGNATURE /* default is CV4 */


Microsoft
https://github.com/Microsoft/microsoft-pdb/blob/master/include/cvinfo.h
https://github.com/microsoft/microsoft-pdb/blob/master/include/cvconst.h

LLVM
https://github.com/llvm-mirror/llvm/tree/master/lib/DebugInfo/CodeView

DebugBSD

Quote from: LiaoMi on December 13, 2020, 05:21:55 AM
Hi,

are there any plans to add codeview 8 format to UASM? This topic was discussed earlier - https://sourceforge.net/p/jwasm/discussion/927109/thread/7c8e4f32/
Meanwhile, other activists have made support for this debug format:
Nasm
const struct dfmt df_cv8 = {
   62     "Codeview 8+",              /* .fullname */
   63     "cv8",                      /* .shortname */
   64     cv8_init,                   /* .init */
   65     cv8_linenum,                /* .linenum */
   66     cv8_deflabel,               /* .debug_deflabel */
   67     null_debug_directive,       /* .debug_directive */
   68     cv8_typevalue,              /* .debug_typevalue */
   69     cv8_output,                 /* .debug_output */
   70     cv8_cleanup,                /* .cleanup */
   71     NULL                        /* pragma list */
   72 };

https://fossies.org/linux/nasm/output/codeview.c
Yasm
QuoteThis patchset adds support for the Codeview 8 debug format for PE/COFF files.
The first two patches in this set lay the groundwork for the third. The first
patch adds a utility function for converting a relative path to an absolute
path, because Codeview wants absolute paths. Codeview stores an MD5 hash of
the source file, so the second patch adds an implementation that's in the
public domain.

All of the interesting bits in the third patch are in codeview.c. Prior to this
patch, COFF hadn't supported a debug format, so the debugs hooks weren't hooked
up, nor were the necessary bits exposed external to outcoff.c.
As a result, there's an ugly part of the diff for outcoff.c/pecoff.h that hooks
up the debug calls, exports some definitions and variables, and renames the
exported stuff to avoid collisions, e. g., Symbol -> coff_Symbol. I can roll
the ugly part into its own patch if it really bothers people.

So far, I've tested this in WinDbg for both 32- and 64-bit code.

For more information on the Codeview 8 format, see https://github.com/yasm/yasm/blob/master/modules/dbgfmts/codeview/cv8.txt
https://github.com/yasm/yasm/tree/master/modules/dbgfmts/codeview

Description of the old format - http://ftp.openwatcom.org/devel/docs/CodeView.pdf (CV4 documentation)

https://github.com/Terraspace/UASM/blob/3b50ae9dc4a4684346d666ddd637c1e2f5233b43/H/dbgcv.h
#define CV4_SIGNATURE 1
#define CV5_SIGNATURE 2
#define CV8_SIGNATURE 4 /* not yet supported */

#define CV_SIGNATURE CV4_SIGNATURE /* default is CV4 */


Microsoft
https://github.com/Microsoft/microsoft-pdb/blob/master/include/cvinfo.h
https://github.com/microsoft/microsoft-pdb/blob/master/include/cvconst.h

LLVM
https://github.com/llvm-mirror/llvm/tree/master/lib/DebugInfo/CodeView

Hi, Right now,

I think is not possible to add support to CodeView 8 into UASM. Mostly because CodeView 8 it's an extended version of CodeView 5 (That's the impression I got after reading YASM notes about CodeView 8 and source code from Microsoft-PDB github) and CodeView 5 is not working correctly in UASM. That's why UASM currently uses CodeView4 (As you have seen in the dbgcv.h header from UASM source code). I've compiled UASM64 (Branch 2.50) with support to CodeView5 and it seems to work but, when you try to write arrays of data structures, the assembler seems to work correctly and even the program links correctly, but the program crashes when you try to execute it. So, first of all, it's needed to fix CodeView 5 and then, go to Codeview8 and that is going to be a hard task I guess (after having read dbgcv.c from UASM source code, althought I could be wrong).

If you need support to CodeView 8 in you debugging session, you can use ASMC (See ASMC Development forum here) without any problem (You will need to use -Zi8 flag to enable CV8 support when you assemble you source code). I have tested it both with WinDbg and CDB and it works good!. You can see your data structures, linked lists, graphs and whatever algorithm you use in your projects so you wont have any problem.

The good thing about using so many assemblers is that you can program you code to adapt it to different assemblers without losing efficiency hahaha :P

Merry Crhistmas and Happy Hacking the New Year!

Happy Hacking!

TouEnMasm


There is also the "DIA SDK" part of Visual studio c++ "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK"
Give further include and a sample in VC++ reading pdb.
Fa is a musical note to play with CL

nidud

https://www.felixcloutier.com/x86/pext