<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">Testing Extensible Language Debuggers</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>
							<persName><forename type="first">Domenik</forename><surname>Pavletic</surname></persName>
							<email>pavletic@itemis.com</email>
							<affiliation key="aff0">
								<orgName type="institution">itemis AG Stuttgart</orgName>
								<address>
									<country key="DE">Germany</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Syed</forename><forename type="middle">Aoun</forename><surname>Raza</surname></persName>
							<affiliation key="aff1">
								<address>
									<settlement>Stuttgart</settlement>
									<country key="DE">Germany</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Kolja</forename><surname>Dummann</surname></persName>
							<email>dummann@itemis.com</email>
							<affiliation key="aff2">
								<orgName type="institution">itemis AG Stuttgart</orgName>
								<address>
									<country key="DE">Germany</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Kim</forename><surname>Haßlbauer</surname></persName>
							<email>kim.hasslbauer@gmail.com</email>
							<affiliation key="aff3">
								<address>
									<settlement>Stuttgart</settlement>
									<country key="DE">Germany</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">Testing Extensible Language Debuggers</title>
					</analytic>
					<monogr>
						<imprint>
							<date/>
						</imprint>
					</monogr>
					<idno type="MD5">56412D968567E02637BB265174FE011E</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-25T06:52+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<textClass>
				<keywords>
					<term>Formal languages</term>
					<term>Software debugging</term>
					<term>Software testing</term>
				</keywords>
			</textClass>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Extensible languages allow incremental extensions of a host language with domain specific abstractions. Debuggers for such languages must be extensible as well to support debugging of different language extensions at their corresponding abstraction level. As such languages evolve over time, it is essential to constantly verify their debugging behavior. For this purpose, a General Purpose Language (GPL) can be used, however this increases the complexity and decreases the readability of tests. To reduce continuous verification effort, in this paper, we introduce DeTeL, an extensible Domain-Specific Language (DSL) for testing extensible language debuggers.</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>I. INTRODUCTION</head><p>Software development faces the challenge that GPLs do not provide the appropriate abstractions for domain-specific problems. Traditionally there are two approaches to overcome this issue. One is to use frameworks that provide domainspecific abstractions expressed with a GPL. This approach has very limited support for static semantics, e. g., no support for modifying constraints or type system. The second approach is to use external DSLs for expressing solutions to domain problems. This approach has some other drawbacks: these DSLs are not inherently extensible. Extensible languages solve these problems. Instead of having a single monolithic DSL, extensible languages enable modular and incremental extensions of a host language with domain specific abstractions <ref type="bibr" target="#b0">[1]</ref>.</p><p>To make debugging extensible languages useful to the language user, it is not enough to debug programs after extensions have been translated back to the host language (using an existing debugger for the base language). A debugger for an extensible language must be extensible as well, to support debugging of modular language extensions at the same abstraction level (extension-level). Minimally, this means users can step through constructs provided by the extension and see watch expressions (e. g., variables) related to the extensions.</p><p>Because language extensions can be based on other extensions and languages evolve over time, it is essential to constantly test if debugger behavior matches the expected behavior. To test debugging behavior, a GPL can be used, however this raises the same issues discussed above. We therefore propose in this paper DeTeL (Debugger Testing Language), an extensible DSL for testing debuggers.</p><p>II. MBEDDR mbeddr <ref type="bibr" target="#b1">[2]</ref> is an extensible version of C that can be extended with modular, domain-specific extensions. It is built on top of JetBrains Meta Programming System (MPS) <ref type="bibr" target="#b2">[3]</ref> and ships with a set of language extensions dedicated to embedded software development. mbeddr includes an extensible C99 implementation. Further, it also includes a set of predefined language extensions on top of C. These extensions include state machines, components and physical units.</p><p>In MPS, language implementations are separated into aspects. The major aspects are Structure, Type System, Constraints, Generator and Editor. However, for building debugging support, the Editor aspect is irrelevant.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>III. LANGUAGE EXTENSION FOR UNIT TESTING</head><p>To give an idea of building language and debugger extensions, we first build MUnit, a language for writing unit tests, and a corresponding debugger extension. Later, we will describe how to test this debugger extension with a DSL.  ExecuteTestExpression returns the number of failed unit tests, hence we specify Int32tType as its type (see rule below). Later, the same type is used in the generator.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Structure</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>check(typeof(executeTestExpression) :==: &lt;Int32tType()&gt;);</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Generator</head><p>The MUnit generator consists of many different transformation rules, which translate code written with the language directly to mbeddr C. Listing 1 shows on the left hand side an example program, written with mbeddr C and MUnit. The right hand side shows the C program generated from it. While regular mbeddr C code is not colored, the boxes indicate how Abstract Syntax Tree (AST) nodes from the left are translated to C code on the right.   mbeddr comes with a debugger, which allows users to debug their mbeddr code on the abstraction levels of the used languages. For that, each language contributes a debugger extension, which is built with a framework also provided by mbeddr <ref type="bibr" target="#b3">[4]</ref>. Those extensions are always language-specific in contrast to domain-specific debuggers (e. g., the moldable debugger <ref type="bibr" target="#b4">[5]</ref>), which provide application-specific debug actions and views on the program state. Hence, debugging support is implemented specifically for the language by lifting the call stack/program state from the base-level to the extension-level (see Fig. <ref type="figure">2</ref>) and stepping/breakpoints vice versa. Fig. <ref type="figure">2</ref>. Flow of debug information between base and extension level <ref type="bibr" target="#b3">[4]</ref> The debugger framework can be separated into two different parts: First, a DSL and a set of interfaces (shown in Fig. <ref type="figure" target="#fig_5">3</ref>) for specifying the debugging semantics of language concepts. Second, a runtime for executing those specifications and thus achieving the mapping described in Fig. <ref type="figure">2</ref>.</p><formula xml:id="formula_0">1 int32 main(int32 argc, 2 string[] argv) { 3 return test[ forTest ] ; 4 } 5 _ f; 6 blockexpr _ 2(); 7 } 8 } 9 int32 _ t bp _ 2() { 10 i32 _ t _ f = 0;</formula><formula xml:id="formula_1">} 1 int32 _ t main(int32 _ t argc, 2 char * (argv[])) { 3 return blockexpr _ 2() ; 4 } 5 | 6 int32 _ t blockexpr _ 2(void) { 7 int32 _ t _ f = 0; 8 _ f += test _ forTest(); 9 return _ f; 10 } 11 12 int32 _ t test _ forTest() { 13 int32 _ t _ f = 0; 14 int32 _ t sum = 0; 15 if(!( sum == 0 )) { _ f++; } 16 int32 _ t[] nums = {1, 2, 3};</formula><p>In this section, we provide an overview of the specification part (see Fig. <ref type="figure" target="#fig_5">3</ref>) that is required for understanding how the debugger extension for MUnit is built. While this paper concentrates on testing debuggers for extensible languages, we have published another paper <ref type="bibr" target="#b3">[4]</ref> describing details about the debugger framework and its implementation with MPS.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Breakpoints</head><p>Breakables are concepts (e. g., Statements) on which we can set breakpoints to suspend the program execution.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Watches</head><p>WatchProviders are translated to low-level watches (e. g., Argument) or represent watches on the extensionlevel. They are declared inside WatchProviderScopes (e. g., StatementList), which is a nestable context.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Stepping</head><p>Steppables define where program execution must suspend next, after the user steps over an instance of Steppable (e. g., Statement). If a Steppable contains a StepIntoable (e. g., FunctionCall), then the Steppable also supports step into.</p><p>StepIntoables are concepts that branch execution into a SteppableComposite (e. g., Function).</p><p>All stepping is implemented by setting low-level breakpoints and then resuming execution until one of these breakpoints is hit (approach is based on <ref type="bibr" target="#b5">[6]</ref>). The particular stepping behavior is realized through stepping-related concepts by utilizing DebugStrategies.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Call Stack</head><p>StackFrameContributors are concepts that have callable semantics on the extension-level or are translated to low-level callables (e. g., Functions). While the latter do not contribute any StackFrames to the high level call stack, the former contribute at least one StackFrame. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. DEBUGGER EXTENSION FOR THE MUNIT LANGUAGE</head><p>This section describes the implementation of a debugger extension for the MUnit language. This extension is defined with the mbeddr debugger specification DSL and the abstractions of the debugging meta-model shown in Fig. <ref type="figure" target="#fig_5">3</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Breakpoints</head><p>To enable breakpoints on AssertStatements, an implementation of the Breakable interface is required. Assert-Statement is derived from Statement that already implements this interface, thus breakpoints are already supported.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Watches</head><p>Since ExecuteTestExpression's stack frame is not shown in the high-level call stack, none of its watches are mapped. In contrast, stack frames for Testcases are visible thus we need to consider its watches. In case of Testcase, the LocalVariableDeclaration _f has no corresponding representation on the extension-level, and is therefore not shown (specified in listing below).</p><p>The mbeddr debugger framework uses a pessimistic approach for lifting watches: those that should not be shown in the UI are marked as hidden. Otherwise, the debugger shows the low-level watch (in this case the C local variable _f) with its respective value. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Call Stack</head><p>Testcase and ExecuteTestExpression are translated to base-level callables and therefore implement StackFrame-Contributor. They contribute StackFrames, each is linked to a base-level stack frame and states whether it is visible in the extension-level call stack or not.</p><p>The implementation of ExecuteTestExpression links the low-level stack frame to the respective instance (see listing below). Further, it hides the frame from the high-level call stack, since ExecuteTestExpression has no callable semantics. contribute frame mapping for frames.select(name=getName());</p><p>Similarly the mapping for Testcase also requires linking the low-level stack frame to the respective instance. However, it declares to show the stack frame in the high-level call stack:</p><p>String frameName = "test _ " + this.name; contribute frame mapping for frames.select(name=frameName); Further, we provide the name of the actual Testcase, which is represented in the call stack view: Consider Listing 1, where we would show the name forTest instead of test_forTest.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VI. REQUIREMENTS</head><p>The debugger testing DSL must allow us to verify at least four aspects: call stack, program state, breakpoints and stepping. To cover these requirements in DeTeL we delineate in this section requirements. While we consider some of those requirements as required (R), others are either context (CS) or mbeddr specific (MS).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Required</head><p>R1 Debug state validation: Changes in generators can modify names of generated procedures or variables and this way, e. g., invalidate program state lifting in the debugger. For being able to identify those problems, we need a mechanism to validate the call stack, and for each of its frames the program state and the location where execution is suspended. For the call stack, a specification of expected stack frames with their respective names is required. In terms of program state, we need to verify the names of watches and their respective values, which can either be simple or complex. Further, a location specifies where program execution is expected to suspend and tests can be written for a specific platform.</p><p>R2 Debug control: Similarly as in R1, generator changes also affect the stepping behavior. Consider changing the FunctionCall generator to inline the body of called functions instead of calling them. This change would require modifications in the implementation of step into as well. For being able to identify those problems, we need the ability to execute stepping commands (in, over and out) and specify locations where to break.</p><p>R3 Language integration: The DSL must integrate with language extensions. This integration is required for specifying in programs under test locations where to break (see R2) and for validating where program execution is suspended (see R1). CS2 Extensibility: Languages should provide support for contributing new validation rules thus achieving extensibility. Those new rules can be used for testing further debugger functionality not covered by DeTeL (e. g., mbeddr's upcoming support for multi-level debugging <ref type="bibr" target="#b6">[7]</ref>) or for writing tests more efficiently.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Context Specific</head><p>CS3 Automated test execution: For fast feedback about newly introduced debugger bugs, we require the ability to integrate our tests into an automatic execution environment (e. g., an IDE or a build server).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Mbeddr Specific</head><p>MS1 Exchangeable debugger backends: mbeddr targets the embedded domain where platform vendors require different compilers and debuggers. Hence, we require the ability to run our tests against different debugger backends and on different platforms.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VII. DEBUGGER TESTING DSL</head><p>DeTeL is open-source and is shipped as part of mbeddr <ref type="bibr" target="#b7">[8]</ref>. It is integrated in MPS and interacts with the mbeddr debugger API. DeTeL is currently tightly coupled to mbeddr, however it could interact with a generic debugger API and could be implemented independent of MPS. This section describes the structure of DeTeL and the implementation of requirements discussed in Section VI. The language syntax is not documented, but can easily be derived by looking at its editor definitions in MPS.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. DebuggerTest</head><p>Fig. <ref type="figure" target="#fig_7">4</ref> shows the structure of DebuggerTest, which is a module that contains IDebuggerTestContents, currently implemented by DebuggerTestcase and CallStack (described later). This interface facilitates extensibility inside DebuggerTest (CS2). Further, DebuggerTest refers to a Binary, which is a concept from mbeddr representing the compiled mbeddr program under test (R3), the imports of IDebuggerTestContents from other DebuggerTests (CS1) and an IDebuggerBackend that specifies the debugger backend (CS2, MS1). The later is implemented by GdbBackend and allows this way to run debugger tests with the GNU Debugger (GDB) <ref type="bibr" target="#b8">[9]</ref>. MPS already contains the language mps.lang.test for writing type system and editor tests. This allows (1) automatic execution of tests on the command-line and (2) visualization of test results in a table view inside MPS. All of that functionality is built for future implementations of ITestcase -an interface from mps.lang.test. By implementing this interface in DebuggerTest (our container for DebuggerTestcases), we benefit from available features (CS3).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. CallStack</head><p>CallStack implements IDebuggerTestContent (see Fig. <ref type="figure" target="#fig_8">5</ref>) and contains IStackFrames (CS2, R1), which has two implementations: StackFrame and StackFrameExtension.</p><p>An extending CallStack inherits all StackFrames from the extended CallStack in the form of StackFrameExtensions, with the possibility of specializing inherited properties (CS1), and can declare additional StackFrames.  SteppingConfig is optional and contains a list of IStep-pingCommands (CS2) that are executed after suspending on location (R2). This interface is implemented by StepInto, StepOver, and StepOut (each performs the respective command n times).</p><p>ValidationConfig contains a list of IValidations (CS2, R1), implemented by CallStack, CallStackRef and OnPlatform. CallStackRef refers to a CallStack that cannot be modified. Finally, OnPlatform specifies a Platform (Mac, Unix or Windows) and contains validations, which are only executed on the specific platform (R1).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VIII. WRITING DEBUGGER TESTS</head><p>In this section, we describe an application scenario where we apply DeTeL to test the debugger extension of MUnit.</p><p>Before  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IX. EXECUTING DEBUGGER TESTS</head><p>Our test cases from the previous section are generated to plain Java code and can be executed in MPS with an action from the context menu. This functionality is obtained by implementing ITestcase in DebuggerTest (see Section VII-A). By executing this action, test results are visualized in a table view, provided by MPS: for each DebuggerTestcase, the result (success or fail) is indicated with a colored bubble and a text field shows the process output.</p><p>As indicated by a green bubble on the left side of Fig. <ref type="figure" target="#fig_11">7</ref>, all of our previously written DebuggerTestcases pass. We show in the next section how language evolution will invalidate the debugger definition and this way cause all of our tests to fail. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Evolving MUnit</head><p>In this section we modify the MUnit generator to demonstrate how this affects the debugger. Currently, the generator reduces a Testcase to a Function: its name is prefixed with test_, followed by the Testcase name (see <ref type="bibr">Listing 1)</ref>. We now change this generator, so the Function name is prefixed with testcase_, instead of test_. The listing below shows how our example program from Listing 1 is now generated to C. Because of our generator modification, Testcases are now generated to Functions with a different identifier as before. However, we have not updated the debugger extension, therefore, the call stack construction for all Testcases fails and this way all of our DebuggerTests fail as well (see Fig. <ref type="figure" target="#fig_13">8</ref>). Although those debugger tests fail, they are still valid, since they are written on the abstraction level of the languages, not the generator. The next section shows how we update the debugger extension to solve the call stack construction. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Updating the Debugger Extension</head><p>The MUnit debugger extension tries to lift for each Testcase a stack frame whose name is prefixed with test_, followed by the name of the respective Testcase (see Section V-D). However, due to our generator modification, this frame is not present and therefore the whole call stack construction fails with an error. To solve this problem, we update the name used for matching the stack frame name:</p><p>String frameName = "testcase _ " + this.name; contribute frame mapping for frames.select(name=frameName);</p><p>Other aspects, such as stepping, breakpoints or watches are not affected by the generator modification and hence do not need to be changed. Therefore, after fixing the call stack lifting for Testcase our debugger tests pass again.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>XI. RELATED WORK</head><p>Wu et al. describe a unit testing framework for DSLs <ref type="bibr" target="#b9">[10]</ref> with focus on testing the semantics of the language. However, from our perspective, it is necessary to have testing DSLs for all aspects of the language definition, e. g., editor (concrete syntax), type system, scoping, transformation rules, and finally the debugger. 1 mbeddr contains tests for the editor, type system, scoping and transformation rules, our work contributes the language for testing the debugger aspect.</p><p>The Low Level Virtual Machine (LLVM) project <ref type="bibr" target="#b10">[11]</ref> comes with a C debugger named Low Level Debugger (LLDB). Test cases for this debugger are written in Python and the unit test framework of Python. While those tests verify the command line interface and the scripting Application Programming Interface (API) of the debugger, they also test other functionality, such as using the help menu or changing the debugger settings. Further, some of the LLDB tests verify the debugging behavior on different platforms, such as Darwin or Linux. In contrast, we only concentrate on testing the debugging behavior, but also support writing tests for specific platforms. Our approach for testing the debugging behavior is derived from the LLDB project: write a program in the source-language (mbeddr), compile it to an executable and debug it through test cases, which verify the debugging behavior.</p><p>The GDB debugger takes a similar approach as the LLDB: tests cover different aspects of the debugger functionality and are written in a scripting language <ref type="bibr" target="#b8">[9]</ref>. Contrarily, to our approach of testing debugging for one extensible language, the GDB project tests debugging behavior for all of its supported languages, such as C, C++, Java, Ada etc. Further, those tests run on different platforms and target configurations. Our work supports writing tests against different platforms, but does not allow users to change the target configuration via the DSL.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>XII. SUMMARY AND FUTURE WORK</head><p>The mbeddr extensible language comes with an extensible debugger. To test this debugger, we have introduced in this paper a generic and extensible testing DSL. The language is implemented in MPS with focus on mbeddr, but the underlying 1 Specific language workbenches might require testing of additional aspects approach is applicable for testing any imperative language debugger. Further, we have shown in this paper (1) the implementation of a language extension, (2) how debugging support is build for it and (3) how the debugger is tested with use of our DSL. The language is designed for extensibility, so others can contribute their own context-specific validation rules. In addition, we concentrated on reuse, so test data, test structures and validation rules can be shared among tests.</p><p>In the future, we plan to investigate ways for integrating the debugger specification DSL with the DSL for testing the debugger extension. From this integration we expect to (1) gain advances in validating debugger test cases and (2) the possibility to automatically generate test cases from formal debugger specifications (based on work from <ref type="bibr" target="#b11">[12]</ref>, <ref type="bibr" target="#b12">[13]</ref> and <ref type="bibr" target="#b13">[14]</ref>). In addition, we will continue researching on languages for testing non-functional aspects, such as testing the performance of stepping commands and lifting of program state.</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head>Fig. 1</head><label>1</label><figDesc>Fig. 1 shows the language structure: AssertStatement is derived from Statement and can therefore be used where Statements are expected. It contains an Expression for the condition. Testcase holds a StatementList that contains the Statements that make up the test. Further, to have the same scope as Function, Testcase implements IModuleContent. ExecuteTestExpression contains a list of TestcaseRef, which refer to Testcases to be executed.</figDesc><graphic coords="1,315.29,491.52,240.95,100.84" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_1"><head>Fig. 1 .</head><label>1</label><figDesc>Fig. 1. Language structure B. Type System and Constraints AssertStatement requires a constraint and a type system rule. It restricts the usages only inside Testcases, meaning an AssertStatement can only be used in a Testcase: parentNode.ancestor&lt;concept = Testcase, +&gt;.isNotNull It also restricts the type of its child expr (condition) to BooleanType, so only valid conditions can be entered: check(typeof(assertStatement.expr) :&lt;=: &lt;BooleanType()&gt;);</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_3"><head></head><label></label><figDesc>22</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_4"><head>Listing 1 .</head><label>1</label><figDesc>Example mbeddr program using the unit test language on the left and the C code that has been generated from it on the right IV. MBEDDR DEBUGGER FRAMEWORK</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_5"><head>Fig. 3 .</head><label>3</label><figDesc>Fig. 3. Meta-model used for specifying the debugging semantics of language concepts [4]. Colors indicate the different debugging aspects</figDesc><graphic coords="2,313.49,538.09,248.03,67.39" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_6"><head></head><label></label><figDesc>CS1 Reusability: For writing debugger tests in an efficient way, we expect from DeTeL the ability to provide reuse: (1) test data, (2) validation rules and (3) the structure of tests. The first covers the ability to have one mbeddr program as test data for multiple test cases. The second refers to single definition and multiple usage of validation rules among different test cases. Finally, the third refers to extending test cases and having the possibility to specialize them.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_7"><head>Fig. 4 .</head><label>4</label><figDesc>Fig. 4. Structure of DebuggerTest</figDesc><graphic coords="4,49.77,432.31,249.46,104.10" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_8"><head>Fig. 5 .</head><label>5</label><figDesc>Fig. 5. Structure of CallStack IStackFrame has three parts, each with two different implementations: a name (IName), a location where program execution should suspend (ILocation) and visible watches (IWatches). IName implementations: SpecificName verifies the specified name matches the actual and AnyName ignores it completely. ILocation implementations: AnyLocation that does not perform any validation and ProgramMarkerRef that refers via ProgramMarker to a specific location in a program under test (R3). These markers just annotate nodes in the AST and have no influence on code generation. IWatch implementations: AnyWatches performs no validations and WatchList contains a list of Watches, each specifies a name/value (IValue) pair. The value can be either PrimitiveValue (e. g., numbers) or ComplexValue (e. g., arrays). C. DebuggerTestcase Fig. 6 shows the structure of DebuggerTestcase: it can extend other DebuggerTestcases (CS1), has a name, and can be abstract. Further it contains the following parts: SuspendConfig, SteppingConfig and ValidationConfig. Concrete DebuggerTestcases require a SuspendConfig and a ValidationConfig (can be inherited), while an abstract DebuggerTestcase requires none of these.</figDesc><graphic coords="4,312.78,102.16,249.44,124.57" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_9"><head>Fig. 6 .</head><label>6</label><figDesc>Fig. 6. Structure of DebuggerTestcase SuspendConfig contains a ProgramMarkerRef that points to the first program location where execution suspends (R2).SteppingConfig is optional and contains a list of IStep-pingCommands (CS2) that are executed after suspending on</figDesc><graphic coords="4,312.46,562.08,246.62,91.90" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_10"><head>Listing 5 . 11 } 7 step over 1 times 8 } 6 } 13 step out 1 times 14 }</head><label>5117861314</label><figDesc>CallStack declarations Listing 5 contains the DebuggerTestcase stepIntoTestcase, which uses the CallStack csInTestcase to verify step into for instances of ExecuteTestExpression. As a first step, program execution is suspended at onReturnInMain, next, a single StepInto is performed before the actual call stack is validated against a custom CallStack derived from csIn-Testcase. This custom declaration specializes the StackFrame forTest i. e., program execution is expected to suspend at onSumDeclaration. Step into ExecuteTestExpression B. Step into/over AssertStatement After verifying step into for ExecuteTestExpression in the previous section, we now test step into and over for AssertStatement. Both stepping commands have the same result when performed at firstAssert, hence common test behavior is extracted into the abstract DebuggerTestcase stepOnAssert as shown in Listing 6: (1) program execution suspends at firstAssert, (2) a custom CallStack verifies program execution suspended in forTest on onArrayDecl and (3) the Watch num holds the PrimitiveValue zero. Listing 6. Abstract DebuggerTestcase The DebuggerTestcase stepIntoAssert extending stepOnAssert performs a StepInto command and stepOver-Assert performs a StepOver:1 testcase stepIntoAssert extends stepOnAssert { 2 Listing 7. Extending DebuggerTestcases C. Step on last Statement in Testcase The last testing scenario verifies that stepping on the last Statement (secondAssert) inside a Testcase suspends execution on the ExecuteTestExpression (onReturnInMain). Again, we create an abstract DebuggerTestcase steppin-gOnLastStmnt that suspends execution on secondAssert and verifies that the actual call stack has the same as CallStack csInMainFunction: Listing 8. Assumptions after suspending program execution in main Next, separate DebuggerTestcases are created, each for step over, into and out, which extend steppingOnLastStmnt and specify only the respective ISteppingCommand: 1 testcase stepOverLastStmnt extends steppingOnLastStmnt { 2 Listing 9. Test stepping commands on last Statement in Testcase In each DebuggerTestcase from the listing above execution suspends on the same Statement (OnReturnInMain), although different stepping commands are performed. Remember, since secondAssert does not contain any children of type StepIntoable (e. g., FunctionCall), performing a step into on the Statement has the same effect as a step over.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_11"><head>Fig. 7 .</head><label>7</label><figDesc>Fig. 7. Successful execution of DebuggerTestcases in MPS X. LANGUAGE EVOLUTION The previous sections have shown how to build a language extension for mbeddr in MPS, define a debugger for this extension and use DeTeL to test its debugging behavior. This section demonstrates how DeTeL is used to identify invalid definitions in debugger extensions after evolving the language.</figDesc><graphic coords="6,316.71,80.22,238.11,86.09" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_12"><head></head><label></label><figDesc>sum == 0 )) { _ f++; } int32 _ t[] nums = {1, 2, 3}; for(int32 _ t i=0;i&lt;3;i++){ sum += nums[i]; } if(!( sum == 6 )) { _ f++; } return _ f; } Listing 10. C code that has been generated with the modified Testcase generator for the example program from Listing 1</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_13"><head>Fig. 8 .</head><label>8</label><figDesc>Fig. 8. Failing DebuggerTestcases after modifying the generator</figDesc><graphic coords="6,316.71,616.50,238.11,84.97" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_1"><head></head><label></label><figDesc>writing debugger tests, we first take the program using MUnit from Listing 1 and annotate it in Listing 2 with ProgramMarkers. Those markers are later used by DebuggerTestcases for specification and verification of code locations where program execution should suspend. Listing 2. Annotated program Next, in the Listing 3 a stub of DebuggerTest UnitTesting is created that will later contain all DebuggerTestcases described in this section. UnitTesting tests against the Binary UnitTestingBinary, which is compiled from Listing 2. Additionally, it instructs the debugger runtime to execute tests with the GdbBackend. For testing step into on instances of Execute-TestExpression, in the Listing 4, we create a CallStack that specifies the stack organization after performing step into on onReturnInMain. To reuse information and minimize redundancy in subsequent DebuggerTestcases, two separate CallStacks are created: First, csInMainFunction contains a single StackFrame that expects (1) program execution to suspend at onReturnInMain and (2) two Watches (argc and argv). Second, csInTestcase extends csInMainFunction by adding an additional StackFrame forTest on top of the StackFrameExtension main (colored in gray). This StackFrame specifies two Watches (sum and nums) and no specific location (AnyLocation).</figDesc><table><row><cell cols="3">1 int32 main(int32 argc, string[ ] argv) {</cell></row><row><cell>2</cell><cell cols="2">[return test[forTest];] onReturnInMain</cell></row><row><cell>3 }</cell><cell></cell></row><row><cell cols="3">4 int32 add(int32 a, int32 b) {</cell></row><row><cell>5</cell><cell>[return a+b;] inAdd</cell></row><row><cell>6 }</cell><cell></cell></row><row><cell cols="2">7 testcase forTest {</cell></row><row><cell>8</cell><cell cols="2">[int32 sum = 0;] onSumDeclaration</cell></row><row><cell>9</cell><cell cols="2">[assert: sum == 0;] firstAssert</cell></row><row><cell>10</cell><cell cols="2">[int32[ ] nums = {1, 2, 3};] onArrayDecl</cell></row><row><cell>11</cell><cell cols="2">for(int32 _ t i=0;i&lt;3;i++) { sum += nums[i]; }</cell></row><row><cell cols="2">1 DebuggerTest UnitTesting</cell><cell>tests binary: UnitTestingBinary {</cell></row><row><cell>2</cell><cell></cell><cell>uses debugger: gdb</cell></row><row><cell>3 }</cell><cell></cell></row><row><cell></cell><cell cols="2">Listing 3. DebuggerTest stub</cell></row><row><cell cols="3">A. Step Into ExecuteTestExpression</cell></row></table><note>12[assert: sum == 6;] secondAssert 13 }</note></figure>
		</body>
		<back>
			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<analytic>
		<title level="a" type="main">Language and IDE Development, Modularization and Composition with MPS</title>
		<author>
			<persName><forename type="first">M</forename><surname>Voelter</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Generative and Transformational Techniques in Software Engineering</title>
		<title level="s">ser. Lecture Notes in Computer Science</title>
		<imprint>
			<date type="published" when="2011">2011</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b1">
	<analytic>
		<title level="a" type="main">Mbeddr: An extensible c-based programming language and ide for embedded systems</title>
		<author>
			<persName><forename type="first">M</forename><surname>Voelter</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><surname>Ratiu</surname></persName>
		</author>
		<author>
			<persName><forename type="first">B</forename><surname>Schaetz</surname></persName>
		</author>
		<author>
			<persName><forename type="first">B</forename><surname>Kolb</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proceedings of the 3rd Annual Conference on Systems, Programming, and Applications: Software for Humanity, ser. SPLASH &apos;12</title>
				<meeting>the 3rd Annual Conference on Systems, Programming, and Applications: Software for Humanity, ser. SPLASH &apos;12<address><addrLine>New York, NY, USA</addrLine></address></meeting>
		<imprint>
			<publisher>ACM</publisher>
			<date type="published" when="2012">2012</date>
			<biblScope unit="page" from="121" to="140" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<monogr>
		<title level="m" type="main">Meta Programming System</title>
		<author>
			<persName><surname>Jetbrains</surname></persName>
		</author>
		<ptr target="http://www.jetbrains.com/mps" />
		<imprint>
			<date type="published" when="2015">2015</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b3">
	<analytic>
		<title level="a" type="main">Extensible debugger framework for extensible languages</title>
		<author>
			<persName><forename type="first">D</forename><surname>Pavletic</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Voelter</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><forename type="middle">A</forename><surname>Raza</surname></persName>
		</author>
		<author>
			<persName><forename type="first">B</forename><surname>Kolb</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Kehrer</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Reliable Software Technologies -Ada-Europe 2015 -20th Ada-Europe International Conference on Reliable Software Technologies</title>
		<title level="s">Proceedings, ser. Lecture Notes in Computer Science</title>
		<editor>
			<persName><forename type="first">J</forename><forename type="middle">A</forename><surname>De La Puente</surname></persName>
		</editor>
		<editor>
			<persName><forename type="first">T</forename><surname>Vardanega</surname></persName>
		</editor>
		<meeting><address><addrLine>Madrid Spain</addrLine></address></meeting>
		<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2015">June 22-26, 2015. 9111. 2015</date>
			<biblScope unit="page" from="33" to="49" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b4">
	<analytic>
		<title level="a" type="main">The moldable debugger: A framework for developing domain-specific debuggers</title>
		<author>
			<persName><forename type="first">A</forename><surname>Chis</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Gîrba</surname></persName>
		</author>
		<author>
			<persName><forename type="first">O</forename><surname>Nierstrasz</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Software Language Engineering -7th International Conference, SLE 2014</title>
				<meeting><address><addrLine>Västerås, Sweden</addrLine></address></meeting>
		<imprint>
			<publisher>Proceedings</publisher>
			<date type="published" when="2014">September 15-16, 2014. 2014</date>
			<biblScope unit="page" from="102" to="121" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b5">
	<analytic>
		<title level="a" type="main">Grammar-driven Generation of Domain-specific Language Testing Tools</title>
		<author>
			<persName><forename type="first">H</forename><surname>Wu</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">20th Annual ACM Special Interest Group on Programming Languages (SIGPLAN) Conference on Object-oriented Programming, Systems, Languages, and Applications</title>
				<meeting><address><addrLine>San Diego, CA, USA</addrLine></address></meeting>
		<imprint>
			<publisher>ACM</publisher>
			<date type="published" when="2005">2005</date>
			<biblScope unit="page" from="210" to="211" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b6">
	<analytic>
		<title level="a" type="main">Multi-Level Debugging for Extensible Languages</title>
		<author>
			<persName><forename type="first">D</forename><surname>Pavletic</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><forename type="middle">A</forename><surname>Raza</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Softwaretechnik-Trends</title>
		<imprint>
			<biblScope unit="volume">35</biblScope>
			<biblScope unit="issue">1</biblScope>
			<date type="published" when="2015">2015</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b7">
	<monogr>
		<author>
			<persName><forename type="first">B</forename><surname>Kolb</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Voelter</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><surname>Ratiu</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><surname>Pavletic</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Z</forename><surname>Molotnikov</surname></persName>
		</author>
		<author>
			<persName><forename type="first">K</forename><surname>Dummann</surname></persName>
		</author>
		<author>
			<persName><forename type="first">N</forename><surname>Stotz</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Lisson</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Eberle</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><surname>Szabo</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Shatalin</surname></persName>
		</author>
		<author>
			<persName><forename type="first">K</forename><surname>Miyamoto</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Kaufmann</surname></persName>
		</author>
		<ptr target="https://github.com/mbeddr/mbeddr.core,GitHubrepository" />
		<title level="m">mbeddr.core -An extensible C</title>
				<imprint>
			<date type="published" when="2015">2015</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b8">
	<monogr>
		<title level="m" type="main">The GNU Project Debugger</title>
		<ptr target="https://www.gnu.org/software/gdb/" />
		<imprint>
			<date type="published" when="2015">2015</date>
		</imprint>
		<respStmt>
			<orgName>Free Software Foundation</orgName>
		</respStmt>
	</monogr>
