<feed xmlns='http://www.w3.org/2005/Atom'>
<title>misplays, branch master</title>
<subtitle>misplays debugger</subtitle>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/'/>
<entry>
<title>Manually uninstall breakpoints on process fork</title>
<updated>2025-09-08T01:03:26+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-09-03T05:21:34+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=0096d1896083f0df73e086b1e086ec52f610b7bf'/>
<id>0096d1896083f0df73e086b1e086ec52f610b7bf</id>
<content type='text'>
Previously, there was a bug on PTRACE_EVENT_FORK in which the forked
child process inherits all installed breakpoints due to their interrupt
instructions being resident in memory at the time of the fork, but the
debugger initializes the new process model with an empty list of
breakpoints.

There are some differing opinions on what the correct behavior ought to
be here, but at a minimum these two realities must be brought into sync
to prevent data corruption or any process crash of the fork child.

For the time being, manually "uninstall" the residual breakpoint
interrupts from a newly forked child that we attach to, leaving it with
no breakpoints of any kind.  Process model initialization in the
debugger is left as-is.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, there was a bug on PTRACE_EVENT_FORK in which the forked
child process inherits all installed breakpoints due to their interrupt
instructions being resident in memory at the time of the fork, but the
debugger initializes the new process model with an empty list of
breakpoints.

There are some differing opinions on what the correct behavior ought to
be here, but at a minimum these two realities must be brought into sync
to prevent data corruption or any process crash of the fork child.

For the time being, manually "uninstall" the residual breakpoint
interrupts from a newly forked child that we attach to, leaving it with
no breakpoints of any kind.  Process model initialization in the
debugger is left as-is.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Discard breakpoint list on process execve</title>
<updated>2025-09-08T01:03:26+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-09-02T23:14:33+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=95364d5a74eb9977b946b4a520eb2624f2c788ab'/>
<id>95364d5a74eb9977b946b4a520eb2624f2c788ab</id>
<content type='text'>
On exec, the program image and address space completely changes, so any
previously established breakpoints going forward are meaningless.  Even
if we are re-execing the same actual program, ASLR may invalidate the
addresses of BPs, let alone if the program is modified/recompiled.

The act of performing the exec already "uninstalls" any breakpoints by
reloading the memory space, adapt to this by simply freeing our list of
managed breakpoints from the debugger, without any additional
processing.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On exec, the program image and address space completely changes, so any
previously established breakpoints going forward are meaningless.  Even
if we are re-execing the same actual program, ASLR may invalidate the
addresses of BPs, let alone if the program is modified/recompiled.

The act of performing the exec already "uninstalls" any breakpoints by
reloading the memory space, adapt to this by simply freeing our list of
managed breakpoints from the debugger, without any additional
processing.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow multiple modifier chars in breakpoint CLI</title>
<updated>2025-09-08T01:03:26+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-08-25T06:47:44+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=9640f4b82b1030378bbf5e81ce205d0096cc6b73'/>
<id>9640f4b82b1030378bbf5e81ce205d0096cc6b73</id>
<content type='text'>
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'arm32'</title>
<updated>2025-09-07T10:43:22+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-09-07T10:43:22+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=1001499baec9e8d6fb25c641b2a0577ccd419d6f'/>
<id>1001499baec9e8d6fb25c641b2a0577ccd419d6f</id>
<content type='text'>
Add initial 32-bit ARM support and additionally build out internal
breakpoint design to allow the use of single-step oriented breakpoints.

* arm32:
  Always prune step breakpoints when uninstalling from memory
  Update detect_breakpoint() to better handle single stepping
  Add architecture-specific single step support
  Add 32-bit ARM architecture params
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add initial 32-bit ARM support and additionally build out internal
breakpoint design to allow the use of single-step oriented breakpoints.

* arm32:
  Always prune step breakpoints when uninstalling from memory
  Update detect_breakpoint() to better handle single stepping
  Add architecture-specific single step support
  Add 32-bit ARM architecture params
