268a13a5a3
This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
438 lines
13 KiB
C
438 lines
13 KiB
C
/* Inline frame unwinder for GDB.
|
|
|
|
Copyright (C) 2008-2019 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include "defs.h"
|
|
#include "breakpoint.h"
|
|
#include "inline-frame.h"
|
|
#include "addrmap.h"
|
|
#include "block.h"
|
|
#include "frame-unwind.h"
|
|
#include "inferior.h"
|
|
#include "gdbthread.h"
|
|
#include "regcache.h"
|
|
#include "symtab.h"
|
|
#include "gdbsupport/vec.h"
|
|
#include "frame.h"
|
|
#include <algorithm>
|
|
|
|
/* We need to save a few variables for every thread stopped at the
|
|
virtual call site of an inlined function. If there was always a
|
|
"struct thread_info", we could hang it off that; in the mean time,
|
|
keep our own list. */
|
|
struct inline_state
|
|
{
|
|
inline_state (thread_info *thread_, int skipped_frames_, CORE_ADDR saved_pc_,
|
|
symbol *skipped_symbol_)
|
|
: thread (thread_), skipped_frames (skipped_frames_), saved_pc (saved_pc_),
|
|
skipped_symbol (skipped_symbol_)
|
|
{}
|
|
|
|
/* The thread this data relates to. It should be a currently
|
|
stopped thread. */
|
|
thread_info *thread;
|
|
|
|
/* The number of inlined functions we are skipping. Each of these
|
|
functions can be stepped in to. */
|
|
int skipped_frames;
|
|
|
|
/* Only valid if SKIPPED_FRAMES is non-zero. This is the PC used
|
|
when calculating SKIPPED_FRAMES; used to check whether we have
|
|
moved to a new location by user request. If so, we invalidate
|
|
any skipped frames. */
|
|
CORE_ADDR saved_pc;
|
|
|
|
/* Only valid if SKIPPED_FRAMES is non-zero. This is the symbol
|
|
of the outermost skipped inline function. It's used to find the
|
|
call site of the current frame. */
|
|
struct symbol *skipped_symbol;
|
|
};
|
|
|
|
static std::vector<inline_state> inline_states;
|
|
|
|
/* Locate saved inlined frame state for THREAD, if it exists and is
|
|
valid. */
|
|
|
|
static struct inline_state *
|
|
find_inline_frame_state (thread_info *thread)
|
|
{
|
|
auto state_it = std::find_if (inline_states.begin (), inline_states.end (),
|
|
[thread] (const inline_state &state)
|
|
{
|
|
return state.thread == thread;
|
|
});
|
|
|
|
if (state_it == inline_states.end ())
|
|
return nullptr;
|
|
|
|
inline_state &state = *state_it;
|
|
struct regcache *regcache = get_thread_regcache (thread);
|
|
CORE_ADDR current_pc = regcache_read_pc (regcache);
|
|
|
|
if (current_pc != state.saved_pc)
|
|
{
|
|
/* PC has changed - this context is invalid. Use the
|
|
default behavior. */
|
|
|
|
unordered_remove (inline_states, state_it);
|
|
return nullptr;
|
|
}
|
|
|
|
return &state;
|
|
}
|
|
|
|
/* Forget about any hidden inlined functions in PTID, which is new or
|
|
about to be resumed. PTID may be minus_one_ptid (all processes)
|
|
or a PID (all threads in this process). */
|
|
|
|
void
|
|
clear_inline_frame_state (ptid_t ptid)
|
|
{
|
|
if (ptid == minus_one_ptid)
|
|
{
|
|
inline_states.clear ();
|
|
return;
|
|
}
|
|
|
|
if (ptid.is_pid ())
|
|
{
|
|
int pid = ptid.pid ();
|
|
auto it = std::remove_if (inline_states.begin (), inline_states.end (),
|
|
[pid] (const inline_state &state)
|
|
{
|
|
return pid == state.thread->inf->pid;
|
|
});
|
|
|
|
inline_states.erase (it, inline_states.end ());
|
|
|
|
return;
|
|
}
|
|
|
|
auto it = std::find_if (inline_states.begin (), inline_states.end (),
|
|
[&ptid] (const inline_state &state)
|
|
{
|
|
return ptid == state.thread->ptid;
|
|
});
|
|
|
|
if (it != inline_states.end ())
|
|
unordered_remove (inline_states, it);
|
|
}
|
|
|
|
static void
|
|
inline_frame_this_id (struct frame_info *this_frame,
|
|
void **this_cache,
|
|
struct frame_id *this_id)
|
|
{
|
|
struct symbol *func;
|
|
|
|
/* In order to have a stable frame ID for a given inline function,
|
|
we must get the stack / special addresses from the underlying
|
|
real frame's this_id method. So we must call
|
|
get_prev_frame_always. Because we are inlined into some
|
|
function, there must be previous frames, so this is safe - as
|
|
long as we're careful not to create any cycles. */
|
|
*this_id = get_frame_id (get_prev_frame_always (this_frame));
|
|
|
|
/* We need a valid frame ID, so we need to be based on a valid
|
|
frame. FSF submission NOTE: this would be a good assertion to
|
|
apply to all frames, all the time. That would fix the ambiguity
|
|
of null_frame_id (between "no/any frame" and "the outermost
|
|
frame"). This will take work. */
|
|
gdb_assert (frame_id_p (*this_id));
|
|
|
|
/* For now, require we don't match outer_frame_id either (see
|
|
comment above). */
|
|
gdb_assert (!frame_id_eq (*this_id, outer_frame_id));
|
|
|
|
/* Future work NOTE: Alexandre Oliva applied a patch to GCC 4.3
|
|
which generates DW_AT_entry_pc for inlined functions when
|
|
possible. If this attribute is available, we should use it
|
|
in the frame ID (and eventually, to set breakpoints). */
|
|
func = get_frame_function (this_frame);
|
|
gdb_assert (func != NULL);
|
|
(*this_id).code_addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func));
|
|
(*this_id).artificial_depth++;
|
|
}
|
|
|
|
static struct value *
|
|
inline_frame_prev_register (struct frame_info *this_frame, void **this_cache,
|
|
int regnum)
|
|
{
|
|
/* Use get_frame_register_value instead of
|
|
frame_unwind_got_register, to avoid requiring this frame's ID.
|
|
This frame's ID depends on the previous frame's ID (unusual), and
|
|
the previous frame's ID depends on this frame's unwound
|
|
registers. If unwinding registers from this frame called
|
|
get_frame_id, there would be a loop.
|
|
|
|
Do not copy this code into any other unwinder! Inlined functions
|
|
are special; other unwinders must not have a dependency on the
|
|
previous frame's ID, and therefore can and should use
|
|
frame_unwind_got_register instead. */
|
|
return get_frame_register_value (this_frame, regnum);
|
|
}
|
|
|
|
/* Check whether we are at an inlining site that does not already
|
|
have an associated frame. */
|
|
|
|
static int
|
|
inline_frame_sniffer (const struct frame_unwind *self,
|
|
struct frame_info *this_frame,
|
|
void **this_cache)
|
|
{
|
|
CORE_ADDR this_pc;
|
|
const struct block *frame_block, *cur_block;
|
|
int depth;
|
|
struct frame_info *next_frame;
|
|
struct inline_state *state = find_inline_frame_state (inferior_thread ());
|
|
|
|
this_pc = get_frame_address_in_block (this_frame);
|
|
frame_block = block_for_pc (this_pc);
|
|
if (frame_block == NULL)
|
|
return 0;
|
|
|
|
/* Calculate DEPTH, the number of inlined functions at this
|
|
location. */
|
|
depth = 0;
|
|
cur_block = frame_block;
|
|
while (BLOCK_SUPERBLOCK (cur_block))
|
|
{
|
|
if (block_inlined_p (cur_block))
|
|
depth++;
|
|
else if (BLOCK_FUNCTION (cur_block) != NULL)
|
|
break;
|
|
|
|
cur_block = BLOCK_SUPERBLOCK (cur_block);
|
|
}
|
|
|
|
/* Check how many inlined functions already have frames. */
|
|
for (next_frame = get_next_frame (this_frame);
|
|
next_frame && get_frame_type (next_frame) == INLINE_FRAME;
|
|
next_frame = get_next_frame (next_frame))
|
|
{
|
|
gdb_assert (depth > 0);
|
|
depth--;
|
|
}
|
|
|
|
/* If this is the topmost frame, or all frames above us are inlined,
|
|
then check whether we were requested to skip some frames (so they
|
|
can be stepped into later). */
|
|
if (state != NULL && state->skipped_frames > 0 && next_frame == NULL)
|
|
{
|
|
gdb_assert (depth >= state->skipped_frames);
|
|
depth -= state->skipped_frames;
|
|
}
|
|
|
|
/* If all the inlined functions here already have frames, then pass
|
|
to the normal unwinder for this PC. */
|
|
if (depth == 0)
|
|
return 0;
|
|
|
|
/* If the next frame is an inlined function, but not the outermost, then
|
|
we are the next outer. If it is not an inlined function, then we
|
|
are the innermost inlined function of a different real frame. */
|
|
return 1;
|
|
}
|
|
|
|
const struct frame_unwind inline_frame_unwind = {
|
|
INLINE_FRAME,
|
|
default_frame_unwind_stop_reason,
|
|
inline_frame_this_id,
|
|
inline_frame_prev_register,
|
|
NULL,
|
|
inline_frame_sniffer
|
|
};
|
|
|
|
/* Return non-zero if BLOCK, an inlined function block containing PC,
|
|
has a group of contiguous instructions starting at PC (but not
|
|
before it). */
|
|
|
|
static int
|
|
block_starting_point_at (CORE_ADDR pc, const struct block *block)
|
|
{
|
|
const struct blockvector *bv;
|
|
const struct block *new_block;
|
|
|
|
bv = blockvector_for_pc (pc, NULL);
|
|
if (BLOCKVECTOR_MAP (bv) == NULL)
|
|
return 0;
|
|
|
|
new_block = (const struct block *) addrmap_find (BLOCKVECTOR_MAP (bv),
|
|
pc - 1);
|
|
if (new_block == NULL)
|
|
return 1;
|
|
|
|
if (new_block == block || contained_in (new_block, block))
|
|
return 0;
|
|
|
|
/* The immediately preceding address belongs to a different block,
|
|
which is not a child of this one. Treat this as an entrance into
|
|
BLOCK. */
|
|
return 1;
|
|
}
|
|
|
|
/* Loop over the stop chain and determine if execution stopped in an
|
|
inlined frame because of a user breakpoint set at FRAME_BLOCK. */
|
|
|
|
static bool
|
|
stopped_by_user_bp_inline_frame (const block *frame_block, bpstat stop_chain)
|
|
{
|
|
for (bpstat s = stop_chain; s != NULL; s = s->next)
|
|
{
|
|
struct breakpoint *bpt = s->breakpoint_at;
|
|
|
|
if (bpt != NULL && user_breakpoint_p (bpt))
|
|
{
|
|
bp_location *loc = s->bp_location_at;
|
|
enum bp_loc_type t = loc->loc_type;
|
|
|
|
if (t == bp_loc_software_breakpoint
|
|
|| t == bp_loc_hardware_breakpoint)
|
|
{
|
|
/* If the location has a function symbol, check whether
|
|
the frame was for that inlined function. If it has
|
|
no function symbol, then assume it is. I.e., default
|
|
to presenting the stop at the innermost inline
|
|
function. */
|
|
if (loc->symbol == nullptr
|
|
|| frame_block == SYMBOL_BLOCK_VALUE (loc->symbol))
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/* See inline-frame.h. */
|
|
|
|
void
|
|
skip_inline_frames (thread_info *thread, bpstat stop_chain)
|
|
{
|
|
const struct block *frame_block, *cur_block;
|
|
struct symbol *last_sym = NULL;
|
|
int skip_count = 0;
|
|
|
|
/* This function is called right after reinitializing the frame
|
|
cache. We try not to do more unwinding than absolutely
|
|
necessary, for performance. */
|
|
CORE_ADDR this_pc = get_frame_pc (get_current_frame ());
|
|
frame_block = block_for_pc (this_pc);
|
|
|
|
if (frame_block != NULL)
|
|
{
|
|
cur_block = frame_block;
|
|
while (BLOCK_SUPERBLOCK (cur_block))
|
|
{
|
|
if (block_inlined_p (cur_block))
|
|
{
|
|
/* See comments in inline_frame_this_id about this use
|
|
of BLOCK_ENTRY_PC. */
|
|
if (BLOCK_ENTRY_PC (cur_block) == this_pc
|
|
|| block_starting_point_at (this_pc, cur_block))
|
|
{
|
|
/* Do not skip the inlined frame if execution
|
|
stopped in an inlined frame because of a user
|
|
breakpoint for this inline function. */
|
|
if (stopped_by_user_bp_inline_frame (cur_block, stop_chain))
|
|
break;
|
|
|
|
skip_count++;
|
|
last_sym = BLOCK_FUNCTION (cur_block);
|
|
}
|
|
else
|
|
break;
|
|
}
|
|
else if (BLOCK_FUNCTION (cur_block) != NULL)
|
|
break;
|
|
|
|
cur_block = BLOCK_SUPERBLOCK (cur_block);
|
|
}
|
|
}
|
|
|
|
gdb_assert (find_inline_frame_state (thread) == NULL);
|
|
inline_states.emplace_back (thread, skip_count, this_pc, last_sym);
|
|
|
|
if (skip_count != 0)
|
|
reinit_frame_cache ();
|
|
}
|
|
|
|
/* Step into an inlined function by unhiding it. */
|
|
|
|
void
|
|
step_into_inline_frame (thread_info *thread)
|
|
{
|
|
inline_state *state = find_inline_frame_state (thread);
|
|
|
|
gdb_assert (state != NULL && state->skipped_frames > 0);
|
|
state->skipped_frames--;
|
|
reinit_frame_cache ();
|
|
}
|
|
|
|
/* Return the number of hidden functions inlined into the current
|
|
frame. */
|
|
|
|
int
|
|
inline_skipped_frames (thread_info *thread)
|
|
{
|
|
inline_state *state = find_inline_frame_state (thread);
|
|
|
|
if (state == NULL)
|
|
return 0;
|
|
else
|
|
return state->skipped_frames;
|
|
}
|
|
|
|
/* If one or more inlined functions are hidden, return the symbol for
|
|
the function inlined into the current frame. */
|
|
|
|
struct symbol *
|
|
inline_skipped_symbol (thread_info *thread)
|
|
{
|
|
inline_state *state = find_inline_frame_state (thread);
|
|
|
|
gdb_assert (state != NULL);
|
|
return state->skipped_symbol;
|
|
}
|
|
|
|
/* Return the number of functions inlined into THIS_FRAME. Some of
|
|
the callees may not have associated frames (see
|
|
skip_inline_frames). */
|
|
|
|
int
|
|
frame_inlined_callees (struct frame_info *this_frame)
|
|
{
|
|
struct frame_info *next_frame;
|
|
int inline_count = 0;
|
|
|
|
/* First count how many inlined functions at this PC have frames
|
|
above FRAME (are inlined into FRAME). */
|
|
for (next_frame = get_next_frame (this_frame);
|
|
next_frame && get_frame_type (next_frame) == INLINE_FRAME;
|
|
next_frame = get_next_frame (next_frame))
|
|
inline_count++;
|
|
|
|
/* Simulate some most-inner inlined frames which were suppressed, so
|
|
they can be stepped into later. If we are unwinding already
|
|
outer frames from some non-inlined frame this does not apply. */
|
|
if (next_frame == NULL)
|
|
inline_count += inline_skipped_frames (inferior_thread ());
|
|
|
|
return inline_count;
|
|
}
|