Skip to content

Commit 50634b3

Browse files
author
roman_yakovenko
committed
update docs
1 parent 4b600bd commit 50634b3

File tree

1 file changed

+77
-55
lines changed

1 file changed

+77
-55
lines changed

docs/msvc/msvc.rest

Lines changed: 77 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,110 @@
1-
=========================
2-
MS Visual Studio backends
3-
=========================
1+
==========================
2+
MS Visual Studio back-ends
3+
==========================
44

55
.. contents:: Table of contents
66

7-
----------------------------------------
8-
Why we need other than GCC-XML backends?
9-
----------------------------------------
7+
-----------------------------------------
8+
Why we need other than GCC-XML back-ends?
9+
-----------------------------------------
1010

1111
It is not a secret, that Windows is not a native environment for GCC. There are
1212
cases, that it cant compile the code, "produced" for other compilers. On Windows,
1313
if you want to use `GCC-XML`_, you should treat it as another compiler and adopt
1414
your source code. Sometimes, changing the source code is not an option and different
1515
solution is needed.
1616

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:
17+
--------
18+
The idea
19+
--------
1920

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.
21+
The idea is the same as with `GCC-XML`_ - don't write custom C++ parser, but use
22+
the compiler to extract the information.
2623

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.
24+
During the build process, MS Visual Studio generates few files, which contain
25+
source code "description":
3026

31-
----------------------------
32-
How it works?
33-
----------------------------
27+
* .pdb file. A "program database" file holds debugging information about your
28+
program. It is generated automaticly during "Debug" builds.
3429

35-
Microsoft provides API for extracting information from the files:
30+
* .bsc file. A "browse source code" file is a comprehensive database that contains
31+
information about a program's symbols, including symbol references, function
32+
calltrees, and definition tables. .bsc file is not generated by default, so
33+
you will have to turn-on this option.
3634

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.
35+
I guess, you will be surprised how much information it is possible to extract.
4136

42-
* `BSC Toolkit`_ comes with C API. `pygccxml`_ uses "ctypes" module, from the Python
43-
standard library.
37+
Microsoft provides API for working with the files:
4438

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.
39+
* `DIA SDK`_ - Debug Interface Access Software Development Kit reads and gives
40+
more or less convenient access to the information stored in the .pdb files.
41+
`DIA SDK`_ is an integral part of MS Visual Studio.
4842

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 :-).
43+
`DIA SDK`_ exposes its functionality via "COM" technology. `pygccxml`_ uses
44+
`comtypes package`_ to work with the API.
5345

54-
------------------
55-
The backend status
56-
------------------
46+
* `Browse Source Code Toolkit`_ comes with C API. In order to read .bsc files you
47+
have to `install the toolkit`_.
48+
49+
`pygccxml`_ uses "ctypes" module, from the Python standard library.
50+
51+
Both API's comes with documentation and examples.
52+
53+
`pygccxml`_ is going to introduce another back-end based on these tools. Each of
54+
these tools doesn't tell the "whole story" about your source code, but if we
55+
merge the information, extracted from the files, you can get almost the complete
56+
picture.
57+
58+
59+
-------------------
60+
The back-end status
61+
-------------------
5762

5863
The short version
5964
-----------------
6065

61-
I feel like this backend has "beta" state.
66+
The back-end has "alpha" state.
6267

6368
The long version
6469
----------------
6570

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.
71+
`pygccxml`_ MSVC back-end will consist from few packages:
72+
73+
* ``pdb`` package reads the declaration tree from the .pdb file. This package is
74+
almost complete. I still have to resolve few problems and your help is welcome:
75+
76+
* add support for bit fields - should not be a problem
77+
78+
* function exception specification - this information is missing in the file
79+
80+
* a declaration location within source code - from the DIA API I understand the
81+
information is there and should be available, but for some reason I can access
82+
it.
83+
84+
* there is some problem with extracting the exact integral type, used in the
85+
source code - for example I have a problem to decide whether "long long int"
86+
or "long int" is used within the code. I believe, it should be possible to
87+
partially solve this problem.
88+
89+
* unit tests - `pygccxml`_ comes with impressive amount of unit tests. Today
90+
only some of them support pdb backend.
91+
92+
* performance - the backend is very slow right now, but this is "by design" and
93+
I believe it is possible to improve it.
94+
95+
* ``bsc`` package is a Python wrapper for `BSC Toolkit`_. I am almost sure, it is
96+
not possible to create "declarations tree" from the .bsc file. So this package
97+
will be used to complete the information, extracted from the .pdb files.
98+
99+
* ``msvc`` package will be the top level package that will provide a convinient
100+
access to the both sub-packages and provide "merge" functionality. As you can
101+
guess this package doesn't exist.
83102

84103

85104
.. _`DIA SDK`: http://msdn.microsoft.com/en-us/library/x93ctkx8.aspx
105+
.. _`Browse Source Code Toolkit` : http://www.microsoft.com/downloads/details.aspx?FamilyId=621AE185-1C2A-4D6B-8146-183D66FE709D&displaylang=en
86106
.. _`BSC Toolkit`: http://www.microsoft.com/downloads/details.aspx?FamilyId=621AE185-1C2A-4D6B-8146-183D66FE709D&displaylang=en
87107
.. _`pygccxml`: ./../pygccxml.html
88108
.. _`GCC-XML`: http://www.gccxml.org
109+
.. _`comtypes package` : http://starship.python.net/crew/theller/comtypes/
110+
.. _`install the toolkit` : http://www.microsoft.com/downloads/details.aspx?FamilyId=621AE185-1C2A-4D6B-8146-183D66FE709D&displaylang=en

0 commit comments

Comments
 (0)