#include <unistd.h>
#include <sys/stat.h>
+#include "c99_alloca.h"
#include "os/os_process.h"
#include "util/u_debug.h"
#define DD_DIR "ddebug_dumps"
static inline FILE *
-dd_get_debug_file()
+dd_get_debug_file(bool verbose)
{
static unsigned index;
char proc_name[128], dir[256], name[512];
return NULL;
}
+ if (verbose)
+ fprintf(stderr, "dd: dumping to file %s\n", name);
+
return f;
}
+static inline void
+dd_parse_apitrace_marker(const char *string, int len, unsigned *call_number)
+{
+ unsigned num;
+ char *s;
+
+ if (len <= 0)
+ return;
+
+ /* Make it zero-terminated. */
+ s = alloca(len + 1);
+ memcpy(s, string, len);
+ s[len] = 0;
+
+ /* Parse the number. */
+ errno = 0;
+ num = strtol(s, NULL, 10);
+ if (errno)
+ return;
+
+ *call_number = num;
+}
+
#endif /* DD_UTIL_H */