mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 10:26:12 +00:00
overlay: Fix parsing of gem-objects for '[k]' clients
Apparently '[]' are not non-whitespace characters and break '%s'. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
fd772e32a2
commit
c5a6147a1b
@ -137,8 +137,11 @@ int gem_objects_update(struct gem_objects *obj)
|
|||||||
|
|
||||||
while (*b != '\n')
|
while (*b != '\n')
|
||||||
b--;
|
b--;
|
||||||
|
b++;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
char *eol, *colon;
|
||||||
|
|
||||||
comm = freed;
|
comm = freed;
|
||||||
if (comm)
|
if (comm)
|
||||||
freed = comm->next;
|
freed = comm->next;
|
||||||
@ -148,11 +151,23 @@ int gem_objects_update(struct gem_objects *obj)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* Xorg: 35 objects, 16347136 bytes (0 active, 12103680 inactive, 0 unbound) */
|
/* Xorg: 35 objects, 16347136 bytes (0 active, 12103680 inactive, 0 unbound) */
|
||||||
sscanf(++b, "%256s %lu objects, %lu bytes",
|
eol = strchr(b, '\n');
|
||||||
comm->name, &comm->count, &comm->bytes);
|
if (eol) {
|
||||||
|
do {
|
||||||
|
*eol++ = '\0';
|
||||||
|
} while (*eol == '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
colon = strchr(b, ':');
|
||||||
|
memcpy(comm->name, b, colon-b+1);
|
||||||
|
comm->name[colon-b+1] = '\0';
|
||||||
|
|
||||||
|
sscanf(colon + 1, "%lu objects, %lu bytes",
|
||||||
|
&comm->count, &comm->bytes);
|
||||||
|
|
||||||
insert_sorted(obj, comm);
|
insert_sorted(obj, comm);
|
||||||
} while ((b = strchr(b, '\n')) != NULL);
|
b = eol;
|
||||||
|
} while (b != NULL);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
while (freed) {
|
while (freed) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user