mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-07-26 03:07:24 +00:00
lib/igt_core: don't add newlines in logging functions
igt_kms extensively uses line continuation when dumping state updates at the debug level. They got badly mangled with the recent changes to for the log handling functions. Two separate fixes: - Don't prepend domain and other metainformation when it's just a continuation line. - Dont add newlines when dumping the log recorder. If someone interleaves different log level messages this will go awry, but really just don't do that. Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
parent
305fb1db5c
commit
f45698df8b
@ -290,8 +290,7 @@ static void _igt_log_buffer_dump(void)
|
|||||||
i = log_buffer.start;
|
i = log_buffer.start;
|
||||||
do {
|
do {
|
||||||
char *last_line = log_buffer.entries[i];
|
char *last_line = log_buffer.entries[i];
|
||||||
fprintf(stderr, "%s%s", last_line,
|
fprintf(stderr, "%s", last_line);
|
||||||
(last_line[strlen(last_line)-1] != '\n') ? "\n" : "");
|
|
||||||
i++;
|
i++;
|
||||||
} while (i != log_buffer.start && i != log_buffer.end);
|
} while (i != log_buffer.start && i != log_buffer.end);
|
||||||
|
|
||||||
@ -1590,6 +1589,7 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
|
|||||||
"CRITICAL",
|
"CRITICAL",
|
||||||
"NONE"
|
"NONE"
|
||||||
};
|
};
|
||||||
|
static bool line_continuation = false;
|
||||||
|
|
||||||
assert(format);
|
assert(format);
|
||||||
|
|
||||||
@ -1605,12 +1605,18 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
|
|||||||
if (vasprintf(&line, format, args) == -1)
|
if (vasprintf(&line, format, args) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (asprintf(&formatted_line, "(%s:%d) %s%s%s: %s", program_name,
|
if (line_continuation) {
|
||||||
|
formatted_line = strdup(line);
|
||||||
|
if (!formatted_line)
|
||||||
|
goto out;
|
||||||
|
} else if (asprintf(&formatted_line, "(%s:%d) %s%s%s: %s", program_name,
|
||||||
getpid(), (domain) ? domain : "", (domain) ? "-" : "",
|
getpid(), (domain) ? domain : "", (domain) ? "-" : "",
|
||||||
igt_log_level_str[level], line) == -1) {
|
igt_log_level_str[level], line) == -1) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line_continuation = line[strlen(line)] != '\n';
|
||||||
|
|
||||||
/* append log buffer */
|
/* append log buffer */
|
||||||
_igt_log_buffer_append(formatted_line);
|
_igt_log_buffer_append(formatted_line);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user