/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy 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.
dnSpy 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 dnSpy. If not, see .
*/
using System;
using dnSpy.Contracts.Debugger.Code;
using dnSpy.Contracts.Documents;
namespace dnSpy.Contracts.Debugger.CallStack {
///
/// A stack frame in a debugged process
///
public abstract class DbgStackFrame : DbgObject {
///
/// Gets the process
///
public DbgProcess Process => Thread.Process;
///
/// Gets the runtime
///
public DbgRuntime Runtime => Thread.Runtime;
///
/// Gets the AppDomain or null if it's unknown
///
public DbgAppDomain? AppDomain => Module?.AppDomain ?? Thread.AppDomain;
///
/// Gets the thread
///
public abstract DbgThread Thread { get; }
///
/// Gets the location or null if none. Can be passed to
/// or can be used to create a breakpoint if you call
///
public abstract DbgCodeLocation? Location { get; }
///
/// Gets the module or null if it's unknown
///
public abstract DbgModule? Module { get; }
///
/// Gets the flags
///
public abstract DbgStackFrameFlags Flags { get; }
///
/// Gets the offset of the IP relative to the start of the function
///
public abstract uint FunctionOffset { get; }
///
/// Gets the function token or if it doesn't have a token.
///
public abstract uint FunctionToken { get; }
///
/// true if is valid
///
public bool HasFunctionToken => FunctionToken != uint.MaxValue;
///
/// Closes this instance
///
public void Close() => Thread.Process.DbgManager.Close(this);
}
///
/// Stack frame flags
///
[Flags]
public enum DbgStackFrameFlags {
///
/// No bit is set
///
None = 0,
///
/// Set if is the next statement to execute in this frame. It's also
/// possible to set a BP at that location.
///
/// It's false if is just an approximate location and it's not safe
/// to set a BP at the location.
///
LocationIsNextStatement = 0x00000001,
}
}