summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/KernelKit/TraceSrv.h
blob: 9786cc6e548f032cea03ea52c0bc54228e958b8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel

#ifndef KERNELKIT_TRACESRV_H
#define KERNELKIT_TRACESRV_H

#include <CompilerKit/CompilerKit.h>

namespace Kernel {

namespace TraceSrv {

  inline constexpr auto kDebugCmdLen  = 256U;
  inline constexpr auto kDebugPort    = 51820;
  inline constexpr auto kDebugMagic   = "NE1.0.0;";
  inline constexpr auto kDebugVersion = 0x0100;
  inline constexpr auto kDebugDelim   = ';';
  inline constexpr auto kDebugEnd     = '\r';

  enum class TRACE_SOURCE_OPCODE {
    kStop,
    kContinue,
    kStepIn,
    kStepOver,
    kStepOut,
    kSetBreakpoint,
    kRemoveBreakpoint,
    kGetStackTrace,
    kGetSourceMessage,
    kGetVariables,
    kEvaluateExpression,
    kUnknown
  };

  inline constexpr auto kDebugSymbolLen = 0x0100;

  struct TRACE_SOURCE_MESSAGE final {
    Int32  fType;
    Int32  fChksum;
    Char   fSymbol[kDebugSymbolLen];
    UInt32 fOffset;
    UInt32 fOpcode;
  };

  struct TRACE_STRING_MESSAGE final {
    Int32 fType;
    Int32 fChksum;
    Int32 fLevel;
    Int32 fLength;
    Char  fMessage[kDebugCmdLen];
  };

}  // namespace TraceSrv

}  // namespace Kernel

#endif  // !KERNELKIT_TRACESRV_H