Launching TestFlows Machine: self-service deterministic simulation testing environment Read the post

Debug

Command Does
machine regs Show the registers of a task
machine mem Show the memory of a tgid
machine backtrace Show the stack of a task
machine call Call a function in a task
machine return Return from a task’s innermost function
machine print Print the value of an expression
machine locals List the local variables of a frame
machine symbols Find the symbols of a tgid
machine libs List the program and the libraries a tgid maps
machine step Step a task
machine points List the breakpoints, watchpoints and catchpoints
machine break List and manage breakpoints
machine watch List and manage watchpoints
machine catch List and manage catchpoints

machine regs

Show the registers of a task.

The registers are the user registers of a task of the guest, by its tid. A task on a vCPU has them in the vCPU. A task off every vCPU has them where it saved them. A task in the kernel has the ones it entered with.

Without names the general registers are shown. Use --all to show the x87, SSE and AVX registers as well. Name registers to show those alone.

NAME=VALUE writes a register. A value is a number or a location as mem takes one, such as main+4. The write is part of the run, and a replay makes it again. The selectors and the x87, SSE and AVX registers are not written.

1
machine regs [-h] [--all] run tid [register ...]
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
[register ...] Register to show, such as rip or xmm0, or NAME=VALUE to write one (default: the general registers)
Option Does
--all Show the x87, SSE and AVX registers as well

Examples:

1
2
3
4
machine regs run1 412                   the general registers of tid 412
machine regs run1 412 rip rsp two of them
machine regs run1 412 --all with x87, SSE and AVX
machine regs run1 412 rax=0 rip=main+4 write two of them

Prints:

1
2
text  REGISTER VALUE NATURAL, then where they were read
json tid tgid start where cpu values, each value in hex

Refuses, and the way past:

1
a tid the machine does not have  machine tasks run1

See also:

machine mem

Show the memory of a tgid.

The memory is the tgid’s own, through its page tables. The task names its tgid. Guest kernel memory is not shown.

A location names an address in the task’s process. Every command that takes a location takes one of these:

1
2
3
4
5
6
7
0x401136            an address
*0x401136 an address, as GDB writes it
main a function or a variable, by its name
libc.so.6:malloc a name in one file, by its path or file name
init.c:106 a source line, at its first code
$rsp a register of the task, as it is now
main+4, $rsp-8 any of these moved by +N or -N

A format after the location shows the memory as GDB’s x command does. A format is a count, a letter and a unit, such as 8xg, 4i or s. The letters are x, d, u, o, t, a, c, f, s, i and z. The units are b, h, w and g.

Each line begins with its address and the symbol the address is in. A read that reaches an address that is not mapped ends there.

LOCATION=VALUE writes there, and the write is part of the run. A quoted string writes its bytes. A number takes the size of the variable it is written to, or of a unit after it. A page the tgid cannot write is not written.

LOCATION^=MASK flips the bits the mask sets in the value there, as ^= does in C. The value is as wide as the variable or the unit after it. The flip is a write and is part of the run.

1
2
3
machine mem [-h] [--find pattern] [--dump file] [--restore file] [--fill pattern]
[--length n] [--mapped]
run tid [location] [format]
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
[location] Address to read at: a number, *ADDR, $register, NAME, PATH:NAME or FILE:LINE, moved by +N or -N. LOCATION=VALUE writes there, LOCATION^=MASK flips bits
[format] Count, format letter and unit, as GDB’s x takes them, such as 8xg, 4i or s (default: 8xg)
Option Does
--find pattern Find a pattern in --length bytes: text, or 0x and hex bytes
--dump file Write --length bytes to a file on this computer
--restore file Write the bytes of a file on this computer at the location
--fill pattern Write a pattern over --length bytes: text, or 0x and hex bytes
--length n Bytes a find, a dump or a fill reaches over
--mapped List the pages the tgid maps, with their access and file

Examples:

1
2
3
4
5
6
7
8
9
10
11
12
machine mem run1 412 '$sp'                  eight 8-byte words at the stack
machine mem run1 412 '$pc' 4i the next four instructions
machine mem run1 412 main 16xb sixteen bytes of main
machine mem run1 412 environ a what environ points at
machine mem run1 412 counter=42 write counter, at its size
machine mem run1 412 '$sp+8=-1' w write a word at the stack
machine mem run1 412 'counter^=0x10' flip bit 4 of counter
machine mem run1 412 --mapped the pages the tgid maps
machine mem run1 412 b --find x --length 9 find x
machine mem run1 412 b --dump f --length 8 into file f
machine mem run1 412 b --restore f file f back
machine mem run1 412 b --fill x --length 8 8 bytes of x

