Skip to content

Feature memory-analyzer #2648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from

Conversation

mmuesly
Copy link
Contributor

@mmuesly mmuesly commented Jul 31, 2018

The idea of the memory-analyzer, is to create the global state required for some verification harnesses from a core dump file.

In order to do so, you have to feed in a binary with debug symbols and a core file, that matches the binary. An you also have to feed in the static symbols from global state, you care about.

The memory-analyzer will print out c code that is suitable to include it into a test harness in continuation.

This PR won't compile without #2599

mmuesly added 7 commits July 31, 2018 17:29
The CBMC code base normaly checks the id of an irept subtype
against some magic id. But for some tests, it is necessary to check against
more than one id. So this functions are use do the checks.

This should further support code readability as a combination of different ids
gets a name.
Applying CBMC on large code bases
requires sometimes to model a test environment.
Running a program until a certain point and let it
crash, allows to analyze the memory state at this point in time.
In continuation, the memory state might be reconstructed as base for
the test environment model.

By using gdb to analyze the core dump, I don't have to take
care of reading and interpreting the core dump myself.
On multiple locations in the code base,
magic numbers are used to mark the base of an intenger conversion.
This commit introduces constants and
replaces the magic numbers in some places.
This code takes a static symbol, zero initalizes the typet of the symbol
and then fills it up with values if possible.
Following the declared structure in the typet, the analyzer
queries the gdb api for values of the attributes of typet.
It the symbol is a primtive type, the analyzer directly
queries for the value of the symbol.
These test have been used as driving example for the memory analyzer.
They test basic functionality and handling of cycles in structs.
@mmuesly
Copy link
Contributor Author

mmuesly commented Jul 31, 2018

I messed up with whitespace changes in f8f661c, so I will fix this and create a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant