GP-5265: Move schedule display from Threads to Listing tabs

This commit is contained in:
Dan 2025-03-05 15:07:14 +00:00
parent 4cf5d25bc8
commit 273dfba1ac
18 changed files with 40 additions and 31 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

View file

@ -61,18 +61,16 @@
<H3><A name="goto_time"></A>Go To Time</H3> <H3><A name="goto_time"></A>Go To Time</H3>
<P>This action is available when a trace is active. It prompts for a <EM>time schedule</EM>. <P>This action is available when a trace is active. It prompts for a <EM>time schedule</EM>. In
This is the same form as the notation in the sub-title of the <A href= many cases, it is simply the snapshot number, e.g., <CODE>3</CODE>, which will go to the
"help/topics/DebuggerThreadsPlugin/DebuggerThreadsPlugin.html">Threads</A> window. In many snapshot with key 3. It may optionally include an emulation schedule. For example,
cases, it is simply the snapshot number, e.g., <CODE>3</CODE>, which will go to the snapshot <CODE>3:10</CODE> will use snapshot 3 for an emulator's initial state and step 10 machine
with key 3. It may optionally include an emulation schedule. For example, <CODE>3:10</CODE> instructions on snapshot 3's event thread. If the snapshot does not give an event thread, then
will use snapshot 3 for an emulator's initial state and step 10 machine instructions on the thread must be specified in the expression, e.g., <CODE>3:t1-10</CODE>. That expression
snapshot 3's event thread. If the snapshot does not give an event thread, then the thread must will start at snapshot 3, get the thread with key 1, and step it 10 machine instructions. The
be specified in the expression, e.g., <CODE>3:t1-10</CODE>. That expression will start at stepping commands can be repeated any number of times, separated by semicolons, to step threads
snapshot 3, get the thread with key 1, and step it 10 machine instructions. The stepping in a specified sequence. For example, <CODE>3:t1-10;t2-5</CODE> will do the same as before,
commands can be repeated any number of times, separated by semicolons, to step threads in a then get thread 2 and step it 5 times.</P>
specified sequence. For example, <CODE>3:t1-10;t2-5</CODE> will do the same as before, then get
thread 2 and step it 5 times.</P>
<P>The emulator's state can also be patched by the schedule. Instead of specifying the number <P>The emulator's state can also be patched by the schedule. Instead of specifying the number
of steps, write a <EM>Sleigh</EM> statement, e.g., <CODE>3:t1-{r0=0x1234};10</CODE>. This will of steps, write a <EM>Sleigh</EM> statement, e.g., <CODE>3:t1-{r0=0x1234};10</CODE>. This will

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Before After
Before After

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -165,7 +165,6 @@ public class DebuggerThreadsProvider extends ComponentProviderAdapter {
forSnapsListener.setTrace(coordinates.getTrace()); forSnapsListener.setTrace(coordinates.getTrace());
setSubTitle(coordinates.getTime().toString());
contextChanged(); contextChanged();
} }

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -25,11 +25,11 @@ import ghidra.app.plugin.core.debug.event.*;
import ghidra.app.plugin.core.debug.gui.DebuggerResources; import ghidra.app.plugin.core.debug.gui.DebuggerResources;
import ghidra.app.plugin.core.debug.gui.DebuggerResources.*; import ghidra.app.plugin.core.debug.gui.DebuggerResources.*;
import ghidra.app.plugin.core.debug.gui.thread.DebuggerTraceFileActionContext; import ghidra.app.plugin.core.debug.gui.thread.DebuggerTraceFileActionContext;
import ghidra.app.plugin.core.progmgr.MultiTabPlugin;
import ghidra.app.services.DebuggerTargetService; import ghidra.app.services.DebuggerTargetService;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
import ghidra.debug.api.target.Target; import ghidra.debug.api.target.Target;
import ghidra.debug.api.target.TargetPublicationListener; import ghidra.debug.api.target.TargetPublicationListener;
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
import ghidra.framework.model.*; import ghidra.framework.model.*;
import ghidra.framework.plugintool.*; import ghidra.framework.plugintool.*;
import ghidra.framework.plugintool.annotation.AutoServiceConsumed; import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
@ -117,7 +117,17 @@ public class DebuggerTraceTabPanel extends GTabPanel<Trace>
} }
private String getNameForTrace(Trace trace) { private String getNameForTrace(Trace trace) {
return DomainObjectDisplayUtils.getTabText(trace); String name = DomainObjectDisplayUtils.getTabText(trace);
DebuggerCoordinates current = traceManager.getCurrentFor(trace);
if (current == DebuggerCoordinates.NOWHERE) {
// TODO: Could use view's snap and time table's schedule
return name + " (?)";
}
String schedule = current.getTime().toString();
if (schedule.length() > 15) {
schedule = "..." + schedule.substring(schedule.length() - 12);
}
return name + " (" + schedule + ")";
} }
private Icon getIconForTrace(Trace trace) { private Icon getIconForTrace(Trace trace) {
@ -179,6 +189,7 @@ public class DebuggerTraceTabPanel extends GTabPanel<Trace>
Trace trace = evt.getActiveCoordinates().getTrace(); Trace trace = evt.getActiveCoordinates().getTrace();
try (Suppression supp = cbCoordinateActivation.suppress(null)) { try (Suppression supp = cbCoordinateActivation.suppress(null)) {
selectTab(trace); selectTab(trace);
refreshTab(trace);
} }
} }
else if (event instanceof TraceClosedPluginEvent evt) { else if (event instanceof TraceClosedPluginEvent evt) {

View file

@ -309,6 +309,7 @@ public class TutorialDebuggerScreenShots extends GhidraScreenShotGenerator
public void testGettingStarted_DisassemblyAfterLaunch() throws Throwable { public void testGettingStarted_DisassemblyAfterLaunch() throws Throwable {
launchProgramInGdb(); launchProgramInGdb();
Thread.sleep(7000);
captureToolWindow(1920, 1080); captureToolWindow(1920, 1080);
} }
@ -354,7 +355,7 @@ public class TutorialDebuggerScreenShots extends GhidraScreenShotGenerator
launchProgramInGdb(); launchProgramInGdb();
placeBreakpointsSRandRand(); placeBreakpointsSRandRand();
tool.setSize(1920, 1080); runSwing(() -> tool.setSize(1920, 1080));
captureProvider(DebuggerBreakpointsProvider.class); captureProvider(DebuggerBreakpointsProvider.class);
} }

View file

@ -238,16 +238,16 @@ snapshot, Ghidra will read that variable from the live target, capture
it, and provide its value to the emulator.</p> it, and provide its value to the emulator.</p>
<section id="stepping-schedules" class="level3"> <section id="stepping-schedules" class="level3">
<h3>Stepping Schedules</h3> <h3>Stepping Schedules</h3>
<p>If you had not noticed before, the subtitle of the Threads window <p>If you had not noticed before, the trace tabs include the current
gives the current snapshot number. If you have stepped in the emulator, snapshot number. If you have stepped in the emulator, it will also
it will also contain the sequence of steps emulated. Recall the contain the sequence of steps emulated. Recall the <em>time</em> element
<em>time</em> element of the Debuggers <em>coordinates</em>. (See the of the Debuggers <em>coordinates</em>. (See the <a
<a href="A5-Navigation.html">Navigation</a> module if you need a href="A5-Navigation.html">Navigation</a> module if you need a
refresher.) The time element, called the <em>schedule</em>, consists of refresher.) The time element, called the <em>schedule</em>, consists of
both the current snapshot and the sequence of steps to emulate. The both the current snapshot and the sequence of steps to emulate. The tab
subtitle displays that schedule. If you have done any patching of the displays that schedule. If you have done any patching of the emulators
emulators state, you may notice some more complicated “steps” in the state, you may notice some more complicated “steps” in the schedule. The
schedule. The syntax is:</p> syntax is:</p>
<ul> <ul>
<li><em>Schedule</em><em>Snapshot</em> [ <code>:</code> [ <li><em>Schedule</em><em>Snapshot</em> [ <code>:</code> [
<em>Step</em> ( <code>;</code> <em>Step</em> ) * ] [ <code>.</code> <em>Step</em> ( <code>;</code> <em>Step</em> ) * ] [ <code>.</code>

View file

@ -73,12 +73,12 @@ If the emulated target reads a variable that Ghidra has not yet captured into th
### Stepping Schedules ### Stepping Schedules
If you had not noticed before, the subtitle of the Threads window gives the current snapshot number. If you had not noticed before, the trace tabs include the current snapshot number.
If you have stepped in the emulator, it will also contain the sequence of steps emulated. If you have stepped in the emulator, it will also contain the sequence of steps emulated.
Recall the *time* element of the Debugger's *coordinates*. Recall the *time* element of the Debugger's *coordinates*.
(See the [Navigation](A5-Navigation.md) module if you need a refresher.) (See the [Navigation](A5-Navigation.md) module if you need a refresher.)
The time element, called the *schedule*, consists of both the current snapshot and the sequence of steps to emulate. The time element, called the *schedule*, consists of both the current snapshot and the sequence of steps to emulate.
The subtitle displays that schedule. The tab displays that schedule.
If you have done any patching of the emulator's state, you may notice some more complicated "steps" in the schedule. If you have done any patching of the emulator's state, you may notice some more complicated "steps" in the schedule.
The syntax is: The syntax is:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 213 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 202 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before After
Before After