Prints:

1
2
text  <address> <symbol+offset>: units, as GDB's x
json tid address format unit lines unmapped

Refuses, and the way past:

1
2
a symbol no file names           machine symbols run1 412 --regex name
a tid the machine does not have machine tasks run1

See also:

machine backtrace

Show the stack of a task.

Each frame is a function the task is in, the innermost first. The frames are walked by the call frame information of the program files. Code with no call frame information is walked by its frame pointer.

The names come from the program files on the machine’s disk as it stands. A frame of a file the disk does not have is named by its file. A frame of a program built with debug information names its source line.

1
machine backtrace [-h] [--frame n] run tid
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
Option Does
--frame n Describe one frame, as GDB’s info frame: where it is and what called it

Examples:

1
machine backtrace run1 412  the stack of tid 412

Prints:

1
2
text  # ADDRESS FUNCTION SOURCE FILE
json tid frames

Refuses, and the way past:

1
a tid the machine does not have  machine tasks run1

See also:

machine call

Call a function in a task.

The task runs the function from where it stands. The arguments go in the registers the x86-64 ABI passes them in. An argument is an integer or a pointer. The value returned is printed by the function’s return type.

The task’s registers are put back after the call. What the function wrote in memory stays written. The call is part of the run, and a replay makes it again.

A breakpoint the call reaches ends it there. The registers are put back then too, and the call is abandoned.

1
machine call [-h] run tid function [arguments ...]
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
function Function to call: a name or a location
[arguments ...] Arguments: expressions as print takes them, integers or pointers

Examples:

1
2
machine call run1 412 square 3  square of 3, by its type
machine call run1 412 fflush 0 flush every stream

Prints:

1
2
text  FUNCTION(ARGUMENTS) = VALUE
json tid function returned abandoned hits

Refuses, and the way past:

1
a tid the machine does not have  machine tasks run1

See also:

machine return

Return from a task’s innermost function.

The task goes on at the instruction after the call, in its caller. The caller’s stack pointer and the registers the function saved are restored, as GDB’s return does. A value goes in rax.

The registers come from the call frame information of the program files on the machine’s disk. Machine refuses the operation if the function has no call frame information.

The write is part of the run, and a replay makes it again. Memory is not changed.

1
machine return [-h] run tid [value]
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
[value] Value the function returns in rax: a number or a location

Examples:

1
2
machine return run1 412    leave the function, rax as it is
machine return run1 412 0 leave it, returning 0

Prints:

1
2
text  Returned from FUNCTION to PLACE, in tid TID
json tid from address function offset source line rax

Refuses, and the way past:

1
a tid the machine does not have  machine tasks run1

See also:

machine print

Print the value of an expression.

An expression is a variable of the frame, a global or a $register. A member, an arrow, an index, a star and an ampersand apply to it as in C. The value is printed by its type.

The types and the variables come from the program’s debug information on the machine’s disk. Use --frame to print in a frame of a caller, as backtrace numbers them.

A format after the expression prints each number in it, as print/x does. The letters are x, d, u, o, t, c and z. Use --type to print the type instead, as whatis and ptype do.

TARGET = VALUE writes VALUE at TARGET and prints TARGET after the write. The write is part of the run, and a replay makes it again.

1
machine print [-h] [--frame n] [--type] run tid expression [format]
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
expression A variable or $register, with .m, ->m, [i], * and &
[format] Format letter for each number, as print/x takes one: x, d, u, o, t, c or z
Option Does
--frame n Frame of the stack, as backtrace numbers it (default: 0)
--type Print its type instead, as GDB’s whatis and ptype do

Examples:

1
2
3
4
5
6
7
8
machine print run1 412 counter          a global or a local
machine print run1 412 'shape->at.x' a member through a pointer
machine print run1 412 'squares[2]' an element of an array
machine print run1 412 '*(int *)arg' through a cast
machine print run1 412 index --frame 1 in the caller's frame
machine print run1 412 counter x in hexadecimal
machine print run1 412 shape --type its type
machine print run1 412 'counter = 3' write it

