mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The one place where we deviate is header include order since Zeek depends on headers being included in a certain order.
This commit is contained in:
parent
7b8e7ed72c
commit
f5a76c1aed
786 changed files with 131714 additions and 153609 deletions
142
src/Debug.h
142
src/Debug.h
|
@ -11,17 +11,16 @@
|
|||
#include "zeek/StmtEnums.h"
|
||||
#include "zeek/util.h"
|
||||
|
||||
namespace zeek
|
||||
{
|
||||
namespace zeek {
|
||||
|
||||
class Val;
|
||||
template <class T> class IntrusivePtr;
|
||||
template<class T>
|
||||
class IntrusivePtr;
|
||||
using ValPtr = zeek::IntrusivePtr<Val>;
|
||||
|
||||
extern std::string current_module;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
namespace detail {
|
||||
|
||||
class Frame;
|
||||
class Stmt;
|
||||
|
@ -30,20 +29,14 @@ class DbgWatch;
|
|||
class DbgDisplay;
|
||||
|
||||
// This needs to be defined before we do the includes that come after it.
|
||||
enum ParseLocationRecType
|
||||
{
|
||||
PLR_UNKNOWN,
|
||||
PLR_FILE_AND_LINE,
|
||||
PLR_FUNCTION
|
||||
};
|
||||
class ParseLocationRec
|
||||
{
|
||||
enum ParseLocationRecType { PLR_UNKNOWN, PLR_FILE_AND_LINE, PLR_FUNCTION };
|
||||
class ParseLocationRec {
|
||||
public:
|
||||
ParseLocationRecType type;
|
||||
int32_t line;
|
||||
Stmt* stmt;
|
||||
const char* filename;
|
||||
};
|
||||
ParseLocationRecType type;
|
||||
int32_t line;
|
||||
Stmt* stmt;
|
||||
const char* filename;
|
||||
};
|
||||
|
||||
class StmtLocMapping;
|
||||
using Filemap = std::deque<StmtLocMapping*>; // mapping for a single file
|
||||
|
@ -51,94 +44,89 @@ using Filemap = std::deque<StmtLocMapping*>; // mapping for a single file
|
|||
using BPIDMapType = std::map<int, DbgBreakpoint*>;
|
||||
using BPMapType = std::multimap<const Stmt*, DbgBreakpoint*>;
|
||||
|
||||
class TraceState
|
||||
{
|
||||
class TraceState {
|
||||
public:
|
||||
TraceState()
|
||||
{
|
||||
dbgtrace = false;
|
||||
trace_file = stderr;
|
||||
}
|
||||
TraceState() {
|
||||
dbgtrace = false;
|
||||
trace_file = stderr;
|
||||
}
|
||||
|
||||
// Returns previous filename.
|
||||
FILE* SetTraceFile(const char* trace_filename);
|
||||
// Returns previous filename.
|
||||
FILE* SetTraceFile(const char* trace_filename);
|
||||
|
||||
bool DoTrace() const { return dbgtrace; }
|
||||
void TraceOn();
|
||||
void TraceOff();
|
||||
bool DoTrace() const { return dbgtrace; }
|
||||
void TraceOn();
|
||||
void TraceOff();
|
||||
|
||||
int LogTrace(const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
;
|
||||
int LogTrace(const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
;
|
||||
|
||||
protected:
|
||||
bool dbgtrace; // print an execution trace
|
||||
FILE* trace_file;
|
||||
};
|
||||
bool dbgtrace; // print an execution trace
|
||||
FILE* trace_file;
|
||||
};
|
||||
|
||||
extern TraceState g_trace_state;
|
||||
|
||||
class DebuggerState
|
||||
{
|
||||
class DebuggerState {
|
||||
public:
|
||||
DebuggerState();
|
||||
~DebuggerState();
|
||||
DebuggerState();
|
||||
~DebuggerState();
|
||||
|
||||
int NextBPID() { return next_bp_id++; }
|
||||
int NextWatchID() { return next_watch_id++; }
|
||||
int NextDisplayID() { return next_display_id++; }
|
||||
int NextBPID() { return next_bp_id++; }
|
||||
int NextWatchID() { return next_watch_id++; }
|
||||
int NextDisplayID() { return next_display_id++; }
|
||||
|
||||
bool BreakBeforeNextStmt() { return break_before_next_stmt; }
|
||||
void BreakBeforeNextStmt(bool dobrk) { break_before_next_stmt = dobrk; }
|
||||
bool BreakBeforeNextStmt() { return break_before_next_stmt; }
|
||||
void BreakBeforeNextStmt(bool dobrk) { break_before_next_stmt = dobrk; }
|
||||
|
||||
bool BreakFromSignal() { return break_from_signal; }
|
||||
void BreakFromSignal(bool dobrk) { break_from_signal = dobrk; }
|
||||
bool BreakFromSignal() { return break_from_signal; }
|
||||
void BreakFromSignal(bool dobrk) { break_from_signal = dobrk; }
|
||||
|
||||
// Temporary state: vanishes when execution resumes.
|
||||
// Temporary state: vanishes when execution resumes.
|
||||
|
||||
//### Umesh, why do these all need to be public? -- Vern
|
||||
//### Umesh, why do these all need to be public? -- Vern
|
||||
|
||||
// Which frame we're looking at; 0 = the innermost frame.
|
||||
int curr_frame_idx;
|
||||
// Which frame we're looking at; 0 = the innermost frame.
|
||||
int curr_frame_idx;
|
||||
|
||||
bool already_did_list; // did we already do a 'list' command?
|
||||
bool already_did_list; // did we already do a 'list' command?
|
||||
|
||||
Location last_loc; // used by 'list'; the last location listed
|
||||
Location last_loc; // used by 'list'; the last location listed
|
||||
|
||||
BPIDMapType breakpoints; // BPID -> Breakpoint
|
||||
std::vector<DbgWatch*> watches;
|
||||
std::vector<DbgDisplay*> displays;
|
||||
BPMapType breakpoint_map; // maps Stmt -> Breakpoints on it
|
||||
BPIDMapType breakpoints; // BPID -> Breakpoint
|
||||
std::vector<DbgWatch*> watches;
|
||||
std::vector<DbgDisplay*> displays;
|
||||
BPMapType breakpoint_map; // maps Stmt -> Breakpoints on it
|
||||
|
||||
protected:
|
||||
bool break_before_next_stmt; // trap into debugger (used for "step")
|
||||
bool break_from_signal; // was break caused by a signal?
|
||||
bool break_before_next_stmt; // trap into debugger (used for "step")
|
||||
bool break_from_signal; // was break caused by a signal?
|
||||
|
||||
int next_bp_id, next_watch_id, next_display_id;
|
||||
int next_bp_id, next_watch_id, next_display_id;
|
||||
|
||||
private:
|
||||
Frame* dbg_locals; // unused
|
||||
};
|
||||
Frame* dbg_locals; // unused
|
||||
};
|
||||
|
||||
// Source line -> statement mapping.
|
||||
// (obj -> source line mapping available in object itself)
|
||||
class StmtLocMapping
|
||||
{
|
||||
class StmtLocMapping {
|
||||
public:
|
||||
StmtLocMapping() { }
|
||||
StmtLocMapping(const Location* l, Stmt* s)
|
||||
{
|
||||
loc = *l;
|
||||
stmt = s;
|
||||
}
|
||||
StmtLocMapping() {}
|
||||
StmtLocMapping(const Location* l, Stmt* s) {
|
||||
loc = *l;
|
||||
stmt = s;
|
||||
}
|
||||
|
||||
bool StartsAfter(const StmtLocMapping* m2);
|
||||
const Location& Loc() const { return loc; }
|
||||
Stmt* Statement() const { return stmt; }
|
||||
bool StartsAfter(const StmtLocMapping* m2);
|
||||
const Location& Loc() const { return loc; }
|
||||
Stmt* Statement() const { return stmt; }
|
||||
|
||||
protected:
|
||||
Location loc;
|
||||
Stmt* stmt = nullptr;
|
||||
};
|
||||
Location loc;
|
||||
Stmt* stmt = nullptr;
|
||||
};
|
||||
|
||||
extern bool g_policy_debug; // enable debugging facility
|
||||
extern DebuggerState g_debugger_state;
|
||||
|
@ -195,5 +183,5 @@ extern std::map<std::string, Filemap*> g_dbgfilemaps; // filename => filemap
|
|||
// Perhaps add a code/priority argument to do selective output.
|
||||
int debug_msg(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
||||
} // namespace detail
|
||||
} // namespace zeek
|
||||
} // namespace detail
|
||||
} // namespace zeek
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue