Revision: 1236
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1236&view=rev
Author: roman_yakovenko
Date: 2008-02-12 13:31:45 -0800 (Tue, 12 Feb 2008)
Log Message:
-----------
testing pdb
Modified Paths:
--------------
pygccxml_dev/pygccxml/parser/pdb_reader.py
Modified: pygccxml_dev/pygccxml/parser/pdb_reader.py
===================================================================
--- pygccxml_dev/pygccxml/parser/pdb_reader.py 2008-02-07 07:47:26 UTC (rev 1235)
+++ pygccxml_dev/pygccxml/parser/pdb_reader.py 2008-02-12 21:31:45 UTC (rev 1236)
@@ -1,31 +1,64 @@
import os
import sys
+import ctypes
import comtypes
import comtypes.client
from sets import Set as set
-comtypes.client.gen_dir = r'D:\dev\language-binding\sources\pygccxml_dev\pygccxml\parser\gen'
-print comtypes.client.GetModule( r'D:\Program Files\Microsoft Visual Studio .NET 2003\Visual Studio SDKs\DIA SDK\bin\msdia71.dll' )
+msdia_dll = r'C:\Program Files\Microsoft Visual Studio .NET 2003\Visual Studio SDKs\DIA SDK\bin\msdia71.dll'
-#~ MODULE_IDENTIFIER = ('{106173A0-0173-4e5c-84E7-E915422BE997}', 0, 2, 0)
-#~ MODULE_PATH = r'Lib\site-packages\win32com\gen_py\106173A0-0173-4e5c-84E7-E915422BE997x0x2x0.py'
+msdia = comtypes.client.GetModule( msdia_dll )
-#~ try:
- #~ full_module_path = os.path.split( sys.executable )[0]
- #~ full_module_path = os.path.join( full_module_path, MODULE_PATH )
- #~ if os.path.exists( full_module_path ):
- #~ os.remove( full_module_path )
- #~ print(full_module_path, " removed successfully")
-#~ except Exception, error:
- #~ print 'Exception:', str(error)
+control_pdb = r'C:\dev\produce_pdb\Debug\produce_pdb.pdb'
-#~ msdia = win32com.client.gencache.EnsureModule( *MODULE_IDENTIFIER )
+ds = comtypes.client.CreateObject( msdia.DiaSource )
+ds.loadDataFromPdb(control_pdb)
+session = ds.openSession()
-#ds = comtypes.client.CreateObject( "{e60afbee-502d-46ae-858f-8272a09bd707}" )
-#print dir( ds )
-#ds.loadDataFromPdb( 'xxx.pdb' )
+root_symbol = session.globalScope
-#~ ds = msdia.DiaSource()
-#~ ds.loadDataFromPdb( 'xxx.pdb' )
-#~ session = ds.openSession()
-#~ print 'done'
+print root_symbol
+
+SymTagEnum = 12
+
+def AsDiaSymbol( x ):
+ return ctypes.cast( x, ctypes.POINTER( msdia.IDiaSymbol ) )
+
+def print_enums( smb ):
+ enums = smb.findChildren( SymTagEnum, None, 0 )
+ for enum in iter( enums ):
+ enum = AsDiaSymbol( enum )
+ print 'enum name: ', enum.name
+ #~ print 'enum: ', enum.symIndexId
+ #~ f = session.findFile( internal_smb, internal_smb.name, 0 )
+ #~ print 'name: ', internal_smb.name
+ #~ print f
+ #~ print 'IDiaSymbol::sourceFileName: ', internal_smb.sourceFileName
+ #~ print 'IDiaSymbol::symbolsFileName: ', internal_smb.symbolsFileName
+
+ values = enum.findChildren( msdia.SymTagData, None, 0 )
+ for v in iter(values):
+ v = AsDiaSymbol(v)
+ if v.classParent.symIndexId != enum.symIndexId:
+ continue
+ print '\t\tvalue name: ', v.name, ' ', v.value
+ #~ print 'value parent: ', v.classParent
+ #~ print 'value parent id: ', v.classParentId
+ #~ print 'value parent sym id: ', v.classParent.symIndexId
+
+def print_nss( smb, offset ):
+ symbols = smb.findChildren( msdia.SymTagUDT, None, 0 )
+ for internal_smb in iter( symbols ):
+ internal_smb = ctypes.cast( internal_smb, ctypes.POINTER( msdia.IDiaSymbol ) )
+ if internal_smb.classParentId == smb.symIndexId:
+ print ' ' * offset, internal_smb.name
+ print_nss( internal_smb, offset + 1 )
+
+def print_files( session ):
+ files = iter( session.findFile( None, '', 0 ) )
+ for f in files:
+ f = ctypes.cast( f, ctypes.POINTER(msdia.IDiaSourceFile) )
+ print 'File: ', f.fileName
+
+#~ print_files( session )
+print_enums( root_symbol )
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|