</pre>
</div>
</content>
</entry>
<entry>
<title>Always prune step breakpoints when uninstalling from memory</title>
<updated>2025-09-07T10:41:16+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-08-25T06:37:49+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=b2d6f5a4c75e8f68cb27edad38455375b500323b'/>
<id>b2d6f5a4c75e8f68cb27edad38455375b500323b</id>
<content type='text'>
On completion of an initial single step, we can and should discard these
breakpoints, even though the thread may not be "stopping" and go on to
continue in free-run.  They have served their purpose at this point and
we would like to avoid any other thread encountering them.

Also, whenever uninstall_breakpoints() is called, it is because we are
cycling a process's threads and are about to run resume_threads() which
currently does the work of re-computing a thread's step breakpoints if a
previous single step was interrupted, whether or not the step
breakpoints for that instant have already been figured.  So this also
addresses a bug where one thread, with repeatedly interrupted single
steps, would accumulate more and more redundant breakpoint entries until
it was finally able to proceed and eventually stop.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On completion of an initial single step, we can and should discard these
breakpoints, even though the thread may not be "stopping" and go on to
continue in free-run.  They have served their purpose at this point and
we would like to avoid any other thread encountering them.

Also, whenever uninstall_breakpoints() is called, it is because we are
cycling a process's threads and are about to run resume_threads() which
currently does the work of re-computing a thread's step breakpoints if a
previous single step was interrupted, whether or not the step
breakpoints for that instant have already been figured.  So this also
addresses a bug where one thread, with repeatedly interrupted single
steps, would accumulate more and more redundant breakpoint entries until
it was finally able to proceed and eventually stop.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Update detect_breakpoint() to better handle single stepping</title>
<updated>2025-09-07T10:41:16+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-08-24T11:10:14+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=4c31b8af05f5f388c1eea328a0ec69a6acb3a7f8'/>
<id>4c31b8af05f5f388c1eea328a0ec69a6acb3a7f8</id>
<content type='text'>
A stopped thread should sometimes restart, even if a breakpoint
interrupted a single step.  detect_breakpoint() and its interaction with
wait_thread() is updated such that any restart during a single step
scenario properly "requeues" the thread's run intent, by preserving the
doing/donext flags.

Furthermore, detect_breakpoint() ditches its call to get_breakpoint()
and considers any and all breakpoints impacting the current thread PC,
since they may each suggest different restarting requirements.  In
effect, the thread will only remain stopped if at least one relevant
breakpoint allows it to do so.

