[binutils-gdb] RISC-V: Search for mapping symbols from the last one found
Nelson Chu
nelsonc1225@sourceware.org
Tue May 14 23:14:19 GMT 2024
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7a7ec56c811f5c12dde96418e514a419e9ef43d0
commit 7a7ec56c811f5c12dde96418e514a419e9ef43d0
Author: Joseph Faulls <Joseph.Faulls@imgtec.com>
Date: Wed May 15 06:59:58 2024 +0800
RISC-V: Search for mapping symbols from the last one found
With previous behaviour, multiple mapping symbols within the same
function would result in all the mapping symbols being searched.
This could slow down disassembly dramatically.
Multiple mapping symbols within a function can be a result of encoding
instructions as data, like sometimes seen in random instruction
generators.
opcodes/ChangeLog:
* riscv-dis.c (riscv_search_mapping_symbol): Use last mapping
symbol if it exists.
Diff:
---
opcodes/riscv-dis.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 684098d386a..e6596c47423 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -1076,11 +1076,9 @@ riscv_search_mapping_symbol (bfd_vma memaddr,
from_last_map_symbol = (last_map_symbol >= 0
&& info->stop_offset == last_stop_offset);
- /* Start scanning at the start of the function, or wherever
- we finished last time. */
- n = info->symtab_pos + 1;
- if (from_last_map_symbol && n >= last_map_symbol)
- n = last_map_symbol;
+ /* Start scanning from wherever we finished last time, or the start
+ of the function. */
+ n = from_last_map_symbol ? last_map_symbol : info->symtab_pos + 1;
/* Find the suitable mapping symbol to dump. */
for (; n < info->symtab_size; n++)
@@ -1105,9 +1103,7 @@ riscv_search_mapping_symbol (bfd_vma memaddr,
can pick up a text mapping symbol of a preceeding section. */
if (!found)
{
- n = info->symtab_pos;
- if (from_last_map_symbol && n >= last_map_symbol)
- n = last_map_symbol;
+ n = from_last_map_symbol ? last_map_symbol : info->symtab_pos;
for (; n >= 0; n--)
{
More information about the Binutils-cvs
mailing list