# siubikyt/memread architecture

> Architecture diagram of the GitHub repository siubikyt/memread, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/siubikyt/memread
- Repository: https://github.com/siubikyt/memread

## Overview

memread is a Linux process-memory inspection tool: the user enters a PID, address, and size in its terminal UI; the client requests a kernel-mediated read and presents the bytes as a hexdump and typed values. The driver validates the request, locates the target task, reads its memory, and copies the result back. The README describes the client-driver workflow, and the sampled driver confirms the memory-read path; unsampled client code limits detail about the precise request and display wiring.

Main entry points: [`memread_client/memread.cpp`](https://github.com/siubikyt/memread/blob/main/memread_client/memread.cpp) (memread client), [`memread_driver/memread.c`](https://github.com/siubikyt/memread/blob/main/memread_driver/memread.c) (Read IOCTL handler), [`memread_client/src/imgui_widgets.cpp`](https://github.com/siubikyt/memread/blob/main/memread_client/src/imgui_widgets.cpp) (UI framework), [`memread_client/include/imtui-impl-ncurses.h`](https://github.com/siubikyt/memread/blob/main/memread_client/include/imtui-impl-ncurses.h) (Terminal UI API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Terminal client"]
  node_client["memread client<br/>[memread.cpp]"]
  node_ui["Input and tabs<br/>[memread.cpp]"]
  node_format["Typed dump<br/>[memread.cpp]"]
  node_imgui["UI framework<br/>[imgui_widgets.cpp]"]
  node_imtui["Terminal UI API"]
end

subgraph group_kernel["Kernel reader"]
  node_device["memreader device<br/>[memread.c]"]
  node_ioctl["Read IOCTL handler<br/>[memread.c]"]
  node_kernel_api["Process memory access<br/>[memread.c]"]
end

subgraph group_target["Target memory"]
  node_process["Target process"]
end

node_user(("Debugger user"))

node_user -->|"uses"| node_client
node_client -->|"runs"| node_ui
node_ui -->|"builds widgets"| node_imgui
node_client -->|"initializes terminal UI"| node_imtui
node_client -->|"requests memory read"| node_device
node_device -->|"dispatches IOCTL"| node_ioctl
node_ioctl -->|"reads via"| node_kernel_api
node_kernel_api -->|"reads memory"| node_process
node_process -->|"supplies bytes"| node_kernel_api
node_ioctl -->|"copies bytes back"| node_client
node_client -->|"formats bytes"| node_format
node_format -->|"displays values"| node_ui

click node_client "https://github.com/siubikyt/memread/blob/main/memread_client/memread.cpp"
click node_ui "https://github.com/siubikyt/memread/blob/main/memread_client/memread.cpp"
click node_format "https://github.com/siubikyt/memread/blob/main/memread_client/memread.cpp"
click node_imgui "https://github.com/siubikyt/memread/blob/main/memread_client/src/imgui_widgets.cpp"
click node_imtui "https://github.com/siubikyt/memread/blob/main/memread_client/include/imtui-impl-ncurses.h"
click node_device "https://github.com/siubikyt/memread/blob/main/memread_driver/memread.c"
click node_ioctl "https://github.com/siubikyt/memread/blob/main/memread_driver/memread.c"
click node_kernel_api "https://github.com/siubikyt/memread/blob/main/memread_driver/memread.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_ui,node_format,node_imgui,node_imtui,node_user toneBlue
class node_device,node_ioctl,node_kernel_api toneAmber
class node_process toneMint
```

## Components

### Terminal client

- [memread client](https://github.com/siubikyt/memread/blob/main/memread_client/memread.cpp): `memread_client/memread.cpp`
- [Input and tabs](https://github.com/siubikyt/memread/blob/main/memread_client/memread.cpp): `memread_client/memread.cpp`
- [Typed dump](https://github.com/siubikyt/memread/blob/main/memread_client/memread.cpp): `memread_client/memread.cpp`
- [UI framework](https://github.com/siubikyt/memread/blob/main/memread_client/src/imgui_widgets.cpp): `memread_client/src/imgui_widgets.cpp`
- [Terminal UI API](https://github.com/siubikyt/memread/blob/main/memread_client/include/imtui-impl-ncurses.h): `memread_client/include/imtui-impl-ncurses.h`

### Kernel reader

- [memreader device](https://github.com/siubikyt/memread/blob/main/memread_driver/memread.c): `memread_driver/memread.c`
- [Read IOCTL handler](https://github.com/siubikyt/memread/blob/main/memread_driver/memread.c): `memread_driver/memread.c`
- [Process memory access](https://github.com/siubikyt/memread/blob/main/memread_driver/memread.c): `memread_driver/memread.c`

### Target memory

- **Target process**

### Other components

- **Debugger user**

## Connections

- Debugger user → memread client: uses
- memread client → Input and tabs: runs
- Input and tabs → UI framework: builds widgets
- memread client → Terminal UI API: initializes terminal UI
- memread client → memreader device: requests memory read
- memreader device → Read IOCTL handler: dispatches IOCTL
- Read IOCTL handler → Process memory access: reads via
- Process memory access → Target process: reads memory
- Target process → Process memory access: supplies bytes
- Read IOCTL handler → memread client: copies bytes back
- memread client → Typed dump: formats bytes
- Typed dump → Input and tabs: displays values
