From: Serhei Makarov Date: Mon, 3 Apr 2023 19:49:07 +0000 (-0400) Subject: eu-stacktrace WIP: include sysprof-capture-types.h X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac387efd0a863043149a33b0c2b261ffb217a70e;p=thirdparty%2Felfutils.git 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. --- diff --git a/README.eu-stacktrace b/README.eu-stacktrace new file mode 100644 index 000000000..3aaa63ea3 --- /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 acb86a605..485ddd7fb 100644 --- a/src/stacktrace.c +++ b/src/stacktrace.c @@ -20,6 +20,16 @@ #include #include +#include + +/* 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 +#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 }