</biblStruct>

<biblStruct xml:id="b9">
	<analytic>
		<title level="a" type="main">Unit testing for domain-specific languages</title>
		<author>
			<persName><forename type="first">H</forename><surname>Wu</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><forename type="middle">G</forename><surname>Gray</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Mernik</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Domain-Specific Languages, IFIP TC 2 Working Conference, DSL 2009</title>
		<title level="s">Proceedings, ser. Lecture Notes in Computer Science</title>
		<editor>
			<persName><forename type="first">W</forename><forename type="middle">M</forename><surname>Taha</surname></persName>
		</editor>
		<meeting><address><addrLine>Oxford, UK</addrLine></address></meeting>
		<imprint>
			<publisher>Springer</publisher>
			<date type="published" when="2009">July 15-17, 2009. 2009</date>
			<biblScope unit="volume">5658</biblScope>
			<biblScope unit="page" from="125" to="147" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b10">
	<monogr>
		<title level="m" type="main">LLVM Compiler Infrastructure</title>
		<ptr target="http://lldb.llvm.org" />
		<imprint>
			<date type="published" when="2015">2015</date>
		</imprint>
	</monogr>
	<note>The LLDB Debugger</note>
</biblStruct>

<biblStruct xml:id="b11">
	<monogr>
		<title level="m" type="main">Automated generation of testing tools for domainspecific languages</title>
		<author>
			<persName><forename type="first">H</forename><surname>Wu</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Gray</surname></persName>
		</author>
		<editor>ASE, D. F. Redmiles, T. Ellman, and A. Zisman</editor>
		<imprint>
			<date type="published" when="2005">2005</date>
			<publisher>ACM</publisher>
			<biblScope unit="page" from="436" to="439" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b12">
	<analytic>
		<title level="a" type="main">Automatic generation of language-based tools using the LISA system</title>
		<author>
			<persName><forename type="first">P</forename><forename type="middle">R</forename><surname>Henriques</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><forename type="middle">J V</forename><surname>Pereira</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Mernik</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Lenic</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Gray</surname></persName>
		</author>
		<author>
			<persName><forename type="first">H</forename><surname>Wu</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Software, IEE Proceedings</title>
		<imprint>
			<biblScope unit="volume">152</biblScope>
			<biblScope unit="issue">2</biblScope>
			<biblScope unit="page" from="54" to="69" />
			<date type="published" when="2005">2005</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b13">
	<analytic>
		<title level="a" type="main">Grammar-driven generation of domain-specific language debuggers</title>
		<author>
			<persName><forename type="first">H</forename><surname>Wu</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Gray</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Mernik</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Software: Practice and Experience</title>
		<imprint>
			<biblScope unit="volume">38</biblScope>
			<biblScope unit="issue">10</biblScope>
			<biblScope unit="page" from="1073" to="1103" />
			<date type="published" when="2008">2008</date>
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
