Skip to content

Commit 74a67c3

Browse files
author
roman_yakovenko
committed
adding msvc backend documentation
1 parent ea2be83 commit 74a67c3

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

docs/msvc/msvc.rest

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
=========================
2+
MS Visual Studio backends
3+
=========================
4+
5+
.. contents:: Table of contents
6+
7+
----------------------------------------
8+
Why we need other than GCC-XML backends?
9+
----------------------------------------
10+
11+
It is not a secret, that Windows is not a native environment for GCC. There are
12+
cases, that it cant compile the code, "produced" for other compilers. On Windows,
13+
if you want to use `GCC-XML`_, you should treat it as another compiler and adopt
14+
your source code. Sometimes, changing the source code is not an option and different
15+
solution is needed.
16+
17+
Recently, I started to work on another back-end for `pygccxml`_, based on free tools,
18+
available and freely redistributable with MS Visual Studio:
19+
20+
* PDB - program database. A .pdb files hold debugging information about your
21+
program. In other words, it contains information about every type and function
22+
you use.
23+
* BSC - browse source code. A .bsc file is a comprehensive database that contains
24+
information about a program's symbols, including symbol references,
25+
function calltrees, and definition tables.
26+
27+
Both .pdb and .bsc files contain valuable information about your source code.
28+
I guess, you will be surprised how much information it is possible to extract
29+
from them.
30+
31+
----------------------------
32+
How it works?
33+
----------------------------
34+
35+
Microsoft provides API for extracting information from the files:
36+
37+
* `DIA SDK`_ - Debug Interface Access Software Development Kit is able to read and
38+
provide more-or-less convenient access to the information stored in .pdb files.
39+
DIA SDK exposes it functionality via "COM" technology. `pygccxml`_ uses "comtypes"
40+
project to work with the API.
41+
42+
* `BSC Toolkit`_ comes with C API. `pygccxml`_ uses "ctypes" module, from the Python
43+
standard library.
44+
45+
Both toolkits comes with their own terminolgy. Unless you want to help me, to
46+
develop this backend, you can fully ignore this fact. `pygccxml`_ bridges the
47+
domains and provide clear and consistent API.
48+
49+
Both files, .pdb and .bsc, contain valuable information, but some pieces are
50+
presented in one file and not in other one. In near future `pygccxml`_ will be able
51+
to combine the information, extracted from the files. Hint: you can send me the
52+
patch :-).
53+
54+
------------------
55+
The backend status
56+
------------------
57+
58+
The short version
59+
-----------------
60+
61+
I feel like this backend has "beta" state.
62+
63+
The long version
64+
----------------
65+
66+
`pygccxml`_ pdb backend is able to extract almost all declarations from the .pdb
67+
file. There are few exceptions and problems, that should be solved, before I will
68+
consider this backend as "production" ready:
69+
70+
* add support for bit fields - should not be a problem
71+
* function exception specification - this information is missing in the file
72+
* a declaration location within source code - from the DIA API I understand the
73+
information is there and should be available, but for some reason I can access
74+
it.
75+
* there is some problem with extracting the exact integral type, used in the
76+
source code - for example I have a problem to decide whether "long long int"
77+
or "long int" is used within the code. I believe, it should be possible to
78+
partially solve this problem.
79+
* unit test - `pygccxml`_ comes with impressive amount of unit tests. Today only
80+
small amount of them supports pdb backend. This should be fixed.
81+
* performance - the backend is very slow right now, but this is "by design" and
82+
I believe it is possible to improve it.
83+
84+
85+
.. _`DIA SDK`: http://msdn.microsoft.com/en-us/library/x93ctkx8.aspx
86+
.. _`BSC Toolkit`: http://www.microsoft.com/downloads/details.aspx?FamilyId=621AE185-1C2A-4D6B-8146-183D66FE709D&displaylang=en
87+
.. _`pygccxml`: ./../pygccxml.html
88+
.. _`GCC-XML`: http://www.gccxml.org

0 commit comments

Comments
 (0)