Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://bitbucket.org/adelard/simple-concurrency
16 July 2020, 04:59:35 UTC
  • Code
  • Branches (2)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • branch-tip/byako/test
    • branch-tip/default
    No releases to show
  • e4d595e
  • /
  • README.md
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:dae8b3abc3bfa70d90297ce2d9bc5e2dc649e087
origin badgedirectory badge
swh:1:dir:e4d595ee90553d4d4eb96aa716bc6b01210af2c9
origin badgerevision badge
swh:1:rev:cd7dfa9b13e79137daa54446067371af0a68515d
origin badgesnapshot badge
swh:1:snp:c4b5596e0a959f5423a65cdaf9ad7aba9e9b4ce1

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: cd7dfa9b13e79137daa54446067371af0a68515d authored by Dan Sheridan on 27 February 2015, 15:32:58 UTC
Change -accesses-for to report accesses from the "main" entry point even if it is not explicitly listed in -threads; this better matches the behaviour of -var-overlap.
Tip revision: cd7dfa9
README.md
Simple Concurrency Analysis Plugin for Frama-C
==============================================

Introduction
------------

This project is an extension to the [Frama-C](http://frama-c.com)
software analyser for C, to provide a simple way to discover potential
concurrency problems in interrupt-driven C code. Command-line and GUI
versions are available.

This plugin was developed by [Adelard LLP](http://www.adelard.com) as
part of the FEAST research project, conducted on behalf of CINIF (the
Control and Instrumentation Nuclear Industry Forum).

### Goals ###

The Simple Concurrency Analysis Plugin is aimed at small, embedded
systems, typically without an operating system. These systems commonly
use interrupts to manage hardware and other interactions, and use
shared variables to communicate between the main thread and the
interrupt service routines. As interrupts can occur at any time, these
shared variables can be corrupted.

To help discover potential sources of problems, this plugin does three things:

1. *Help identify interrupt service routines.* These may not be
   obvious from the C source. The plugin identifies all functions
   which are not called from elsewhere in code as possible interrupt
   service routines.
2. *Identify shared variables.* For every combination of the main
   thread and an interrupt service routine, the plugin identifies
   variables which may be accessed by both. These are the global
   variables and other variables with static storage duration (e.g.,
   function local variables declared `static`).
3. *Identify where the variables are accessed.* For a given variable,
   the plugin lists all reads and writes to that variable, reachable
   from the main and chosen interrupt threads.

### Caveats ###

To keep the plugin simple and fast, it does not attempt to process
pointers. This means that variable accesses via pointers are not
identified by this plugin, and calls to function pointers are not
followed. See issue #1.

For programs where this is critical, the
[Mthread](http://frama-c.com/mthread.html) plugin provides a much more
advanced analysis.

The size information reported by `-accesses-for` (see below) is
dependent on Frama-C's `-machdep` option being set correctly.

Installation
------------

This plugin is compatible with Frama-C Neon (20140301). After
installing Frama-C, checkout this repository and run `make` and `make
install`.


Command Line Usage
------------------

The command line version provides three commands. Without any
additional flags, the plugin lists possible entry points for the code
(i.e., functions with no callers):

    $ frama-c -concur test.c test2.c
    [kernel] preprocessing with "gcc -C -E -I.  test.c"
    [kernel] preprocessing with "gcc -C -E -I.  test2.c"
    [concur] Starting concurrency
    [concur] ---Entry points---
    [concur] an_interrupt
    [concur] main
    [concur] an_interrupt2

The `-var-overlap` flag shows the variables accessed by combinations
of threads, together with their scope:

    $ frama-c -concur -var-overlap test.c test2.c
    [kernel] preprocessing with "gcc -C -E -I.  test.c"
    [kernel] preprocessing with "gcc -C -E -I.  test2.c"
    [concur] Starting concurrency
    [concur] ---Entry points---
    [concur] an_interrupt
    [concur] main
    [concur] an_interrupt2
    [concur] -----------------
    [concur] Variables shared by main and an_interrupt:
    [concur] global_val1 (global)
    [concur] global_val4 (global)
    [concur] -----------------
    [concur] Variables shared by main and an_interrupt2:
    [concur] global_val2 (global)
    [concur] global_val1 (global)
    [concur] global_val4 (global)

The `-accesses-for` flag shows where each variable is accessed, and
provides some additional information on the variable's size and type,
since this may make a difference to its interrupt-safety on some
architectures:

    $ frama-c -concur -accesses-for global_val4 test.c test2.c
    [kernel] preprocessing with "gcc -C -E -I.  test.c"
    [kernel] preprocessing with "gcc -C -E -I.  test2.c"
    [concur] Starting concurrency
    [concur] ---Entry points---
    [concur] an_interrupt
    [concur] main
    [concur] an_interrupt2
    [concur] ------------------
    [concur] Declaration: int global_val4[4]
    [concur] Basic size in bytes: 16
    [concur] Basic size in bits: 128
    [concur] ------------------
    [concur] Accesses to global_val4 from an_interrupt:
    [concur] write at test.c:26 in an_interrupt
    [concur] ------------------
    [concur] Accesses to global_val4 from main:
    [concur] write at test.c:13 in main
    [concur] write at test.c:14 in main
    [concur] read at test.c:17 in main
    [concur] ------------------
    [concur] Accesses to global_val4 from an_interrupt2:
    [concur] read at test2.c:12 in an_interrupt2


GUI Usage
---------

Once the plugin is installed, it adds an additional set of options to
the left-hand side of the screen. From here, you can choose a main
thread and an interrupt routine. This will populate the list of shared
variables; selecting a shared variable will highlight it in the source
tree.

*Further GUI examples to follow*

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API