From ad2f85d6e1407cad7b8c13aada1a38fb4ae0f3b7 Mon Sep 17 00:00:00 2001
From: acite <1498045907@qq.com>
Date: Mon, 24 Feb 2025 20:27:28 +0800
Subject: [PATCH] None
---
.idea/editor.xml | 580 ++++++++++++++++
.idea/vcs.xml | 6 +
CMakeLists.txt | 23 +-
aldbg.glade | 850 -----------------------
aldbg.ui | 676 ++++++++++++++++++
core/Core.hpp | 964 ++++++++++++++++++++++++++
core/MemoryMap.hpp | 133 ++++
core/attach.cpp | 26 -
core/core.cpp | 4 -
cpu/cpu.cpp | 39 --
cpu/cpu.h | 20 -
interface/callstack/CallstackView.hpp | 272 ++++++++
interface/cpu/CPUView.hpp | 358 ++++++++++
interface/cpu/RegView.hpp | 32 +
interface/cpu/SymbolMenu.hpp | 79 +++
interface/editor/EditorView.hpp | 225 ++++++
interface/home.hpp | 490 +++++++++++++
interface/icon/arrow-restart.png | Bin 0 -> 803 bytes
interface/icon/arrow-run-cursor.png | Bin 0 -> 665 bytes
interface/icon/arrow-run.png | Bin 0 -> 525 bytes
interface/icon/arrow-skip.png | Bin 0 -> 611 bytes
interface/icon/arrow-small-down.png | Bin 0 -> 494 bytes
interface/icon/arrow-small-up.png | Bin 0 -> 503 bytes
interface/icon/arrow-step-into.png | Bin 0 -> 587 bytes
interface/icon/arrow-step-over.png | Bin 0 -> 750 bytes
interface/icon/arrow-step-rtr.png | Bin 0 -> 577 bytes
interface/icon/arrow-threads.png | Bin 0 -> 710 bytes
interface/icon/close-all-tabs.png | Bin 0 -> 544 bytes
interface/icon/control-pause.png | Bin 0 -> 378 bytes
interface/icon/control-stop.png | Bin 0 -> 365 bytes
interface/log/LogView.hpp | 46 ++
interface/memory/MemoryView.hpp | 57 ++
interface/style.css | 20 +
log/log.cpp | 33 -
log/log.h | 12 -
main.cpp | 127 +---
36 files changed, 3981 insertions(+), 1091 deletions(-)
create mode 100644 .idea/editor.xml
create mode 100644 .idea/vcs.xml
delete mode 100644 aldbg.glade
create mode 100644 aldbg.ui
create mode 100644 core/Core.hpp
create mode 100644 core/MemoryMap.hpp
delete mode 100644 core/attach.cpp
delete mode 100644 core/core.cpp
delete mode 100644 cpu/cpu.cpp
delete mode 100644 cpu/cpu.h
create mode 100644 interface/callstack/CallstackView.hpp
create mode 100644 interface/cpu/CPUView.hpp
create mode 100644 interface/cpu/RegView.hpp
create mode 100644 interface/cpu/SymbolMenu.hpp
create mode 100644 interface/editor/EditorView.hpp
create mode 100644 interface/home.hpp
create mode 100644 interface/icon/arrow-restart.png
create mode 100644 interface/icon/arrow-run-cursor.png
create mode 100644 interface/icon/arrow-run.png
create mode 100644 interface/icon/arrow-skip.png
create mode 100644 interface/icon/arrow-small-down.png
create mode 100644 interface/icon/arrow-small-up.png
create mode 100644 interface/icon/arrow-step-into.png
create mode 100644 interface/icon/arrow-step-over.png
create mode 100644 interface/icon/arrow-step-rtr.png
create mode 100644 interface/icon/arrow-threads.png
create mode 100644 interface/icon/close-all-tabs.png
create mode 100644 interface/icon/control-pause.png
create mode 100644 interface/icon/control-stop.png
create mode 100644 interface/log/LogView.hpp
create mode 100644 interface/memory/MemoryView.hpp
create mode 100644 interface/style.css
delete mode 100644 log/log.cpp
delete mode 100644 log/log.h
diff --git a/.idea/editor.xml b/.idea/editor.xml
new file mode 100644
index 0000000..1f0ef49
--- /dev/null
+++ b/.idea/editor.xml
@@ -0,0 +1,580 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50886d1..5438426 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,17 +1,30 @@
cmake_minimum_required(VERSION 3.28)
project(aldbg)
-set(CMAKE_CXX_STANDARD 20)
+set(CMAKE_CXX_STANDARD 23)
include_directories(.)
+add_compile_options(-Og)
+
find_package(PkgConfig)
-pkg_check_modules(GTKMM gtkmm-3.0)
+pkg_check_modules(GTKMM gtkmm-4.0)
include_directories(${GTKMM_INCLUDE_DIRS})
link_directories(${GTKMM_LIBRARY_DIRS})
+add_definitions(${GTKMM_CFLAGS_OTHER})
-add_executable(aldbg
- main.cpp cpu/cpu.cpp core/attach.cpp core/core.cpp log/log.cpp)
+pkg_check_modules(CAPSTONE capstone)
-target_link_libraries(aldbg ${GTKMM_LIBRARIES})
\ No newline at end of file
+include_directories(${CAPSTONE_INCLUDE_DIRS})
+link_directories(${CAPSTONE_LIBRARY_DIRS})
+add_definitions(${CAPSTONE_CFLAGS_OTHER})
+
+pkg_check_modules(ELFPP libelf++)
+include_directories(${ELFPP_INCLUDE_DIRS})
+link_directories(${ELFPP_LIBRARY_DIRS})
+add_definitions(${ELFPP_CFLAGS_OTHER})
+
+add_executable(aldbg main.cpp)
+
+target_link_libraries(aldbg ${GTKMM_LIBRARIES} ${CAPSTONE_LIBRARIES} ${ELFPP_LIBRARIES})
\ No newline at end of file
diff --git a/aldbg.glade b/aldbg.glade
deleted file mode 100644
index 048d2b7..0000000
--- a/aldbg.glade
+++ /dev/null
@@ -1,850 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
- center-always
- 1280
- 720
-
-
- True
- False
-
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- True
-
-
-
- True
- False
- vertical
- True
- True
-
-
- True
- True
- regView
-
-
-
-
-
- Registers
-
-
-
-
- 13
- 0
- 2
- 13
-
-
-
-
- True
- False
-
-
- Restart
- True
- True
- True
-
-
- False
- True
- 0
-
-
-
-
- Stop
- True
- True
- True
-
-
- False
- True
- 1
-
-
-
-
- Pause
- True
- True
- True
-
-
- False
- True
- 2
-
-
-
-
- Continue
- True
- True
- True
-
-
- False
- True
- 3
-
-
-
-
- Goin
- True
- True
- True
-
-
- False
- True
- 4
-
-
-
-
- Next
- True
- True
- True
-
-
- False
- True
- 5
-
-
-
-
- Tracein
- True
- True
- True
-
-
- False
- True
- 6
-
-
-
-
- Point
- True
- True
- True
-
-
- False
- True
- 7
-
-
-
-
- Escape
- True
- True
- True
-
-
- False
- True
- 8
-
-
-
-
- 0
- 0
- 13
-
-
-
-
- True
- True
- in
-
-
- True
- True
- codeView
- 0
- True
-
-
-
-
-
- Status
-
-
-
- 3
-
-
-
-
-
-
- 100
- Address
-
-
-
- 0
-
-
-
-
-
-
- 100
- Data
-
-
-
- 1
-
-
-
-
-
-
- Disassembly
-
-
-
- 2
-
-
-
-
-
-
-
-
- 0
- 1
- 13
- 9
-
-
-
-
- True
- True
- in
-
-
- True
- True
- 2
-
-
-
-
-
- column
-
-
-
-
- column
-
-
-
-
-
-
- 0
- 10
- 13
- 3
-
-
-
-
- CPU
- CPU
-
-
-
-
-
- True
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Memory
- Memory
- 1
-
-
-
-
-
- True
- False
-
-
- True
- True
- True
- True
- in
-
-
- True
- True
- True
- True
- logView
- 0
-
-
-
-
-
- 85
- Time
-
-
-
- 0
-
-
-
-
-
-
- Data
-
-
-
- 1
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- Log
- Log
- 2
-
-
-
-
-
- True
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Breakpoints
- Breakpoints
- 3
-
-
-
-
-
- True
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Call Stack
- Call Stack
- 4
-
-
-
-
-
- True
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Symbols
- Symbols
- 5
-
-
-
-
- False
- True
- 1
-
-
-
-
-
-
-
-
-
diff --git a/aldbg.ui b/aldbg.ui
new file mode 100644
index 0000000..c502bb4
--- /dev/null
+++ b/aldbg.ui
@@ -0,0 +1,676 @@
+
+
+
+
+
+ False
+ 350
+ 600
+
+
+ 1
+
+
+ True
+ False
+ vertical
+
+
+
+
+
+
+
+ 0
+ true
+
+
+
+ vertical
+ 2
+
+
+ 6
+ 5
+
+
+ 30
+ File Path:
+
+ 0
+ 2
+
+
+
+
+
+ 30
+ Command Args:
+
+ 0
+ 4
+
+
+
+
+
+ 450
+ 30
+ 1
+
+ 1
+ 2
+ 6
+
+
+
+
+
+ 450
+ 30
+ 1
+
+ 1
+ 4
+ 6
+
+
+
+
+
+
+ 7
+ 2
+
+
+
+
+
+
+ 7
+ 4
+
+
+
+
+
+
+
+
+
+ Attach
+ 1
+ 1
+
+
+
+
+ Cancel
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1280
+ 720
+
+
+
+
+
+
+
+ vertical
+
+
+ center
+
+
+
+
+ ../interface/icon/arrow-restart.png
+
+
+ 1
+ 1
+ center
+ center
+
+
+
+
+
+
+ ../interface/icon/control-stop.png
+
+
+ 1
+ 1
+ center
+ center
+
+
+
+
+
+
+ ../interface/icon/control-pause.png
+
+
+ 1
+ 1
+ center
+ center
+
+
+
+
+
+
+ ../interface/icon/arrow-run.png
+
+
+ 1
+ 1
+ center
+ center
+
+
+
+
+
+
+ ../interface/icon/arrow-step-into.png
+
+
+ 1
+ 1
+ center
+ center
+
+
+
+
+
+
+ ../interface/icon/arrow-step-over.png
+
+
+ 1
+ 1
+ center
+ center
+
+
+
+
+
+
+ ../interface/icon/arrow-skip.png
+
+
+ 1
+ 1
+ center
+ center
+
+
+
+
+
+
+ ../interface/icon/arrow-step-rtr.png
+
+
+ 1
+ 1
+ center
+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 450
+ 1
+ center
+
+ 1
+ 2
+ 6
+
+
+
+
+
+ Jump
+ 1
+ 1
+
+
+
+
+
+
+ 1
+ 1
+ 1
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/Core.hpp b/core/Core.hpp
new file mode 100644
index 0000000..43cfc43
--- /dev/null
+++ b/core/Core.hpp
@@ -0,0 +1,964 @@
+//
+// Created by acite on 5/1/24.
+//
+
+#ifndef _H_CORE
+#define _H_CORE 1
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include "MemoryMap.hpp"
+#include
+
+#include
+#include
+#include