Presentation is loading. Please wait.

Presentation is loading. Please wait.

Debugging C++ template metaprograms. Structure Template metaprogramming (TMP) Debugging –In general –TMP Templight framework –Idea –implementation Results.

Similar presentations


Presentation on theme: "Debugging C++ template metaprograms. Structure Template metaprogramming (TMP) Debugging –In general –TMP Templight framework –Idea –implementation Results."— Presentation transcript:

1 Debugging C++ template metaprograms

2 Structure Template metaprogramming (TMP) Debugging –In general –TMP Templight framework –Idea –implementation Results

3 Template metaprogramming C++ generics are Turing complete, we can implement algorithms that run in compile time Factorial example

4 Comparison Run time vs. compile time

5 TMP ontology 1 Ill-formed and well-formed programs well-formed = according to language rules

6 TMP ontology 2

7 Debugging in general

8 Debugging TMP

9 Today’s possibilities Compiler support (preferred long term solution) Language elements Since we don’t have compiler support, use the existing language elements and the analogue between run time and metaprograms

10 If we had a trace file? We can debug a program a posteriori if we have a trace of the run Therefore if we had such a trace file for template metaprograms then we would be able to debug them

11 Warnings are talkative Today’s compilers usually display warning messages that contain essential contextual information Artificially generate such warnings

12 Portable warning Consider the following line: … Build outputs G++Watcom MSVC 7.1, 8.0Comeau Etc.

13 Step #1: preprocessing Use the existing preprocessor to obtain a single source file

14 Step #2: instrumentation Insert our specially designed warnings to the interested positions

15 Step #3: Build -> warnings Feed the compiler with this modified source and save the warnings

16 Step #4: warnings -> trace file Gather the information from the warnings and create a trace file for further use

17 Results: TMP debugger IDE How it looks like in real

18 Ideal compiler support Special output to migrate these hacks into the compiler

19 Limitations Different levels (no output, only partial info) Simple pattern matching is not strong enough, ambiguity

20 Related work Profiling TMP book efficieny measurements Tracer Mpl::print archetype

21 Future directions Eliminate limitations Profiling IDE integration Compiler support

22 Conclusion This is a prototype that works with limitations With compiler support useful tools could be easily created

23 Contact Home page


Download ppt "Debugging C++ template metaprograms. Structure Template metaprogramming (TMP) Debugging –In general –TMP Templight framework –Idea –implementation Results."

Similar presentations


Ads by Google