Skip to content
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

Initial implementation of DRCOV-compatible code coverage collection. #311

Merged
merged 6 commits into from Jun 2, 2020

Conversation

assafcarlsbad
Copy link
Contributor

  • The output file can be loaded by an IDA plugin such as Lighthouse in order to visualize the collected code coverage.
    image
  • For this revision, only the UEFI loader was modified to keep a list of loaded images. I believe this amendment can be ported to the other loaders with relative ease.

@xwings
Copy link
Member

xwings commented May 29, 2020

Hi,

Add your name into credits.txt too.

@assafcarlsbad
Copy link
Contributor Author

assafcarlsbad commented May 29, 2020

Already did 😄

@xwings
Copy link
Member

xwings commented May 29, 2020

yo,

I just woke up and on my mobile. So i did not realize it,

Btw, qiling/coverage.py need to be somewhere. It should not be in qiling. This is a feature not widely use in the core engine.

@aquynh
Copy link
Member

aquynh commented May 30, 2020

Please put more docs in coverage.py and qltool that this is DRCOV format, from DynamoRio

Also, making it easy to extend for other coverage formats in the future will be nice.

- place all coverage-related code in its own sub-directory
- allow easy extension with other coverage formats
- add some documentation
@assafcarlsbad
Copy link
Contributor Author

Hi, I made some changes in accordance with your comments. Can you please re-review?

@aquynh
Copy link
Member

aquynh commented May 31, 2020

Nice work!

Does qltool report error if i pass in an invalid coverage name?

@aquynh
Copy link
Member

aquynh commented May 31, 2020

Please update README with a new example.

@assafcarlsbad
Copy link
Contributor Author

assafcarlsbad commented May 31, 2020

@aquynh

Nice work!

Does qltool report error if i pass in an invalid coverage name?

carlsbad@AssafC-T490:/mnt/c/Users/carlsbad/Code/qiling$ ./qltool run --rootfs . --debug --coverage-format foo -c new_tcg_dxe.cov /mnt/c/Users/carlsbad/Code/UEFI_RETool/modules/TcgDxe /mnt/c/Users/carlsbad/Code/UEFI_RETool/modules/TcgPlatformSetupPolicy
usage: qltool run [-h] [-f FILE] --rootfs ROOTFS [--args ...] [-o OUTPUT] [-v VERBOSE] [--env FILE] [-g GDB] [--profile PROFILE]
                  [--strace] [--dump] [--debug] [--disasm] [--console CONSOLE] [-e FUNCTION NAME] [--log-dir DIRECTORY NAME]
                  [--trace] [--root] [--debug_stop] [-m] [--timeout TIMEOUT] [-c COVERAGE_FILE] [--coverage-format {drcov}]
                  ...
qltool run: error: argument --coverage-format: invalid choice: 'foo' (choose from 'drcov')

Please update README with a new example.

Done :)

README.md Outdated
With code coverage collection (UEFI only for now):

```
$ ./qltool run -f TcgDxe.efi --rootfs . --coverage-format drcov --coverage-file TcgDxe.cov
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is should be ,./qltool run -f examples/rootfs/xxxx

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@jershmagersh
Copy link
Contributor

jershmagersh commented May 31, 2020

Great work, I was thinking of implementing the same thing, but you've done a much better job. This should also work with something like Dragon Dance: https://github.com/0ffffffffh/dragondance

@aquynh
Copy link
Member

aquynh commented Jun 1, 2020

A final request from me: please have a README in coverage/ about this coverage framework, with some intructions on how to extend it for a new coverage.

@xwings
Copy link
Member

xwings commented Jun 1, 2020

A final request from me: please have a README in coverage/ about this coverage framework, with some intructions on how to extend it for a new coverage

the readme should goes to docs, maybe a differents pr in https://github.com/qilingframework/rtfd.io

@aquynh
Copy link
Member

aquynh commented Jun 1, 2020 via email

@assafcarlsbad
Copy link
Contributor Author

Done. Please let me know if I'm missing something or if you want me to elaborate more on some aspects.

@xwings
Copy link
Member

xwings commented Jun 2, 2020

perfect !

thanks !

@xwings xwings merged commit 7b460f0 into qilingframework:dev Jun 2, 2020
@assafcarlsbad assafcarlsbad deleted the coverage branch July 15, 2020 16:32
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.

None yet

4 participants