modus
Menu
On this page

The entry debug_target

The process that the test of the debugger debugs.

It holds what a debugger shows, with values that a test knows: a record with a record inside it, an array, an enumeration, a text, a count that a watch can see, a procedure with parameters and local variables, a loop to step through, and a second thread that only waits.

What it is for. The machine test modustool test debugger attaches the debugger service to this process from the console and from the host, and waits for exact rows: a breakpoint by a procedure name and by a file and a line, the frames of the stack, a local variable of a caller, the fields of the record, an element of the array, the name of the enumeration value, one step, one line, and a watch of the count.

Start: start("debug_target") in the console. It has no grant of the root service, so each caller that acts for the principal of its session can debug it.

What a reader sees: the log has "debug_target: 64 more rounds ran, so the process is not held: as it must" each time its main thread ended 64 rounds: a thread that a debugger holds writes no such line. The process has no window and no end: stop("debug_target") ends it.

Why its variables stay in memory. The build optimises each module, and a variable that the compiler keeps in a register, or removes, is "not readable" in the debug object. The address of each variable that the test reads goes to a procedure that the compiler cannot put inside its caller, and each global is written and read with a volatile access: the compiler must keep them in memory, where the debug object finds them.

The lines of add_step, and of the call of add_step in count_rounds, are named in the scenario of the test (tools/modustool/machine/debugger_scenario.odin, DEBUG_TARGET_LINE_OF_THE_LOAD and DEBUG_TARGET_LINE_OF_THE_STORE): a change of this file above that procedure changes those two numbers.

See: Developer tools: The debugger

debug_target module with an entry

Hash
e6d4910a7647563ccd1f145b6074a00aa382d6359cc08ad76c680dc2f3313c4c
Size
32768 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

The process that the test of the debugger debugs

FactValue
KindModules with an entry
Sourcesrc/modules/tests/debug_target
Boot imageyes: in the boot image, 32768 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported bynone

Neighbours

It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.

Exports

ExportWhat it does
entry()The entry of debug_target

entry

entry()

The entry of debug_target. It writes its globals, starts the thread that waits, writes "debug_target: runs, with a thread that waits" (or stops with Failed when the thread does not start), then runs its rounds for ever.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/tests/debug_target/main.odin:159

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

What the root service gives it

WhatValueAs the root service says
GrantsnoneThe process that the test of the debugger debugs.
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 1954
  • pages of its threads 91
  • pages of the pictures of its window 0
  • pages of the module and its imports from the files of the build
  • processes 1
  • threads 2
Its main thread, and one thread that only waits.

The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).

add_step procedure of the package debug_target

add_step :: proc "contextless" (sum: ^u64, step: u64)

add_step adds a step to a sum.

src/modules/tests/debug_target/main.odin:80

count_rounds procedure of the package debug_target

count_rounds :: proc "contextless" (limit: u64, step: u64) -> u64

count_rounds adds step to a total limit times, and gives the total.

src/modules/tests/debug_target/main.odin:93