disassemble: look only for exact symbol matches for operands.
This commit is contained in:
parent
2924dee3a2
commit
7113fd2e50
|
@ -70,7 +70,7 @@ static void event_print(const struct event *e)
|
||||||
{
|
{
|
||||||
char name[128];
|
char name[128];
|
||||||
|
|
||||||
print_address(e->addr, name, sizeof(name));
|
print_address(e->addr, name, sizeof(name), 0);
|
||||||
printc(" %10" LLFMT ": ", e->when);
|
printc(" %10" LLFMT ": ", e->when);
|
||||||
|
|
||||||
switch (e->what) {
|
switch (e->what) {
|
||||||
|
|
|
@ -674,7 +674,7 @@ int cmd_break(char **arg)
|
||||||
if (bp->flags & DEVICE_BP_ENABLED) {
|
if (bp->flags & DEVICE_BP_ENABLED) {
|
||||||
char name[128];
|
char name[128];
|
||||||
|
|
||||||
print_address(bp->addr, name, sizeof(name));
|
print_address(bp->addr, name, sizeof(name), 0);
|
||||||
printc(" %d. %s", i, name);
|
printc(" %d. %s", i, name);
|
||||||
|
|
||||||
switch (bp->type) {
|
switch (bp->type) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void dump_session_data(powerbuf_t pb, unsigned int s,
|
||||||
idx = (idx + 1) % pb->max_samples;
|
idx = (idx + 1) % pb->max_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_address(mab, addr, sizeof(addr));
|
print_address(mab, addr, sizeof(addr), 0);
|
||||||
printc("%15d %15.01f %s\n", i * pb->interval_us,
|
printc("%15d %15.01f %s\n", i * pb->interval_us,
|
||||||
((double)ua_tot) / (double)gran, addr);
|
((double)ua_tot) / (double)gran, addr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -812,7 +812,7 @@ static void cgraph_summary(struct call_graph *graph)
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_address(n->offset, name, sizeof(name));
|
print_address(n->offset, name, sizeof(name), 0);
|
||||||
printc("0x%04x [%3d ==> %3d] %s\n",
|
printc("0x%04x [%3d ==> %3d] %s\n",
|
||||||
n->offset, to_count, from_count, name);
|
n->offset, to_count, from_count, name);
|
||||||
}
|
}
|
||||||
|
@ -845,7 +845,7 @@ static void cgraph_func_info(struct call_graph *graph, address_t addr)
|
||||||
CG_EDGE_TO(graph, k)->dst < n->offset)
|
CG_EDGE_TO(graph, k)->dst < n->offset)
|
||||||
k++;
|
k++;
|
||||||
|
|
||||||
print_address(n->offset, name, sizeof(name));
|
print_address(n->offset, name, sizeof(name), 0);
|
||||||
printc("0x%04x %s:\n", n->offset, name);
|
printc("0x%04x %s:\n", n->offset, name);
|
||||||
|
|
||||||
if (j < graph->edge_from.size &&
|
if (j < graph->edge_from.size &&
|
||||||
|
@ -857,7 +857,7 @@ static void cgraph_func_info(struct call_graph *graph, address_t addr)
|
||||||
if (e->src != n->offset)
|
if (e->src != n->offset)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
print_address(e->dst, name, sizeof(name));
|
print_address(e->dst, name, sizeof(name), 0);
|
||||||
printc(" %s%s\n",
|
printc(" %s%s\n",
|
||||||
e->is_tail_call ? "*" : "", name);
|
e->is_tail_call ? "*" : "", name);
|
||||||
|
|
||||||
|
@ -875,7 +875,7 @@ static void cgraph_func_info(struct call_graph *graph, address_t addr)
|
||||||
if (e->dst != n->offset)
|
if (e->dst != n->offset)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
print_address(e->src, name, sizeof(name));
|
print_address(e->src, name, sizeof(name), 0);
|
||||||
printc(" %s%s\n",
|
printc(" %s%s\n",
|
||||||
e->is_tail_call ? "*" : "", name);
|
e->is_tail_call ? "*" : "", name);
|
||||||
|
|
||||||
|
|
2
ui/sym.c
2
ui/sym.c
|
@ -44,7 +44,7 @@ int cmd_eval(char **arg)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_address(addr, name, sizeof(name));
|
print_address(addr, name, sizeof(name), 0);
|
||||||
printc("0x%05x = %s\n", addr, name);
|
printc("0x%05x = %s\n", addr, name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -51,7 +51,7 @@ static int format_addr(msp430_amode_t amode, address_t addr)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_address(addr, name, sizeof(name));
|
print_address(addr, name, sizeof(name), PRINT_ADDRESS_EXACT);
|
||||||
return printc("%s\x1b[1m%s\x1b[0m", prefix, name);
|
return printc("%s\x1b[1m%s\x1b[0m", prefix, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,8 @@ void disassemble(address_t offset, const uint8_t *data, int length,
|
||||||
(!stab_nearest(offset, obname, sizeof(obname), &oboff) &&
|
(!stab_nearest(offset, obname, sizeof(obname), &oboff) &&
|
||||||
!oboff)) {
|
!oboff)) {
|
||||||
char buffer[MAX_SYMBOL_LENGTH];
|
char buffer[MAX_SYMBOL_LENGTH];
|
||||||
print_address(offset, buffer, sizeof(buffer));
|
|
||||||
|
print_address(offset, buffer, sizeof(buffer), 0);
|
||||||
printc("\x1b[m%s\x1b[0m:\n", buffer);
|
printc("\x1b[m%s\x1b[0m:\n", buffer);
|
||||||
}
|
}
|
||||||
first_line = 0;
|
first_line = 0;
|
||||||
|
@ -284,22 +285,30 @@ void show_regs(const address_t *regs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int print_address(address_t addr, char *out, int max_len)
|
int print_address(address_t addr, char *out, int max_len,
|
||||||
|
print_address_flags_t f)
|
||||||
{
|
{
|
||||||
char name[MAX_SYMBOL_LENGTH];
|
char name[MAX_SYMBOL_LENGTH];
|
||||||
address_t offset;
|
address_t offset;
|
||||||
|
|
||||||
if (!stab_nearest(addr, name, sizeof(name), &offset)) {
|
if (!stab_nearest(addr, name, sizeof(name), &offset)) {
|
||||||
int len;
|
|
||||||
if (offset)
|
|
||||||
len = snprintf(out, max_len, "%s+0x%x", name, offset);
|
|
||||||
else
|
|
||||||
len = snprintf(out, max_len, "%s", name);
|
|
||||||
|
|
||||||
char demangled[MAX_SYMBOL_LENGTH];
|
char demangled[MAX_SYMBOL_LENGTH];
|
||||||
if (demangle(name, demangled, sizeof(demangled)) > 0) {
|
int len;
|
||||||
snprintf(out + len, max_len - len, " (%s)", demangled);
|
|
||||||
|
if (offset) {
|
||||||
|
if (f & PRINT_ADDRESS_EXACT) {
|
||||||
|
snprintf(out, max_len, "0x%04x", addr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = snprintf(out, max_len, "%s+0x%x", name, offset);
|
||||||
|
} else {
|
||||||
|
len = snprintf(out, max_len, "%s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (demangle(name, demangled, sizeof(demangled)) > 0)
|
||||||
|
snprintf(out + len, max_len - len, " (%s)", demangled);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,12 @@ void show_regs(const address_t *regs);
|
||||||
*
|
*
|
||||||
* Returns non-zero if the result is of the form sym+0x0offset.
|
* Returns non-zero if the result is of the form sym+0x0offset.
|
||||||
*/
|
*/
|
||||||
int print_address(address_t addr, char *buf, int max_len);
|
typedef enum {
|
||||||
|
PRINT_ADDRESS_EXACT = 0x01
|
||||||
|
} print_address_flags_t;
|
||||||
|
|
||||||
|
int print_address(address_t addr, char *buf, int max_len,
|
||||||
|
print_address_flags_t f);
|
||||||
|
|
||||||
/* Name lists. This function is used for printing multi-column sorted
|
/* Name lists. This function is used for printing multi-column sorted
|
||||||
* lists of constant strings. Expected is a vector of const char *.
|
* lists of constant strings. Expected is a vector of const char *.
|
||||||
|
|
Loading…
Reference in New Issue