This reverts commit 5589a9e3afd5 ("Ignore breakpoints during
singlestep").

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A stopped thread should sometimes restart, even if a breakpoint
interrupted a single step.  detect_breakpoint() and its interaction with
wait_thread() is updated such that any restart during a single step
scenario properly "requeues" the thread's run intent, by preserving the
doing/donext flags.

Furthermore, detect_breakpoint() ditches its call to get_breakpoint()
and considers any and all breakpoints impacting the current thread PC,
since they may each suggest different restarting requirements.  In
effect, the thread will only remain stopped if at least one relevant
breakpoint allows it to do so.

This reverts commit 5589a9e3afd5 ("Ignore breakpoints during
singlestep").

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add architecture-specific single step support</title>
<updated>2025-09-07T10:41:16+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-08-13T05:04:57+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=4ea8ea650a1d81cf6362e1485d2fdce2617d8d8e'/>
<id>4ea8ea650a1d81cf6362e1485d2fdce2617d8d8e</id>
<content type='text'>
ARM 32-bit is the first platform added to misplays which lacks
underlying hardware support for single step traps - so the kernel does
not implement PTRACE_SINGLESTEP in this case.

We will work around this in a similar way as gdb does and how the kernel
used to do it until 2011.  arm_singlestep() implements logic which
disassembles the program's current instruction and analyzes it to
determine all possible next locations - eg: the next instruction in
memory, or the jump target of a branch instruction, etc.  This logic is
dynamically dispatched by the debugger core if an ARM build is running
in 32-bit mode.

arm_singlestep() uses breakpoints to stop execution at it's computed
next locations.  However, misplays is currently very careful about
controling the use of breakpoints in order to avoid issues with thread
single steps - so a new flag (called "step") is added to breakpoints to
enable the debugger to selectively install this subset of breakpoints
for each thread's single step action, and more or less keep treating
thread free-run as normal.  install_breakpoints() is updated to take a
"step" parameter to control which set of breakpoints is installed at any
given time.

resume_threads() is updated to perform this new single step dynamic
dispatch, and manage the installation of step breakpoints.

add_breakpoint() is also given a "step" parameter.  This initializes the
flag for the new breakpoint, but crucially is used to sort the new
breakpoint into the process breakpoint list.  Since step breakpoints
will always be installed first, prioritize them in the list so that
uninstall_breakpoints() doesn't corrupt memory when it runs the list
backward to remove them.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ARM 32-bit is the first platform added to misplays which lacks
underlying hardware support for single step traps - so the kernel does
not implement PTRACE_SINGLESTEP in this case.

We will work around this in a similar way as gdb does and how the kernel
used to do it until 2011.  arm_singlestep() implements logic which
disassembles the program's current instruction and analyzes it to
determine all possible next locations - eg: the next instruction in
memory, or the jump target of a branch instruction, etc.  This logic is
dynamically dispatched by the debugger core if an ARM build is running
in 32-bit mode.

arm_singlestep() uses breakpoints to stop execution at it's computed
next locations.  However, misplays is currently very careful about
controling the use of breakpoints in order to avoid issues with thread
single steps - so a new flag (called "step") is added to breakpoints to
enable the debugger to selectively install this subset of breakpoints
for each thread's single step action, and more or less keep treating
thread free-run as normal.  install_breakpoints() is updated to take a
"step" parameter to control which set of breakpoints is installed at any
given time.

resume_threads() is updated to perform this new single step dynamic
dispatch, and manage the installation of step breakpoints.

add_breakpoint() is also given a "step" parameter.  This initializes the
flag for the new breakpoint, but crucially is used to sort the new
breakpoint into the process breakpoint list.  Since step breakpoints
will always be installed first, prioritize them in the list so that
uninstall_breakpoints() doesn't corrupt memory when it runs the list
backward to remove them.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add 32-bit ARM architecture params</title>
<updated>2025-09-07T10:41:16+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-08-16T09:54:18+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=f9c7b14383a99ecc0a1e8266467804647acfaa3e'/>
<id>f9c7b14383a99ecc0a1e8266467804647acfaa3e</id>
<content type='text'>
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Print gdb message on startup instead of waiting silently</title>
<updated>2025-07-27T01:11:34+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-07-27T01:06:40+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=3b03d95a22a99df7d84647179a86f8c7f534868a'/>
<id>3b03d95a22a99df7d84647179a86f8c7f534868a</id>
<content type='text'>
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix possible segfault in dbg_detach</title>
<updated>2025-07-27T01:11:34+00:00</updated>
<author>
<name>Matt Hunter</name>
<email>m@lfurio.us</email>
</author>
<published>2025-07-27T01:02:43+00:00</published>
<link rel='alternate' type='text/html' href='http://normalmode.org/malf/misplays/commit/?id=6921d7a374f6981b45cd41f773820cd711f417e5'/>
<id>6921d7a374f6981b45cd41f773820cd711f417e5</id>
<content type='text'>
If dbg_attach fails, it calls this function to clean up before the
process in added to the main process list, so list_remove() is invalid.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If dbg_attach fails, it calls this function to clean up before the
process in added to the main process list, so list_remove() is invalid.

Signed-off-by: Matt Hunter &lt;m@lfurio.us&gt;
</pre>
</div>
</content>
</entry>
</feed>
