Options
Syntax-Preserving Program Slicing for Highly-Configurable C Software Systems
Syntaxerhaltendes Program Slicing für hochkonfigurierbare C Software Systeme
Abstract
Context: Highly-configurable C software plays a vital role in hardware-near systems, offering flexibility while minimizing development costs. A common practice in highly-configurable C software systems involves the use of conditional compilation with C preprocessor #ifdef-annotations to tailor the software for different hardware configurations. This often results in highly complex projects with ten thousands of #ifdefs scattered all
over the code base. Moreover, the use of unsystematic clone-and-own approaches, where an existing software project is copied and then modified, leads to several different alternatives of the software existing in parallel.
Problem: A common task for software developers in this context is the identification and migration of an existing implementation, like, for example, a new functionality or a bug fix, from one software alternative to another. The automation of these tasks is still an unsolved problem for highly-configurable C-based software systems. In general, there exist numerous search-based approaches that address these problems for non-configurable software, but these approaches ignore C preprocessor code and often rely on the presence of unit test cases, which are not widely used in the context of highly-configurable C software systems. Thus, the developer must conduct an error-prone and long lasting manual analysis to identify and migrate an existing implementation.
Solution idea: A solution idea for the described problem is the use of program slicing to identify the lines of code that implement a desired functionality, which can then be automatically migrated with a merging algorithm to the target software. Program slicing is a technique which reduces a program to a relevant subset called program slice, based on the exploration of a code representation in form of a graph. It is a static analysis technique and therefore not dependent on the existence of test cases. The idea to use program slicing for the automated identification and migration of existing implementations is not new for
non-configurable software, but there exists no comparable approach for highly-configurable C software systems.
Realization: Our proposed solution approach realizes the solution idea with a dedicated code representation called variability-aware code property graph (including a complete C and C preprocessor grammar to represent elements and relations of both languages), a novel and customizable syntax-preserving slicing process for C and C preprocessor code (to compute a truly exhaustive subset of the original program), and an automated semi-structured merging approach. We empirically evaluate our approach on four distinct open-source C software projects, showcasing its effectiveness in generating diverse program slices tailored to different use cases. The results show that our code representation is 100% accurate for syntactically correct C and C preprocessor code, the time required for slicing and migration requires under 20 minutes on average, the slicing approach achieves a size reduction of on average 83 percentage points, which can be further altered by around 7 percentage points on average through our customization options, and the approach is overall capable of automatically identifying and migrating slices in 24 different cases.
over the code base. Moreover, the use of unsystematic clone-and-own approaches, where an existing software project is copied and then modified, leads to several different alternatives of the software existing in parallel.
Problem: A common task for software developers in this context is the identification and migration of an existing implementation, like, for example, a new functionality or a bug fix, from one software alternative to another. The automation of these tasks is still an unsolved problem for highly-configurable C-based software systems. In general, there exist numerous search-based approaches that address these problems for non-configurable software, but these approaches ignore C preprocessor code and often rely on the presence of unit test cases, which are not widely used in the context of highly-configurable C software systems. Thus, the developer must conduct an error-prone and long lasting manual analysis to identify and migrate an existing implementation.
Solution idea: A solution idea for the described problem is the use of program slicing to identify the lines of code that implement a desired functionality, which can then be automatically migrated with a merging algorithm to the target software. Program slicing is a technique which reduces a program to a relevant subset called program slice, based on the exploration of a code representation in form of a graph. It is a static analysis technique and therefore not dependent on the existence of test cases. The idea to use program slicing for the automated identification and migration of existing implementations is not new for
non-configurable software, but there exists no comparable approach for highly-configurable C software systems.
Realization: Our proposed solution approach realizes the solution idea with a dedicated code representation called variability-aware code property graph (including a complete C and C preprocessor grammar to represent elements and relations of both languages), a novel and customizable syntax-preserving slicing process for C and C preprocessor code (to compute a truly exhaustive subset of the original program), and an automated semi-structured merging approach. We empirically evaluate our approach on four distinct open-source C software projects, showcasing its effectiveness in generating diverse program slices tailored to different use cases. The results show that our code representation is 100% accurate for syntactically correct C and C preprocessor code, the time required for slicing and migration requires under 20 minutes on average, the slicing approach achieves a size reduction of on average 83 percentage points, which can be further altered by around 7 percentage points on average through our customization options, and the approach is overall capable of automatically identifying and migrating slices in 24 different cases.
Kontext: Hoch konfigurierbare C-Software spielt eine entscheidende Rolle in Hardwarenahen Systemen und bietet Flexibilität bei gleichzeitiger Minimierung der Entwicklungskosten. Eine gängige Praxis in dieser Art von System umfasst die Verwendung bedingter Kompilierung mit C-Präprozessor-#ifdef-Anweisungen, um die Software für verschiedene Hardwarekonfigurationen anzupassen. Dies führt oft zu äußerst komplexen Projekten mit Zehntausenden von #ifdefs, die über den gesamten Code verteilt sind. Zudem führt der unsystematische Ansatz des clone-and-own, bei dem ein bestehendes Softwareprojekt kopiert und dann modifiziert wird, dazu, dass mehrere verschiedene Alternativen der Soft ware parallel existieren.
Problem: Eine häufige Aufgabe für Softwareentwickler*innen in diesem Zusammenhang ist die Identifizierung und Migration einer bestehenden Implementierung, wie beispielsweise einer neuen Funktionalität oder einer Fehlerbehebung, von einer Softwarealternative zur anderen. Die Automatisierung dieser Aufgaben ist immer noch ein ungelöstes Problem für hoch konfigurierbare C-basierte Software-Systeme. Im Allgemeinen gibt es zahlreiche suchbasierte Ansätze, die diese Probleme für nicht konfigurierbare Software angehen. Allerdings ignorieren diese Ansätze C-Präprozessorcode und verlassen sich oft auf das Vorhandensein von Unit-Testfällen, die im Kontext hoch konfigurierbarer C-Software Systeme nicht weit verbreitet sind. Somit müssen Entwickler*innen eine fehleranfällige und langwierige manuelle Analyse durchführen, um eine bestehende Implementierung zu identifizieren und zu migrieren.
Lösungsidee: Eine Lösungsidee für das beschriebene Problem ist die Verwendung von Program Slicing zur Identifikation der Codezeilen, die eine gewünschte Funktionalität implementieren. Diese können dann mithilfe eines Merging-Algorithmus automatisch in die Zielsoftware migriert werden. Program Slicing ist eine Technik basierend auf der Exploration eines Code Graphen, die ein Programm auf eine relevante Teilmenge namens
Program Slice reduziert. Slicing ist eine statische Analysetechnik und daher nicht von der Existenz von Unit-Testfällen abhängig. Die Idee, Program Slicing zur automatischen Identifizierung und Migration bestehender Implementierungen zu verwenden, ist für nicht konfigurierbare Software zwar nicht neu, jedoch existiert kein vergleichbarer Ansatz für hoch konfigurierbare C-Software.
Umsetzung: Unser Lösungsansatz setzt die Lösungsidee mithilfe einer speziellen Code-Darstellung namens variability-aware Code Property Graph um (einschließlich einer vollständigen C- und C-Präprozessor-Grammatik, um Elemente und Beziehungen beider Sprachen darzustellen), einem neuartigen und anpassbaren syntaxerhaltenden Slicing-Prozess für C- und C-Präprozessorcode (um eine echte vollständige Teilmenge des Originalprogramms zu berechnen) und einem automatisierten halbstrukturierten Merge-Ansatz. Wir evaluieren unseren Ansatz empirisch an vier verschiedenen Open-Source Projekten und zeigen dessen Wirksamkeit bei der Berechnung verschiedener Program Slices, die auf unterschiedliche Anwendungsfälle zugeschnitten sind. Die Ergebnisse zeigen, dass unsere Code-Darstellung für syntaktisch korrekten C- und C-Präprozessorcode 100% genau ist, für das Slicen und die Migration durchschnittlich unter 20 Minuten benötigt werden, der Slicing-Ansatz eine Größenreduzierung von durchschnittlich 83 Prozentpunkten erreicht, welche durch unsere Anpassungsoptionen um durchschnittlich weitere 7 Prozentpunkte verändert werden kann, und der Ansatz insgesamt in der Lage ist, Slices in 24 verschiedenen Fällen automatisch zu identifizieren und zu migrieren.
Problem: Eine häufige Aufgabe für Softwareentwickler*innen in diesem Zusammenhang ist die Identifizierung und Migration einer bestehenden Implementierung, wie beispielsweise einer neuen Funktionalität oder einer Fehlerbehebung, von einer Softwarealternative zur anderen. Die Automatisierung dieser Aufgaben ist immer noch ein ungelöstes Problem für hoch konfigurierbare C-basierte Software-Systeme. Im Allgemeinen gibt es zahlreiche suchbasierte Ansätze, die diese Probleme für nicht konfigurierbare Software angehen. Allerdings ignorieren diese Ansätze C-Präprozessorcode und verlassen sich oft auf das Vorhandensein von Unit-Testfällen, die im Kontext hoch konfigurierbarer C-Software Systeme nicht weit verbreitet sind. Somit müssen Entwickler*innen eine fehleranfällige und langwierige manuelle Analyse durchführen, um eine bestehende Implementierung zu identifizieren und zu migrieren.
Lösungsidee: Eine Lösungsidee für das beschriebene Problem ist die Verwendung von Program Slicing zur Identifikation der Codezeilen, die eine gewünschte Funktionalität implementieren. Diese können dann mithilfe eines Merging-Algorithmus automatisch in die Zielsoftware migriert werden. Program Slicing ist eine Technik basierend auf der Exploration eines Code Graphen, die ein Programm auf eine relevante Teilmenge namens
Program Slice reduziert. Slicing ist eine statische Analysetechnik und daher nicht von der Existenz von Unit-Testfällen abhängig. Die Idee, Program Slicing zur automatischen Identifizierung und Migration bestehender Implementierungen zu verwenden, ist für nicht konfigurierbare Software zwar nicht neu, jedoch existiert kein vergleichbarer Ansatz für hoch konfigurierbare C-Software.
Umsetzung: Unser Lösungsansatz setzt die Lösungsidee mithilfe einer speziellen Code-Darstellung namens variability-aware Code Property Graph um (einschließlich einer vollständigen C- und C-Präprozessor-Grammatik, um Elemente und Beziehungen beider Sprachen darzustellen), einem neuartigen und anpassbaren syntaxerhaltenden Slicing-Prozess für C- und C-Präprozessorcode (um eine echte vollständige Teilmenge des Originalprogramms zu berechnen) und einem automatisierten halbstrukturierten Merge-Ansatz. Wir evaluieren unseren Ansatz empirisch an vier verschiedenen Open-Source Projekten und zeigen dessen Wirksamkeit bei der Berechnung verschiedener Program Slices, die auf unterschiedliche Anwendungsfälle zugeschnitten sind. Die Ergebnisse zeigen, dass unsere Code-Darstellung für syntaktisch korrekten C- und C-Präprozessorcode 100% genau ist, für das Slicen und die Migration durchschnittlich unter 20 Minuten benötigt werden, der Slicing-Ansatz eine Größenreduzierung von durchschnittlich 83 Prozentpunkten erreicht, welche durch unsere Anpassungsoptionen um durchschnittlich weitere 7 Prozentpunkte verändert werden kann, und der Ansatz insgesamt in der Lage ist, Slices in 24 verschiedenen Fällen automatisch zu identifizieren und zu migrieren.
Publication Type
PhDThesis
Author
Date Issued
2025
DOI
Faculty
Institute / Institution
Extent
190
HilPub short link
Dateien