Prints:

1
2
text  EXPRESSION = VALUE
json tid frame expression type value address

Refuses, and the way past:

1
a name the frame and the globals do not have  machine locals run1 412

See also:

machine locals

List the local variables of a frame.

Each local of the function is printed with its value, by its type. Use --args to list the function’s arguments instead. Use --frame to list a frame of a caller.

The variables come from the program’s debug information on the machine’s disk. A variable the debug information places where it is not read is listed with why.

1
machine locals [-h] [--frame n] [--args] run tid
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
Option Does
--frame n Frame of the stack, as backtrace numbers it (default: 0)
--args The function’s arguments instead

Examples:

1
2
3
machine locals run1 412            the locals of the innermost frame
machine locals run1 412 --args the arguments instead
machine locals run1 412 --frame 1 the caller's locals

Prints:

1
2
text  NAME = VALUE, a line each
json tid frame function variables

See also:

machine symbols

Find the symbols of a tgid.

A name finds the address of each symbol of that name. An address finds the symbol it is in. A symbol of one file is written PATH:NAME. A source line written FILE:LINE finds its code.

Use --regex to find each function whose name matches a pattern. The symbols come from the program files on the machine’s disk.

1
2
3
machine symbols [-h] [--regex pattern] [--variables] [--types] [--scope] [--sources]
[--file path]
run tid [name|address|file:line]
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
[name|address|file:line] Symbol to find the address of, address to find the symbol of, or source line to find the code of
Option Does
--regex pattern Find each function whose name the regular expression matches
--variables Find variables with --regex, not functions
--types Find the types the debug information names with --regex, as info types
--scope List the variables in scope at a location, as info scope
--sources Find the source files the line tables name with --regex, as info sources
--file path File to look in with --regex, by its path or its file name (default: every file the tgid maps)

Examples:

1
2
3
4
5
6
machine symbols run1 412 main                         where main is
machine symbols run1 412 0x401ac6 what is at an address
machine symbols run1 412 data-race.c:56 a source line's code
machine symbols run1 412 --regex ^wait functions that match
machine symbols run1 412 --regex env --variables variables
machine symbols run1 412 --regex ^m --file libc.so.6 of one file

Prints:

1
2
text  ADDRESS SIZE KIND NAME SOURCE FILE
json tid symbols, or tid lines for a source line

See also:

machine libs

List the program and the libraries a tgid maps.

Each row is a file the tgid maps executable, at its range of addresses. The first row is the program. A file the machine’s disk does not have has no symbols.

1
machine libs [-h] run tid
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process

Examples:

1
machine libs run1 412  the program and libraries of 412

Prints:

1
2
text  START END OFFSET FILE
json tid libraries

See also:

machine step

Step a task.

A step is one instruction of the task. Use --line to step a source line. Use --over to step over a call, so the function and all it calls are one step. Use --out to run until the function returns.

The machine runs whichever task the guest schedules. A step of one task runs the machine until that task is in its own code, then steps it. Other tasks run meanwhile.

Each step runs the machine, and the run records it, so a replay makes it again. A breakpoint the step reaches ends it. A line step steps out of a function that has no line tables.

A C++ exception that leaves the function ends --over and --out at the catch that takes it, as GDB does. In a C++ program such a step takes 2 of the run’s 3 debug registers. With fewer free, the step is refused.

A longjmp out of the function ends the step after 30 minutes of machine time. Use cancel to end it sooner.

Use --skip NAME with --line to step out of a function or a source file of that name. It does as GDB’s skip does. Give it once for each name.

Use --back to go back over the task’s executions on any vCPU, as reverse-stepi does. An execution is one stretch the task ran, one instruction where the run stepped. The machine switches onto a new branch there, as go does.

With --line, --over or --out, --back goes back over the task’s own code. It does as reverse-step, reverse-next, reverse-nexti and reverse-finish do. It goes back over what the run recorded one instruction at a time. Past that it stops, and says the history ends there.

1
machine step [-h] [--line] [--over] [--out] [--back [n]] [--skip name] run tid [count]
Argument Does
run Run name
tid Task of the machine, by its tid, the thread id ps -L shows. Its tgid is the pid of its process
[count] Steps to make (default: 1)
Option Does
--line Step a source line, not an instruction
--over Step over a call, the function it calls and all it calls being one step
--out Run until the function returns to the one that called it
--back [n] Go back n steps over the task’s dispatches, onto a branch
--skip name Step out of a function or a source file of this name in a line step (repeatable)

Examples:

1
2
3
4
5
6
7
machine step run1 412                one instruction, as stepi
machine step run1 412 5 --over five, a call being one, as nexti
machine step run1 412 --line a source line, as step
machine step run1 412 --line --over a line over calls, as next
machine step run1 412 --out until the function returns, as finish
machine step run1 412 --back --line back a line, as reverse-step
machine step run1 412 --back --out back to the call, as reverse-finish

Prints:

1
2
3
4
text         Stepped N instructions to WHERE, in tid TID
json tid steps address symbol source hits
back Stepped back N lines to WHERE, in tid TID, on BRANCH
history end No more history before entry N

See also:

machine points

List the breakpoints, watchpoints and catchpoints.

The three share one table and its numbers. Each row has its number and its kind. Use break, watch or catch to change the row of its kind.

1
machine points [-h] run
Argument Does
run Run name

Examples:

1
machine points run1  every breakpoint, watchpoint and catchpoint

Prints:

1
2
text  # KIND ADDRESS SIZE WHERE TGID HITS WHEN
json breakpoints

See also:

machine break

List and manage breakpoints.

A breakpoint stops the run when a task of its tgid reaches its location. The listing has the run’s breakpoints, each by its number. Use points to list them with the watchpoints and catchpoints.

The run keeps them in its run log. A branch has the ones its parent had where it was forked. A run holds 64 breakpoints. Hardware breakpoints and watchpoints share the 3 debug registers.

A breakpoint stops the tasks of its tgid alone. Another process that maps the same file does not stop. A read of the task’s memory shows the program’s byte, not the breakpoint’s.

A run that reaches a breakpoint ends there and names it. The run arms its breakpoints while it records and not while it replays. So run --back finds only the hits the run recorded.

1
machine break [-h] run command ...
Argument Does
run Run name

Examples:

1
2
3
machine break run1               the breakpoints of run1
machine break run1 add 412 main stop the tgid of 412 at main
machine break run1 delete 2 delete breakpoint 2

Prints:

1
2
text  # KIND ADDRESS SIZE WHERE TGID HITS WHEN
json breakpoints

See also:

machine break list

List the breakpoints.

The listing is the one the command prints with no verb.

1
machine break run list [-h]

Examples:

1
machine break run1 list  the breakpoints, by number

See also:

machine break add

Add a breakpoint.

The breakpoint stops the run before the instruction at its location runs. It stops the tgid of the task alone. Another tgid that runs the same address goes on.

The location is resolved now, from the tgid’s program files. The run log keeps the breakpoint, and a branch has its parent’s.

Use --hardware to put it in one of the 3 debug registers, as GDB’s hbreak does. A breakpoint in code the program allocated needs one, as does one in code the program reads.

1
2
3
4
machine break run add [-h] [--disabled] [--ignore count] [--temporary]
[--condition condition] [--print format] [--regex pattern]
[--hardware]
tid [location]
Argument Does
tid Task whose tgid the stop is in
[location] Location, as mem takes one: an address, *ADDR, NAME, PATH:NAME, FILE:LINE or $reg, moved by +N or -N
Option Does
--disabled Add it and do not arm it
--ignore count Pass this many hits where the condition holds (default: 0)
--temporary Delete it at its first hit where the condition holds
--condition condition Count a hit only where this expression holds, as print takes one, such as ‘$rax == 0’
--print format Print this at a hit and go on. {EXPR} prints an expression as print takes one, {EXPR:x} in a print format letter: ‘n={counter} p={$rdi:x}’
--regex pattern Add one at each function whose name matches, in place of a location
--hardware Put it in a debug register, as GDB’s hbreak

Examples:

1
2
3
4
machine break run1 add 412 main           at the start of main
machine break run1 add 412 init.c:104 at a source line
machine break run1 add 412 '*0x401ca9' at an address
machine break run1 add 412 --regex '^tc' at each function that matches

Prints:

1
2
3
text          Breakpoint N at WHERE, in tgid TGID
json number kind address size tgid program location
json --regex breakpoints: each added, as break lists them

See also:

machine break delete

Delete breakpoints.

The run log keeps the delete, so a branch forked before it keeps the breakpoint.

