Skip to content

Developer

Peter Van Eeckhoutte edited this page May 2, 2026 · 4 revisions

This page explains

  1. How mona.py is structured internally
  2. Naming conventions
  3. Helper functions

1. Internal Class Structure

You can find a diagram explaing the desired Class layout here.

Note: this is a work in progress. The current version of mona is note entirely structured like that yet.

2. Naming conventions

mona3 uses a small set of naming conventions to make it easier to recognize the role and scope of an identifier at a glance.

Classes

Classes use the Mn prefix followed by PascalCase.

Examples:

  • MnDebugger
  • MnProc
  • MnModule
  • MnConfig

This makes mona-specific classes easy to spot in a large codebase.

Global mutable state

Mutable module-level globals use the g_ prefix and snake_case.

Examples:

  • g_silent
  • g_ptr_counter
  • g_windbg_flavor
  • g_os_version

Use this convention for module-level state that can change during execution.

Cache globals

Module-level cache objects use a leading underscore, snake_case, and a _cache suffix.

Examples:

  • _memory_page_acl_cache
  • _config_file_cache
  • _cfg_table_cache

Use this convention for dictionaries or lists that cache data for a certain object type or subsystem.

Constant-like values

Constant-like values use uppercase names.

Examples:

  • TOP_USERLAND
  • STACK_POINTER
  • PROGRAM_COUNTER
  • PTR_SIZE

Use uppercase for values that are treated as fixed for the lifetime of the current mona session or architecture context.

General notes

  • Prefer snake_case for functions, methods, and non-class variables unless an existing legacy name must be preserved.
  • Prefer descriptive names over short abbreviations unless the shorter form is already well-established in mona.
  • When adding new module-level mutable state, decide explicitly whether it is regular global state (g_...) or cache state (_..._cache).

Clone this wiki locally