513,894 research outputs found

    Exception Handling in C∀

    Get PDF
    The C∀ (Cforall) programming language is an evolutionary refinement of the C programming language, adding modern programming features without changing the programming paradigms of C. One of these modern programming features is more powerful error handling through the addition of an exception handling mechanism (EHM). This thesis covers the design and implementation of the C∀ EHM, along with a review of the other required C∀ features. The EHM includes common features of termination exception handling, which abandons and recovers from an operation, and similar support for resumption exception handling, which repairs and continues with an operation. The design of both has been adapted to utilize other tools C∀ provides, as well as fit with the assertion based interfaces of the language. The EHM has been implemented into the C∀ compiler and run-time environment. Although it has not yet been optimized, performance testing has shown it has comparable performance to other EHMs, which is sufficient for use in current C∀ programs

    Model Checking C++ with Exceptions

    Get PDF
    We present an extension of the DIVINE software model checker tosupport programs with exception handling. The extension consists of two parts, a language-neutral implementation of the LLVM exception-handling instructions, and an adaptation of the C++ runtime for the DIVINE/LLVM exception model. This constitutes an important step towards support of both the full C++ specification and towards verification of real-world C++ programs using a software model checker. Additionally, we show how these extensions can be used to elegantly implement other features with non-local control transfer, most importantly the longjmp function in C

    Exploiting the Hard-Working DWARF: Trojans with no Native Executable Code

    Get PDF
    All binaries compiled by recent versions of GCC from C++ programs include complex data and dedicated code for exception handling support. The data structures describe the call stack frame layout in the DWARF format bytecode. The dedicated code includes an interpreter of this bytecode and logic to implement the call stack unwinding. Despite being present in a large class of programs -- and therefore potentially providing a huge attack surface -- this mechanism is not widely known or studied. Of particular interest to us is that the exception handling mechanism provides the means for fundamentally altering the flow of a program. DWARF is designed specifically for calculating call frame addresses and register values. DWARF expressions are Turing-complete and may calculate register values based on any readable data in the address space of the process. The exception handling data is in effect an embedded program residing within every C++ process. This talk explores what can be accomplished with control of the exception handling information without modifying the program\u27s text or data. We also examine the exception handling mechanism and argue that it is rife for vulnerability finding, not least because the error states of a program are often those least well tested

    Rcpp: Seamless R and C++ Integration

    Get PDF
    The Rcpp package simplifies integrating C++ code with R. It provides a consistent C++ class hierarchy that maps various types of R objects (vectors, matrices, functions, environments, . . . ) to dedicated C++ classes. Object interchange between R and C++ is managed by simple, flexible and extensible concepts which include broad support for C++ Standard Template Library idioms. C++ code can both be compiled, linked and loaded on the fly, or added via packages. Flexible error and exception code handling is provided. Rcpp substantially lowers the barrier for programmers wanting to combine C++ code with R.

    Studying and Assisting the Practice of Java and C# Exception Handling

    Get PDF
    Programming languages provide features that handle exceptions. These features separate error-handling from regular code and aim to assist software maintenance. Nevertheless, their misuse can cause reliability degradation or even catastrophic failures. Prior studies on exception handling aim to understand the practices of exception handling and their anti-patterns. However, little knowledge was shared about the prevalence of these anti-patterns, nor the relationship between exception handling practices and software quality. In this thesis, I, first, study the exception handling features by enriching the knowledge of handling code with a flow analysis of exceptions. Second, I investigate the prevalence of exception handling anti-patterns. Finally, I investigate the relationship between software quality and: (i) flow characteristics and (ii) 17 handling anti-patterns. Our case study is conducted with over 10K handling blocks, and over 77K related flows from 16 Java and C# projects. I built statistical models of the chance of post-release defects using traditional software metrics and exception handling metrics. Our case study results show the complexity of exception handling. Moreover, I found that although exception handling anti-patterns widely exist in all of our subjects, only a few anti-patterns can be commonly identified. Finally, I conclude that exception flow characteristics in Java projects and some exception handling anti-patterns can provide significant explanatory power to the chance of post-release defects

    A Study on the Effects of Exception Usage in Open-Source C++ Systems

    Get PDF
    Exception handling (EH) is a feature common to many modern programming languages, including C++, Java, and Python, that allows error handling in client code to be performed in a way that is both systematic and largely detached from the implementation of the main functionality. However, C++ developers sometimes choose not to use EH, as they feel that its use increases complexity of the resulting code: new control flow paths are added to the code, "stack unwinding'' adds extra responsibilities for the developer to worry about, and EH arguably detracts from the modular design of the system. In this thesis, we perform an exploratory empirical study of the effects of exceptions usage in 2721 open source C++ systems taken from GitHub. We observed that the number of edges in an augmented call graph increases, on average, by 22% when edges for exception flow are added to a graph. Additionally, about 8 out of 9 functions that may propagate a throw from another function. These results suggest that, in practice, the use of C++ EH can add complexity to the design of the system that developers must strive to be aware of

    Low-Cost Deterministic C++ Exceptions for Embedded Systems

    Get PDF
    The C++ programming language offers a strong exception mechanism for error handling at the language level, improving code readability, safety, and maintainability. However, current C++ implementations are targeted at general-purpose systems, often sacrificing code size, memory usage, and resource determinism for the sake of performance. This makes C++ exceptions a particularly undesirable choice for embedded applications where code size and resource determinism are often paramount. Consequently, embedded coding guidelines either forbid the use of C++ exceptions, or embedded C++ tool chains omit exception handling altogether. In this paper, we develop a novel implementation of C++ exceptions that eliminates these issues, and enables their use for embedded systems. We combine existing stack unwinding techniques with a new approach to memory management and run-time type information (RTTI). In doing so we create a compliant C++ exception handling implementation, providing bounded runtime and memory usage, while reducing code size requirements by up to 82%, and incurring only a minimal runtime overhead for the common case of no exceptions.Postprin
    • 

    corecore