1
machine break run delete [-h] number [number ...]
Argument Does
number [number ...] Number of a breakpoint

Examples:

1
machine break run1 delete 2  delete breakpoint 2

See also:

machine break clear

Delete the breakpoints at a location.

Each breakpoint at the address the location names in the tgid of the task is deleted.

1
machine break run clear [-h] tid location
Argument Does
tid Task whose tgid the breakpoints are in
location Location, as mem takes one

Examples:

1
machine break run1 clear 412 main  delete the stops at main

See also:

machine break save

Save the breakpoints as the commands that add them.

Each line is a machine command that adds one breakpoint again. The command keeps its condition, ignore count and flags. A location written by a register is saved as its address.

1
machine break run save [-h] file
Argument Does
file File to write, or - for the standard output

Examples:

1
2
machine break run1 save stops.sh  write the commands to a file
machine break run1 save - print them

See also:

machine break hits

List the hits of breakpoints.

A hit is a breakpoint that stopped the run. It has the entry it stopped at, its machine time and the number of the breakpoint. The run log keeps each one, so a branch lists its parent’s hits before it.

Use run --back to switch onto a branch at the newest hit.

1
machine break run hits [-h] [-n range]
Option Does
-n, --entries range Hits to list, by the entry each stopped at: N, A:B, A:, :B; or -N for the last N hits, -A:-B counted from the end (default: the last 20)

Examples:

1
2
machine break run1 hits       the last 20 hits
machine break run1 hits -n : every hit

Prints:

1
2
text  ENTRY VTIME # KIND EVENT
json hits

See also:

machine break enable

Enable a breakpoint.

The machine arms an enabled breakpoint and not a disabled one. The run log keeps the change.

1
machine break run enable [-h] [--once | --count n] number
Argument Does
number Number of the breakpoint
Option Does
--once Disable it again after its next hit, as GDB’s enable once
--count n Disable it again after N hits, as GDB’s enable count

Examples:

1
machine break run1 enable 2  arm stop 2 again

See also:

machine break disable

Disable a breakpoint.

The machine arms an enabled breakpoint and not a disabled one. The run log keeps the change.

1
machine break run disable [-h] number
Argument Does
number Number of the breakpoint

Examples:

1
machine break run1 disable 2  keep stop 2 and do not arm it

See also:

machine break condition

Set the condition of a breakpoint.

A hit where the condition does not hold does not end the run. Without a condition the breakpoint has none.

1
machine break run condition [-h] number [condition]
Argument Does
number Number of the breakpoint
[condition] Condition, such as ‘$rax == 0’ or ‘counter > 3’ (default: none)

Examples:

1
2
3
machine break run1 condition 2 '$rax == 0'  where rax is 0
machine break run1 condition 2 'n > 3' where n is above 3
machine break run1 condition 2 no condition

See also:

machine break ignore

Pass the next hits of a breakpoint.

Each hit where the condition holds is counted. A counted hit is passed while the ignore count lasts. A count of 0 stops at the next.

1
machine break run ignore [-h] number count
Argument Does
number Number of the breakpoint
count Hits to pass

Examples:

1
machine break run1 ignore 2 5  pass the next 5 hits

See also:

machine watch

List and manage watchpoints.

A watchpoint stops the run after a task of its tgid writes its bytes, or reads them with --on access. The listing has the run’s watchpoints, each by its number. Use points to list them with the breakpoints and catchpoints.

The run keeps them in its run log, as it keeps its breakpoints. A run holds 3 watchpoints and hardware breakpoints together, one in each debug register. A step over a call takes one of the 3 while it runs. So do step --out and run --until at= or write=.

1
machine watch [-h] run command ...
Argument Does
run Run name

Examples:

1
2
machine watch run1 add 412 counter  a write of counter
machine watch run1 the watchpoints of run1

Prints:

1
2
text  # KIND ADDRESS SIZE WHERE TGID HITS WHEN
json breakpoints

See also:

machine watch list

List the watchpoints.

The listing is the one the command prints with no verb.

1
machine watch run list [-h]

Examples:

1
machine watch run1 list  the watchpoints, by number

See also:

machine watch add

Add a watchpoint.

The watchpoint stops the run after an instruction writes its bytes. Use --on change to stop only where the bytes change, as GDB’s watch does. Use --on access to stop at a read as well. It watches the tgid of the task alone.

A variable is watched at its size. So is an expression, as a local, a member or an element, at the bytes it names when added. A local’s watch stays after its function returns. Any other location takes --size, of 1, 2, 4 or 8 bytes.

The run log keeps the watchpoint, and a branch has its parent’s.

1
2
3
4
machine watch run add [-h] [--disabled] [--ignore count] [--temporary]
[--condition condition] [--print format] [--size bytes]
[--on {write,change,read,access}]
tid location
Argument Does
tid Task whose tgid the stop is in
location Location, as mem takes one: an address, *ADDR, NAME, PATH:NAME, FILE:LINE or $reg, moved by +N or -N
Option Does
--disabled Add it and do not arm it
--ignore count Pass this many hits where the condition holds (default: 0)
--temporary Delete it at its first hit where the condition holds
--condition condition Count a hit only where this expression holds, as print takes one, such as ‘$rax == 0’
--print format Print this at a hit and go on. {EXPR} prints an expression as print takes one, {EXPR:x} in a print format letter: ‘n={counter} p={$rdi:x}’
--size bytes Bytes to watch: 1, 2, 4 or 8 (default: the variable’s size)
--on {write,change,read,access} What stops the run: a write, a write that changes the bytes, a read, or any access (default: write)

Examples:

1
2
3
machine watch run1 add 412 counter               a write of the variable
machine watch run1 add 412 counter --on access any access
machine watch run1 add 412 '*0x4c8b50' --size 4 a write of 4 bytes

Prints:

1
2
text  Watchpoint N at WHERE, in tgid TGID
json number kind address size tgid program location

See also:

machine watch delete

Delete watchpoints.

The run log keeps the delete, so a branch forked before it keeps the watchpoint.

1
machine watch run delete [-h] number [number ...]
Argument Does
number [number ...] Number of a watchpoint

Examples:

1
machine watch run1 delete 3  delete watchpoint 3

See also:

machine watch save

Save the watchpoints as the commands that add them.

Each line is a machine command that adds one watchpoint again. The command keeps its condition, ignore count and flags. A location written by a register is saved as its address.

1
machine watch run save [-h] file
Argument Does
file File to write, or - for the standard output

Examples:

1
2
machine watch run1 save stops.sh  write the commands to a file
machine watch run1 save - print them

See also:

machine watch hits

List the hits of watchpoints.

A hit is a watchpoint that stopped the run. It has the entry it stopped at, its machine time and the number of the watchpoint. The run log keeps each one, so a branch lists its parent’s hits before it.

Use run --back to switch onto a branch at the newest hit.

1
machine watch run hits [-h] [-n range]
Option Does
-n, --entries range Hits to list, by the entry each stopped at: N, A:B, A:, :B; or -N for the last N hits, -A:-B counted from the end (default: the last 20)

Examples:

1
2
machine watch run1 hits       the last 20 hits
machine watch run1 hits -n : every hit

Prints:

1
2
text  ENTRY VTIME # KIND EVENT
json hits

See also:

machine watch enable

Enable a watchpoint.

The machine arms an enabled watchpoint and not a disabled one. The run log keeps the change.

1
machine watch run enable [-h] [--once | --count n] number
Argument Does
number Number of the watchpoint
Option Does
--once Disable it again after its next hit, as GDB’s enable once
--count n Disable it again after N hits, as GDB’s enable count

Examples:

1
machine watch run1 enable 2  arm stop 2 again

See also:

machine watch disable

Disable a watchpoint.

The machine arms an enabled watchpoint and not a disabled one. The run log keeps the change.

1
machine watch run disable [-h] number
Argument Does
number Number of the watchpoint

Examples:

1
machine watch run1 disable 2  keep stop 2 and do not arm it

See also:

machine watch condition

Set the condition of a watchpoint.

A hit where the condition does not hold does not end the run. Without a condition the watchpoint has none.

1
machine watch run condition [-h] number [condition]
Argument Does
number Number of the watchpoint
[condition] Condition, such as ‘$rax == 0’ or ‘counter > 3’ (default: none)

Examples:

1
2
3
machine watch run1 condition 2 '$rax == 0'  where rax is 0
machine watch run1 condition 2 'n > 3' where n is above 3
machine watch run1 condition 2 no condition

See also:

machine watch ignore

Pass the next hits of a watchpoint.

Each hit where the condition holds is counted. A counted hit is passed while the ignore count lasts. A count of 0 stops at the next.

1
machine watch run ignore [-h] number count
Argument Does
number Number of the watchpoint
count Hits to pass

Examples:

1
machine watch run1 ignore 2 5  pass the next 5 hits

See also:

machine catch

List and manage catchpoints.

A catchpoint stops the run at an event of a task rather than at an address. The events are exec, exit, fork, system call, signal, fault, disk request, file mapped and C++ exception. The listing has the run’s catchpoints, each by its number. Use points to list them with the breakpoints and watchpoints.

The run keeps them in its run log, as it keeps its breakpoints. A run holds 8 catchpoints at most.

1
machine catch [-h] run command ...
Argument Does
run Run name

Examples:

1
2
machine catch run1                       the catchpoints of run1
machine catch run1 add fork --in tgid=1 stop where tgid 1 forks

Prints:

1
2
text  # KIND ADDRESS SIZE WHERE TGID HITS WHEN
json breakpoints

See also:

machine catch list

List the catchpoints.

The listing is the one the command prints with no verb.

1
machine catch run list [-h]

Examples:

1
machine catch run1 list  the catchpoints, by number

See also:

machine catch add

Add a catchpoint.

The catchpoint stops the run at an event of a task. The events are exec, exit, fork, vfork, syscall, signal, load, unload, fault and io. The C++ events throw, catch and rethrow are breakpoints in one tgid.

A random, choice or bytes catchpoint stops at a program’s decision of its kind before the answer. It stops at the site it names or one under it. A rule added at the stop answers that decision.

An exhausted catchpoint stops where a rule it names matches with its list used up. Use decisions refill at the stop, and the decision takes the first new value.

An event catchpoint stops after a program writes an event whose first key it names, such as antithesis_setup. The guest compares the key alone and reads no more of the event.

A coverage catchpoint stops after a new edge of the module it names, or of any module. It names a module by the number or name machine coverage lists.

A fault catchpoint stops where an injected fault fires. A syscall fault stops before its delay and its error. The hit names the call and the error, or delayed for a fault with no error. A site fault stops at the site, and the hit names the site.

An io catchpoint stops at a disk request as its task submits it. No disk fault has decided on the request yet, so a fault added at the stop decides on it. The hit names the request’s operation, sectors and tid in the form inject add takes them.

Use --file to stop at the requests of the files a pattern matches, and --op for reads or writes alone. A file matches whether it is opened or mapped before or after the catchpoint is added.

A syscall catchpoint names its system calls, and a signal catchpoint its signals, four at most. A fault catchpoint names system calls or the sites of inject add, such as disk. A load, unload or exec catchpoint names a path or a file’s name. Without one, every event of its kind stops the run.

Use --in to stop at the events of one task or one tgid alone. The run log keeps the catchpoint, and a branch has its parent’s.

Use --in comm=NAME to stop at the events of the tasks of that comm. The comm is read as tasks exist reads it. An exec catchpoint sees the new program’s comm. A task renamed after exec is seen by its new comm at the next fork, exec or exit.

An exit catchpoint sees the comm of the tgid’s leader, its last task to go. A worker of that comm in a tgid whose leader has another does not stop it. A syscall catchpoint with a comm makes the guest report every task’s calls while it is armed.

An exit is the end of a tgid, so an exit catchpoint takes --in tgid=N and not a tid. A throw, catch or rethrow catchpoint is a breakpoint at the C++ runtime’s function. It needs --in tgid=N and takes no values. It is one of the run’s 64 breakpoints.

1
2
3
4
machine catch run add [-h] [--in tid=N|tgid=N|comm=NAME] [--file pattern]
[--op {read,write}] [--disabled] [--ignore count] [--temporary]
[--condition condition] [--print format]
event [value ...]
Argument Does
event Event: exec, exit, fork, vfork, syscall, signal, load, unload, fault, io, random, choice, bytes, exhausted, event, coverage, throw, catch, rethrow
[value ...] System call of a syscall or fault catchpoint, signal, by name or number, or the path of a load, unload or exec
Option Does
--in tid=N|tgid=N|comm=NAME Stop at the events of this task, tgid or comm alone (default: any task)
--file pattern An io catchpoint’s requests of a file’s data: an absolute path, where * matches within a directory and ** across them (default: any file)
--op {read,write} An io catchpoint’s requests of one operation (default: both)
--disabled Add it and do not arm it
--ignore count Pass this many hits where the condition holds (default: 0)
--temporary Delete it at its first hit where the condition holds
--condition condition Count a hit only where this expression holds, as print takes one, such as ‘$rax == 0’
--print format Print this at a hit and go on. {EXPR} prints an expression as print takes one, {EXPR:x} in a print format letter: ‘n={counter} p={$rdi:x}’

Examples:

1
2
3
4
5
6
7
8
9
10
11
12
13
machine catch run1 add exec                        any task execs
machine catch run1 add syscall openat write either call
machine catch run1 add signal SIGSEGV --in tid=57 a signal of 57
machine catch run1 add load libssl.so.3 a library mapped
machine catch run1 add throw --in tgid=57 a C++ throw
machine catch run1 add exit --in comm=cat a cat ends
machine catch run1 add fault openat a fault fires
machine catch run1 add io --file '/db/*/c.bin' a disk request
machine catch run1 add io --op read --in tgid=57 a read of 57
machine catch run1 add choice ui.action before a choice
machine catch run1 add bytes request before a byte decision
machine catch run1 add exhausted 1 rule 1 used up
machine catch run1 add event antithesis_setup after setup

Prints:

1
2
text  Catchpoint N: EVENT, in tgid TGID, in tid TID or in comm NAME
json number kind tgid tid comm names

See also:

machine catch delete

Delete catchpoints.

The run log keeps the delete, so a branch forked before it keeps the catchpoint.

1
machine catch run delete [-h] number [number ...]
Argument Does
number [number ...] Number of a catchpoint

Examples:

1
machine catch run1 delete 4  delete catchpoint 4

See also:

machine catch save

Save the catchpoints as the commands that add them.

Each line is a machine command that adds one catchpoint again. The command keeps its condition, ignore count and flags.

1
machine catch run save [-h] file
Argument Does
file File to write, or - for the standard output

Examples:

1
machine catch run1 save stops.sh  write the commands to a file

See also:

machine catch hits

List the hits of catchpoints.

A hit is a catchpoint that stopped the run. It has the entry it stopped at, its machine time and the number of the catchpoint. A catchpoint’s hit also has its event. The run log keeps each one, so a branch lists its parent’s hits before it.

Use run --back to switch onto a branch at the newest hit.

1
machine catch run hits [-h] [-n range]
Option Does
-n, --entries range Hits to list, by the entry each stopped at: N, A:B, A:, :B; or -N for the last N hits, -A:-B counted from the end (default: the last 20)

Examples:

1
2
machine catch run1 hits       the last 20 hits
machine catch run1 hits -n : every hit

Prints:

1
2
text  ENTRY VTIME # KIND EVENT
json hits

See also:

machine catch enable

Enable a catchpoint.

The machine arms an enabled catchpoint and not a disabled one. The run log keeps the change.

1
machine catch run enable [-h] [--once | --count n] number
Argument Does
number Number of the catchpoint
Option Does
--once Disable it again after its next hit, as GDB’s enable once
--count n Disable it again after N hits, as GDB’s enable count

Examples:

1
machine catch run1 enable 4  arm catchpoint 4 again

See also:

machine catch disable

Disable a catchpoint.

The machine arms an enabled catchpoint and not a disabled one. The run log keeps the change.

1
machine catch run disable [-h] number
Argument Does
number Number of the catchpoint

Examples:

1
machine catch run1 disable 4  keep catchpoint 4 and do not arm it

See also:

machine catch condition

Set the condition of a catchpoint.

A hit where the condition does not hold does not end the run. Without a condition the catchpoint has none.

1
machine catch run condition [-h] number [condition]
Argument Does
number Number of the catchpoint
[condition] Condition, such as ‘$rax == 0’ or ‘counter > 3’ (default: none)

Examples:

1
machine catch run1 condition 4 '$rax == 0'  where rax is 0

See also:

machine catch ignore

Pass the next hits of a catchpoint.

Each hit where the condition holds is counted. A counted hit is passed while the ignore count lasts. A count of 0 stops at the next.

1
machine catch run ignore [-h] number count
Argument Does
number Number of the catchpoint
count Hits to pass

Examples:

1
machine catch run1 ignore 4 5  pass the next 5 hits

See also: