Skip to content

Commit

Permalink
Re-arrange entire structure
Browse files Browse the repository at this point in the history
Root has current API, experimental/ folder will have future stuff, and obviously, legacy/ contains the older modules.

Mainly only if module rewrites are a thing.
  • Loading branch information
dd86k committed Jan 17, 2024
1 parent 83c5dd2 commit 0d8320e
Show file tree
Hide file tree
Showing 68 changed files with 203 additions and 202 deletions.
6 changes: 3 additions & 3 deletions app/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import core.stdc.stdlib : exit;
import core.stdc.string : strerror;
import core.stdc.errno : errno;
import adbg.error;
import adbg.v2.disassembler;
import adbg.v2.debugger.exception;
import adbg.v2.object.machines : AdbgMachine;
import adbg.disassembler;
import adbg.debugger.exception;
import adbg.object.machines : AdbgMachine;
import core.stdc.stdio : FILE;
import core.stdc.stdlib : malloc;

Expand Down
8 changes: 4 additions & 4 deletions app/dump/elf.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
/// License: BSD-3-Clause
module dump.elf;

import adbg.v2.disassembler.core;
import adbg.v2.object.server;
import adbg.v2.object.machines;
import adbg.v2.object.format.elf;
import adbg.disassembler.core;
import adbg.object.server;
import adbg.object.machines;
import adbg.object.format.elf;
import dumper;

extern (C):
Expand Down
8 changes: 4 additions & 4 deletions app/dump/lx.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
/// License: BSD-3-Clause
module dump.lx;

import adbg.v2.disassembler.core;
import adbg.v2.object.server;
import adbg.v2.object.machines : AdbgMachine;
import adbg.v2.object.format.lx;
import adbg.disassembler.core;
import adbg.object.server;
import adbg.object.machines : AdbgMachine;
import adbg.object.format.lx;
import dumper;

extern (C):
Expand Down
6 changes: 3 additions & 3 deletions app/dump/macho.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
/// License: BSD-3-Clause
module dump.macho;

import adbg.v2.disassembler.core;
import adbg.v2.object.server;
import adbg.v2.object.format.macho;
import adbg.disassembler.core;
import adbg.object.server;
import adbg.object.format.macho;
import dumper;

