mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 10:26:12 +00:00
intel_reg_dumper: Allow partial register names on the command line
Let people give just a part of the register name. Handy when not remembering the exact name or if the register is defined with a different name than the one in the spec being looked at. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
763d22cbf8
commit
62a026eac5
@ -26,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -1982,39 +1983,29 @@ static struct {
|
|||||||
};
|
};
|
||||||
#undef DECLARE_REGS
|
#undef DECLARE_REGS
|
||||||
|
|
||||||
static struct reg_debug *
|
static void
|
||||||
find_register_by_name(struct reg_debug *regs, int count,
|
str_to_upper(char *str)
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
int i;
|
while(*str) {
|
||||||
|
*str = toupper(*str);
|
||||||
for (i = 0; i < count; i++)
|
str++;
|
||||||
if (strcasecmp(name, regs[i].name) == 0)
|
}
|
||||||
return ®s[i];
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
decode_register_name(const char *name, uint32_t val)
|
decode_register_name(char *name, uint32_t val)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
struct reg_debug *reg = NULL;
|
|
||||||
|
str_to_upper(name);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(known_registers); i++) {
|
for (i = 0; i < ARRAY_SIZE(known_registers); i++) {
|
||||||
reg = find_register_by_name(known_registers[i].regs,
|
struct reg_debug *regs = known_registers[i].regs;
|
||||||
known_registers[i].count,
|
|
||||||
name);
|
|
||||||
if (reg)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reg) {
|
for (j = 0; j < known_registers[i].count; j++)
|
||||||
fprintf(stderr, "Unknown register: %s\n", name);
|
if (strstr(regs[j].name, name))
|
||||||
return;
|
_intel_dump_reg(®s[j], val);
|
||||||
}
|
}
|
||||||
|
|
||||||
_intel_dump_reg(reg, val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2032,7 +2023,7 @@ decode_register_address(int address, uint32_t val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
decode_register(const char *name, uint32_t val)
|
decode_register(char *name, uint32_t val)
|
||||||
{
|
{
|
||||||
long int address;
|
long int address;
|
||||||
char *end;
|
char *end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user