From 63dcc380266e80411e37bdb72fd6e0fad8c94072 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Thu, 13 Jan 1994 18:44:06 +0000 Subject: [PATCH] Add search to target vector (#if 0'd until after 4.12): * target.h (to_search, target_search): Add. * gdbcore.h, core.c (generic_search): Add. * remote.c (remote_search): Add. * a29k-tdep.c (init_frame_info): Use target_search to find traceback tag. --- gdb/ChangeLog | 7 +++++++ gdb/a29k-tdep.c | 12 +++++++++++- gdb/core.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5922aa9aa33..1c6866fa0d6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ Thu Jan 13 10:32:38 1994 Jim Kingdon (kingdon@lioth.cygnus.com) + Add search to target vector (#if 0'd until after 4.12): + * target.h (to_search, target_search): Add. + * gdbcore.h, core.c (generic_search): Add. + * remote.c (remote_search): Add. + * a29k-tdep.c (init_frame_info): Use target_search to find traceback + tag. + * printcmd.c (print_address_symbolic): If set print fast-symbolic-addr is on, call find_pc_function rather than relying just on the minimal symbols (probably only matters for symbol readers which don't put diff --git a/gdb/a29k-tdep.c b/gdb/a29k-tdep.c index a34b189c3df..7d02b8bcde4 100644 --- a/gdb/a29k-tdep.c +++ b/gdb/a29k-tdep.c @@ -418,10 +418,20 @@ init_frame_info (innermost_frame, fci) /* Search backward to find the trace-back tag. However, do not trace back beyond the start of the text segment (just as a sanity check to avoid going into never-never land). */ +#if 1 while (p >= text_start && ((insn = read_memory_integer (p, 4)) & TAGWORD_ZERO_MASK) != 0) p -= 4; - +#else /* 0 */ + char pat[4] = {0, 0, 0, 0}; + char mask[4]; + char insn_raw[4]; + store_unsigned_integer (mask, 4, TAGWORD_ZERO_MASK); + /* Enable this once target_search is enabled and tested. */ + target_search (4, pat, mask, p, -4, text_start, p+1, &p, &insn_raw); + insn = extract_unsigned_integer (insn_raw, 4); +#endif /* 0 */ + if (p < text_start) { /* Couldn't find the trace-back tag. diff --git a/gdb/core.c b/gdb/core.c index 9126d94ddb6..3d399f8fc4a 100644 --- a/gdb/core.c +++ b/gdb/core.c @@ -234,6 +234,46 @@ read_memory_unsigned_integer (memaddr, len) return extract_unsigned_integer (buf, len); } +#if 0 +/* Enable after 4.12. It is not tested. */ + +/* Search code. Targets can just make this their search function, or + if the protocol has a less general search function, they can call this + in the cases it can't handle. */ +void +generic_search (len, data, mask, startaddr, increment, lorange, hirange + addr_found, data_found) + int len; + char *data; + char *mask; + CORE_ADDR startaddr; + int increment; + CORE_ADDR lorange; + CORE_ADDR hirange; + CORE_ADDR *addr_found; + char *data_found; +{ + int i; + CORE_ADDR curaddr = startaddr; + + while (curaddr >= lorange && curaddr < hirange) + { + read_memory (curaddr, data_found, len); + for (i = 0; i < len; ++i) + if ((data_found[i] & mask[i]) != data[i]) + goto try_again; + /* It matches. */ + *addr_found = curaddr; + return; + + try_again: + curaddr += increment; + } + *addr_found = (CORE_ADDR)0; + return; +} +#endif /* 0 */ + /* The current default bfd target. Points to storage allocated for gnutarget_string. */ char *gnutarget; -- 2.30.2