Skip to content

std::atomic not parsed correct #68

Description

@dkuschmierzBosch

Hi @DanielT

just noticed that std::atomic values are not parsed correct. The type std::atomic has a constexpr member of type bool which indicates if access to the value is always lock free. This member is used for the type, but actually the underlying type is different.

I created a little sample program

#include <atomic>
#include <cstdint>
#include <iostream>

uint32_t a = 5U;
std::atomic<uint32_t> b{5U};

int main() {
  std::cout << a + b.load() << '\n';
  for (int i = 0; i < 1000000; ++i) {
    a += 1U;
    // b += 1U;
  }
  return 0;
}

Compile this with arm-none-eabi-g++ -o example.elf example.cpp --specs=nosys.specs -specs=sync-dmb.specs -gdwarf-2 -g3

Then create an A2L with a2ltool --elffile example.elf --create --measurement-range 0x0 0xFFFFFFFF --output example.a2l

You will get

/* a2ltool 3.4.0 */
ASAP2_VERSION 1 71
/begin PROJECT new_project "description of project"
  /begin MODULE new_module ""

    /begin MEASUREMENT a "measurement for symbol a"
      ULONG NO_COMPU_METHOD 0 0 0 4294967295
      ECU_ADDRESS 0xDEFE4
      SYMBOL_LINK "a" 0
    /end MEASUREMENT

    /begin MEASUREMENT b.is_always_lock_free "measurement for symbol b.is_always_lock_free"
      UBYTE NO_COMPU_METHOD 0 0 0 255
      ECU_ADDRESS 0xDEFE8
      SYMBOL_LINK "b.is_always_lock_free" 0
    /end MEASUREMENT
  /end MODULE
/end PROJECT

The variable b should be also of type ULONG as variable b is.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions