X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgallium%2Fdrivers%2Fddebug%2Fdd_util.h;h=4e1a945c57d4c31c76bf2986ece6062ca7aa53d0;hb=86cc8097266c2bd9d8a6ccc3d7f61391f13119be;hp=c217c8eed6826e24add96cec4bdf1fd905c93262;hpb=89f73827d03e28af548cc11247ebd6e2825789af;p=mesa.git diff --git a/src/gallium/drivers/ddebug/dd_util.h b/src/gallium/drivers/ddebug/dd_util.h index c217c8eed68..4e1a945c57d 100644 --- a/src/gallium/drivers/ddebug/dd_util.h +++ b/src/gallium/drivers/ddebug/dd_util.h @@ -33,6 +33,7 @@ #include #include +#include "c99_alloca.h" #include "os/os_process.h" #include "util/u_debug.h" @@ -40,7 +41,7 @@ #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]; @@ -65,7 +66,33 @@ dd_get_debug_file() 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 */