Skip to content

Commit

Permalink
updating to include objects for corpus
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Feb 27, 2021
1 parent 729f4b8 commit 2980c6b
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions abispack-lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ from abispack import read_corpus
corpus = read_corpus("pusheenalibrary.so")
```

This will likely be a `Corpus` object that we can further interact with.

### Write a corpus to abixml

We technically could have Spack call libabigail from the command line,
dump a result into an xml file, and then gzip that, but it would be better
if we could easily do this from spack (calling our application here):

```python
from abispack import write_corpus
success = write_xml_corpus("pusheenalibrary.so", gzip=True)
succes = corpus.write_to_xml(gzip=True)
```

This would likely also accept an output file name, but default to the library plus extension needed (e.g., pusheenalibrary.gzip or pusheenalibrary.xml)
Expand All @@ -87,8 +88,9 @@ Given that we have an exported corpus (per the function directly above) we would
to be able to read it, and have the same corpus that we might have read with `read_corpus`.

```python
from abispack import read_abixml
corpus = read_abixml("pusheenacorpus.gzip")
from abispack import LibabigailParser
parser = LibabigailParser()
corpus = parser.read_abixml("pusheenacorpus.gzip")
```

As you can see above, the file being read could be compressed (or not).
Expand All @@ -99,22 +101,15 @@ Once we've identified what parts of the ABI output are important for
the application, we would then want Spack to be able to easily ask for them.

```python
from abispack import read_corpus
corpus = read_corpus("pusheenalibrary.so")
```

Actually, in this context, it might make sense to have a class to handle this,
like:

```python
from abispack import LibabigailParser
parser = LibabigailParser()
parser.read_corpus("pusheenalibrary.so")
subcorpus = parser.subcorpus() # probably need a more specific name here
corpus.subcorpus()
```

We'd probably want arguments here to specify if we want to make subcorpus
groups from ELF and/or abixml, and then return them organized as such.
Ben also notes that we would want to have something akin to a `CorpusGroup`
that is returned from the above (I think).

A `CorpusGroup` is generally a collection of Corpora.

### Compatability

Expand Down

0 comments on commit 2980c6b

Please sign in to comment.