gcov_api.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Profiling infrastructure declarations.
  4. *
  5. * This file is based on gcc-internal definitions. Data structures are
  6. * defined to be compatible with gcc counterparts. For a better
  7. * understanding, refer to gcc source: gcc/gcov-io.h.
  8. *
  9. * Copyright IBM Corp. 2009
  10. * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
  11. *
  12. * Uses gcc-internal data definitions.
  13. */
  14. // Modified based on https://github.com/torvalds/linux/blob/master/kernel/gcov/gcov.h
  15. #ifndef _GCOV_API_H_
  16. #define _GCOV_API_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #include <stdint.h>
  21. /*
  22. * - If interface == 0, it will collect coverage data and store in gcov_data_head
  23. * - If interface == 1, it will dump gcda files in filesystem using open/write API
  24. * - otherwise, it will execute gcov_dump() to dump in console */
  25. int gcov_collect(unsigned long interface);
  26. /* Use gcov_dump to dump coverage data in console */
  27. /*
  28. * console dump format like below
  29. Dump coverage data start
  30. 616463672a313342184c8b9e0000000000000001
  31. 0c00000066470d790f5ddbb2b88330a40000a101
  32. 08000000bfd7fc0000000000000000010c000000
  33. c1e7f66aa629cd8f508939c90000a10110000000
  34. 0000000000000000000000000000000000000001
  35. 0c000000b5ea01374ab48209508939c90000a101
  36. 1000000000000000000000000000000000000000
  37. 0100000000000000
  38. C:\Users\hqfang\NucleiStudio_workspace_202402\gcov_example\Debug\application/main.gcda
  39. 0000000001000000000000000100000000000000
  40. 0b000000000000000b0000000000000001000000
  41. 0000000000000000000000000000000000000000
  42. 0b000000000000000b0000000000000000000000
  43. 0000000000000000000000000b00000000000000
  44. 0b00000000000000000000000000000000000000
  45. 000000000b000000000000000b00000000000000
  46. 0b00000000000000000000000000000000000000
  47. 000000000b000000000000000000000000000000
  48. C:\Users\hqfang\NucleiStudio_workspace_202402\gcov_example\Debug\nuclei_sdk/SoC/FreeRTOS/Source/portable/MemMang/heap_4.gcda
  49. Dump coverage data finish
  50. */
  51. void gcov_dump(void);
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif /* _GCOV_API_H_ */