diff options
author | Serhei Makarov <serhei@serhei.io> | 2023-04-03 15:49:07 -0400 |
---|---|---|
committer | Serhei Makarov <serhei@serhei.io> | 2023-04-03 15:57:48 -0400 |
commit | ac387efd0a863043149a33b0c2b261ffb217a70e (patch) | |
tree | 6387c6ad6a6e4c8ef1d139082a186b518f22b212 | |
parent | 90b72aea202a676747391f385e0a132aee31e426 (diff) | |
download | elfutils-ac387efd0a863043149a33b0c2b261ffb217a70e.tar.gz |
eu-stacktrace WIP: include sysprof-capture-types.h
This header defines the Sysprof data format; we could make it optional
through configury, but for now the prototype does not support any other
data format.
-rw-r--r-- | README.eu-stacktrace | 6 | ||||
-rw-r--r-- | src/stacktrace.c | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/README.eu-stacktrace b/README.eu-stacktrace new file mode 100644 index 00000000..3aaa63ea --- /dev/null +++ b/README.eu-stacktrace @@ -0,0 +1,6 @@ +# eu-stacktrace development branch + +Requirements: +- /usr/include/sysprof-4 headers (e.g. `sysprof-devel` package on Fedora) + +... diff --git a/src/stacktrace.c b/src/stacktrace.c index acb86a60..485ddd7f 100644 --- a/src/stacktrace.c +++ b/src/stacktrace.c @@ -20,6 +20,16 @@ #include <stdio.h> #include <string.h> +#include <system.h> + +/* TODO: Make optional through configury. The #ifdefs are included + already so we don't miss any code that needs to be controlled with + this option. */ +#define HAVE_SYSPROF_4_HEADERS +#ifdef HAVE_SYSPROF_4_HEADERS +#include <sysprof-4/sysprof-capture-types.h> +#endif + static char *input_path = NULL; static char *output_path = NULL; @@ -35,6 +45,15 @@ static int processing_mode; #define FORMAT_SYSPROF 0x2 static int input_format; +/* Program exit codes. All samples processed without any errors is + GOOD. Some non-fatal errors during processing is an ERROR. A fatal + error or no samples processed at all is BAD. A command line USAGE + exit is generated by argp_error. */ +#define EXIT_OK 0 +#define EXIT_ERROR 1 +#define EXIT_BAD 2 +#define EXIT_USAGE 64 + static error_t parse_opt (int key, char *arg __attribute__ ((unused)), struct argp_state *state) @@ -134,4 +153,10 @@ Utility is a work-in-progress, see README.eu-stacktrace in the source branch.") argp_parse(&argp, argc, argv, 0, NULL, NULL); /* hello world */ +#ifdef HAVE_SYSPROF_4_HEADERS + printf("hello sysprof: %x\n", SYSPROF_CAPTURE_MAGIC); +#else + /* TODO: Should hide corresponding command line options when this is the case. */ + error (EXIT_BAD, 0, N_("Sysprof support is not available in this version.")); +#endif } |