summaryrefslogtreecommitdiffhomepage
path: root/dev/LibDebugger/NeKernelContract.h
blob: 8e54ab2c385a742c2111a968ca3614ecb8fb9842 (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
59
60
61
62
63

/***
  (C) 2025 Amlal El Mahrouss
 */

#ifndef LD_NEKERNEL_CONTRACT_H
#define LD_NEKERNEL_CONTRACT_H

#include <LibDebugger/DebuggerContract.h>

#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>

#define kDebugUnboundPort 0x0FEED

#define kDebugMag0 'K'
#define kDebugMag1 'D'
#define kDebugMag2 'B'
#define kDebugMag3 'G'

#define kDebugSourceFile 23
#define kDebugLine 33
#define kDebugTeam 43
#define kDebugEOP 49

namespace LibDebugger::NeKernel {
class NeKernelContract;

namespace Detail {
  class NeKernelPortHeader;

  inline constexpr size_t kDebugTypeLen = 256U;

  typedef char rt_debug_type[kDebugTypeLen];

  class NeKernelPortHeader final {
   public:
    int16_t fPort;
    int16_t fPortBsy;
  };
}  // namespace Detail

class NeKernelContract : public DebuggerContract {
 public:
  NeKernelContract();
  virtual ~NeKernelContract();

  // Override additional methods from DebuggerContract
  virtual bool Attach(std::string path, std::string argv, ProcessID& pid) noexcept override;
  virtual bool Breakpoint(std::string symbol) noexcept override;
  virtual bool Break() noexcept override;
  virtual bool Continue() noexcept override;
  virtual bool Detach() noexcept override;

 private:
  std::string m_ip_address;
  std::string m_port;
};
}  // namespace LibDebugger::NeKernel

#endif  // LD_NEKERNEL_CONTRACT_H