int dump_macho(ref Dumper dump, adbg_object_t *o) {
Expand Down
8 changes: 4 additions & 4 deletions app/dump/mz.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
/// License: BSD-3-Clause
module dump.mz;

import adbg.v2.disassembler.core;
import adbg.v2.object.server;
import adbg.v2.object.machines : AdbgMachine;
import adbg.v2.object.format.mz;
import adbg.disassembler.core;
import adbg.object.server;
import adbg.object.machines : AdbgMachine;
import adbg.object.format.mz;
import dumper;

extern (C):
Expand Down
8 changes: 4 additions & 4 deletions app/dump/ne.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
/// License: BSD-3-Clause
module dump.ne;

import adbg.v2.disassembler.core;
import adbg.v2.object.server;
import adbg.v2.object.machines : AdbgMachine;
import adbg.v2.object.format.ne;
import adbg.disassembler.core;
import adbg.object.server;
import adbg.object.machines : AdbgMachine;
import adbg.object.format.ne;
import dumper;

extern (C):
Expand Down
8 changes: 4 additions & 4 deletions app/dump/pdb20.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
/// License: BSD-3-Clause
module dump.pdb20;

import adbg.v2.disassembler.core;
import adbg.v2.object.server;
import adbg.v2.object.machines;
import adbg.v2.object.format.pdb;
import adbg.disassembler.core;
import adbg.object.server;
import adbg.object.machines;
import adbg.object.format.pdb;
import dumper;

extern (C):
Expand Down
8 changes: 4 additions & 4 deletions app/dump/pdb70.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
/// License: BSD-3-Clause
module dump.pdb70;

import adbg.v2.disassembler.core;
import adbg.v2.object.server;
import adbg.v2.object.machines;
import adbg.v2.object.format.pdb;
import adbg.disassembler.core;
import adbg.object.server;
import adbg.object.machines;
import adbg.object.format.pdb;
import adbg.utils.uid;
import adbg.utils.date;
import dumper;
Expand Down
8 changes: 4 additions & 4 deletions app/dump/pe.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
module dump.pe;

import core.stdc.stdlib : EXIT_SUCCESS, EXIT_FAILURE;
import adbg.v2.disassembler.core;
import adbg.v2.object.server;
import adbg.v2.object.machines : AdbgMachine;
import adbg.v2.object.format.pe;
import adbg.disassembler.core;
import adbg.object.server;
import adbg.object.machines : AdbgMachine;
import adbg.object.format.pe;
import adbg.utils.date : ctime32;
import adbg.utils.uid, adbg.utils.bit;
import common, dumper;
Expand Down
3 changes: 2 additions & 1 deletion app/dumper.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
/// License: BSD-3-Clause
module dumper;

import adbg.error, adbg.disassembler, adbg.object;
import adbg.include.c.stdio;
import adbg.include.c.stdlib : EXIT_SUCCESS, EXIT_FAILURE, malloc, free;
import adbg.include.c.stdarg;
import core.stdc.string;
import adbg.v2, adbg.v2.object.machines;
import adbg.object.machines;
import adbg.utils.bit : BIT;
import common, utils, dump;

Expand Down
3 changes: 2 additions & 1 deletion app/shell.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
/// License: BSD-3-Clause
module shell;

import adbg.error, adbg.debugger, adbg.disassembler, adbg.object;
import adbg.include.c.stdio : printf, puts, putchar;
import adbg.include.c.stdlib : atoi, malloc, free, exit;
import core.stdc.string : strcmp, strncmp;
import common, utils;
import term, adbg;
import term;

//TODO: Print process exit code

Expand Down
2 changes: 1 addition & 1 deletion examples/simple-v1.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module examples.simple_v1;

import adbg.include.c.stdio;
import adbg.v1.debugger, adbg.v1.disassembler, adbg.error;
import adbg.legacy.debugger, adbg.legacy.disassembler, adbg.error;

extern (C):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
/// Authors: dd86k <dd@dax.moe>
/// Copyright: © dd86k <dd@dax.moe>
/// License: BSD-3-Clause
module adbg.v2.debugger.breakpoint;
module adbg.debugger.breakpoint;

import adbg.v2.debugger.process;
import adbg.debugger.process;
import adbg.error;

extern (C):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
/// Authors: dd86k <dd@dax.moe>
/// Copyright: © dd86k <dd@dax.moe>
/// License: BSD-3-Clause
module adbg.v2.debugger.context;
module adbg.debugger.context;

import adbg.v2.debugger.process : adbg_process_t;
import adbg.debugger.process : adbg_process_t;
import adbg.include.c.stdio : snprintf;
import adbg.error;

Expand Down Expand Up @@ -102,7 +102,7 @@ void adbg_context_start(adbg_thread_context_t *ctx, adbg_process_t *tracee) {
}

int adbg_context_fill(adbg_process_t *tracee, adbg_thread_context_t *ctx) {
import adbg.v2.debugger.process : AdbgCreation;
import adbg.debugger.process : AdbgCreation;

version (Trace) trace("tracee=%p ctx=%p", ctx, tracee);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Authors: dd86k <dd@dax.moe>
/// Copyright: © dd86k <dd@dax.moe>
/// License: BSD-3-Clause
module adbg.v2.debugger.exception;
module adbg.debugger.exception;

version (Windows) {
import core.sys.windows.winbase;
Expand Down
6 changes: 3 additions & 3 deletions src/adbg/v2/debugger/memory.d → src/adbg/debugger/memory.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
/// Authors: dd86k <dd@dax.moe>
/// Copyright: © dd86k <dd@dax.moe>
/// License: BSD-3-Clause
module adbg.v2.debugger.memory;
module adbg.debugger.memory;

import adbg.v2.debugger.process : adbg_process_t;
import adbg.debugger.process : adbg_process_t;
import adbg.include.c.stdlib;
import adbg.include.c.stdio;
import adbg.include.c.stdarg;
Expand Down Expand Up @@ -723,7 +723,7 @@ struct adbg_scan_result_t {
///
/// Returns: An instance of the scanner or null on error.
adbg_scan_t* adbg_memory_scan(adbg_process_t *tracee, void* data, size_t datasize, ...) {
import adbg.v2.debugger.process : AdbgStatus;
import adbg.debugger.process : AdbgStatus;

/// Until scanner gets better internals for variable-length
/// data types. Don't want to scan gigabyte-sized types now.
Expand Down
8 changes: 8 additions & 0 deletions src/adbg/debugger/package.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module adbg.debugger;

public import
adbg.debugger.process,
adbg.debugger.context,
adbg.debugger.exception,
adbg.debugger.memory,
adbg.debugger.seh;
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/// Authors: dd86k <dd@dax.moe>
/// Copyright: © dd86k <dd@dax.moe>
/// License: BSD-3-Clause
module adbg.v2.debugger.process;
module adbg.debugger.process;

//TODO: Process Pause/Resume
// Windows: NtSuspendProcess/NtResumeProcess or SuspendThread/ResumeThread
Expand All @@ -22,9 +22,9 @@ import adbg.include.c.stdarg;
import adbg.platform;
import adbg.error;
import adbg.utils.strings : adbg_util_argv_flatten;
import adbg.v2.debugger.exception : adbg_exception_t, adbg_exception_translate;
import adbg.v2.debugger.breakpoint : adbg_breakpoint_t;
import adbg.v2.object.machines;
import adbg.debugger.exception : adbg_exception_t, adbg_exception_translate;
import adbg.debugger.breakpoint : adbg_breakpoint_t;
import adbg.object.machines;
import core.stdc.string : memset;

version (Windows) {
Expand Down
6 changes: 3 additions & 3 deletions src/adbg/v2/debugger/seh.d → src/adbg/debugger/seh.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// Authors: dd86k <dd@dax.moe>
/// Copyright: © dd86k <dd@dax.moe>
/// License: BSD-3-Clause
module adbg.v2.debugger.seh;
module adbg.debugger.seh;

//TODO: adbg_seh_disable
//TODO: Would be cool to have try/catch mechanic
Expand All @@ -12,7 +12,7 @@ module adbg.v2.debugger.seh;
import adbg.error;

version (Windows) {
import adbg.v2.debugger.exception;
import adbg.debugger.exception;
import adbg.include.windows.windef;
import adbg.include.c.setjmp;

Expand All @@ -36,7 +36,7 @@ version (Windows) {
PVOID AddVectoredExceptionHandler(ULONG, PVECTORED_EXCEPTION_HANDLER);
}
} else version (Posix) {
import adbg.v2.debugger.exception;
import adbg.debugger.exception;
import adbg.include.c.setjmp;
import core.sys.posix.signal;
import core.sys.posix.ucontext;
Expand Down
10 changes: 5 additions & 5 deletions src/adbg/v2/disassembler/core.d → src/adbg/disassembler/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
/// Authors: dd86k <dd@dax.moe>
/// Copyright: © dd86k <dd@dax.moe>
/// License: BSD-3-Clause
module adbg.v2.disassembler.core;
module adbg.disassembler.core;

import adbg.include.capstone;
import adbg.include.c.stdarg;
import core.stdc.string : memcpy;
import adbg.error;
import adbg.platform;
import adbg.v2.debugger.process : adbg_process_t;
import adbg.v2.object.machines : AdbgMachine, adbg_object_machine_alias;
import adbg.v2.debugger.exception : adbg_exception_t;
import adbg.v2.debugger.memory : adbg_memory_read;
import adbg.debugger.process : adbg_process_t;
import adbg.object.machines : AdbgMachine, adbg_object_machine_alias;
import adbg.debugger.exception : adbg_exception_t;
import adbg.debugger.memory : adbg_memory_read;

//TODO: Capstone CS_MODE_BIG_ENDIAN
// Depending on target endianness, Capstone may need this bit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
/// Authors: dd86k <dd@dax.moe>
/// Copyright: © dd86k <dd@dax.moe>
/// License: BSD-3-Clause
module adbg.v2.disassembler;
module adbg.disassembler;

public import adbg.v2.disassembler.core;
public import adbg.disassembler.core;
2 changes: 1 addition & 1 deletion src/adbg/include/capstone/v4.d
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ cs_err cs_regs_access (
// ANCHOR: Dynamic library
//

import adbg.v2.object.symbols;
import adbg.object.symbols;

private {
alias pcs_version = uint function(int* major, int* minor);
Expand Down
2 changes: 1 addition & 1 deletion src/adbg/include/windows/ntdll.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version (Windows):
import core.sys.windows.windef;
import core.sys.windows.ntdef; // NTSTATUS
import core.sys.windows.ntdll;
import adbg.v2.object.symbols;
import adbg.object.symbols;
import adbg.error;

extern(C):
Expand Down
2 changes: 1 addition & 1 deletion src/adbg/include/windows/psapi_dyn.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version (ANSI) {} else version = Unicode;
import core.sys.windows.windef;
public import core.sys.windows.psapi;

import adbg.v2.object.symbols;
import adbg.object.symbols;

extern (Windows):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* Copyright: © dd86k <dd@dax.moe>
* License: BSD-3-Clause
*/
module adbg.v1.debugger.context;
module adbg.legacy.debugger.context;

import adbg.v1.debugger.debugger : g_debuggee;
import adbg.legacy.debugger.debugger : g_debuggee;
import adbg.include.c.stdio : snprintf;
import core.stdc.stdarg;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
* Copyright: © dd86k <dd@dax.moe>
* License: BSD-3-Clause
*/
module adbg.v1.debugger.debugger;
module adbg.legacy.debugger.debugger;

import adbg.include.c.stdlib : malloc, free;
import adbg.include.c.stdio;
import core.stdc.config : c_long;
import core.stdc.string : memset;
import adbg.platform, adbg.error;
import adbg.utils.strings : adbg_util_argv_flatten;
public import adbg.v1.debugger.exception;
public import adbg.legacy.debugger.exception;

version (Windows) {
import core.sys.windows.windows;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* Copyright: © dd86k <dd@dax.moe>
* License: BSD-3-Clause
*/
module adbg.v1.debugger.exception;
module adbg.legacy.debugger.exception;

public import adbg.v1.debugger.context;
public import adbg.legacy.debugger.context;

version (Windows) {
import core.sys.windows.windows;
Expand Down
Loading

0 comments on commit 0d8320e

Please sign in to comment.