|
1 |
| -========================= |
2 |
| -MS Visual Studio backends |
3 |
| -========================= |
| 1 | +========================== |
| 2 | +MS Visual Studio back-ends |
| 3 | +========================== |
4 | 4 |
|
5 | 5 | .. contents:: Table of contents
|
6 | 6 |
|
7 |
| ----------------------------------------- |
8 |
| -Why we need other than GCC-XML backends? |
9 |
| ----------------------------------------- |
| 7 | +----------------------------------------- |
| 8 | +Why we need other than GCC-XML back-ends? |
| 9 | +----------------------------------------- |
10 | 10 |
|
11 | 11 | It is not a secret, that Windows is not a native environment for GCC. There are
|
12 | 12 | cases, that it cant compile the code, "produced" for other compilers. On Windows,
|
13 | 13 | if you want to use `GCC-XML`_, you should treat it as another compiler and adopt
|
14 | 14 | your source code. Sometimes, changing the source code is not an option and different
|
15 | 15 | solution is needed.
|
16 | 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: |
| 17 | +-------- |
| 18 | +The idea |
| 19 | +-------- |
19 | 20 |
|
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. |
26 | 23 |
|
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": |
30 | 26 |
|
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. |
34 | 29 |
|
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. |
36 | 34 |
|
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. |
41 | 36 |
|
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: |
44 | 38 |
|
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. |
48 | 42 |
|
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. |
53 | 45 |
|
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 | +------------------- |
57 | 62 |
|
58 | 63 | The short version
|
59 | 64 | -----------------
|
60 | 65 |
|
61 |
| -I feel like this backend has "beta" state. |
| 66 | +The back-end has "alpha" state. |
62 | 67 |
|
63 | 68 | The long version
|
64 | 69 | ----------------
|
65 | 70 |
|
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. |
83 | 102 |
|
84 | 103 |
|
85 | 104 | .. _`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 |
86 | 106 | .. _`BSC Toolkit`: http://www.microsoft.com/downloads/details.aspx?FamilyId=621AE185-1C2A-4D6B-8146-183D66FE709D&displaylang=en
|
87 | 107 | .. _`pygccxml`: ./../pygccxml.html
|
88 | 108 | .. _`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