Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ All notable changes to the Simics Target Debug extension will be documented here
name of your own, or one picked like `take-snapshot` does. It uses the
Simics `SimUtils` service, and is disabled when the agent does not have
its snapshot commands.
- The Path Maps view lists the agent's rules from elsewhere, for example
added with `add-pathmap-entry` in Simics, read-only under
**Added Elsewhere**, like the Symbol Files view does.
- A path map rule can apply to several contexts: `pathMap` rules take a
`contexts` list of context IDs. Each context is sent to the agent as a rule
of its own. The old `context` is deprecated.
- Function breakpoints can be scoped with a TCF context query, written as
`start_kernel @? **/HasState=true`. It is sent as the `ContextQuery`
breakpoint property. **Add Function Breakpoint...** in Symbol Files also
works for files with a context query.
- A symbol file can apply to several contexts: `symbolFiles` entries take
a `contexts` list of IDs or names. The file is added to the memory map of
each context.

### Changed

Expand All @@ -37,6 +50,14 @@ All notable changes to the Simics Target Debug extension will be documented here
services and message types.
Stay in Console is gone from TCF Launch Configurations,
turn off `debug.focusEditorOnBreak` instead.
- Symbol files, function breakpoints and path map rules pick their contexts
the same way: a menu with all contexts, the selected call-stack context, a
checklist of contexts, or a context query. In TCF Launch Configurations,
the Contexts column of Symbol Files and Path Map chooses all contexts, a
list of contexts, or a query, and can pick contexts from a running session
to the agent.
- The `context` of a symbol file is deprecated, use `contexts`. A symbol file
can no longer have both contexts and a `contextQuery`.
- In TCF Launch Configurations, the Start, Duplicate and Delete buttons
above the form, and the Add and Delete All buttons above the list, stay
visible when you scroll.
Expand Down
115 changes: 70 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,11 @@ is not used, to stay within the TCF specification.

Use **Simics Target Debug: Add Function Breakpoint in Context...** from the
Command Palette, the Breakpoints toolbar, or a stack frame's context menu to
check one or more cores before entering the symbol. The selected call-stack
context is listed first and checked; accept with nothing checked to keep the
breakpoint global. Scoped entries appear as
choose the contexts before entering the symbol. A menu offers **All
contexts**, the selected call-stack context (chosen by default), **Pick
Contexts...** to check one or more cores, and **Context Query...** to enter a
TCF context query. The last two have a Back button to the menu. Scoped
entries appear as
`start_kernel @ armv8.cluster[0].core[0]` in the Breakpoints panel, or with a
comma-separated list such as
`start_kernel @ armv8.cluster[0].core[0], armv8.cluster[0].core[1]` when
Expand All @@ -278,26 +280,30 @@ context IDs, which are sent as the breakpoint's `ContextIds` and saved with
the breakpoint; selecting another frame does not change its scope. Context IDs
that contain commas cannot be used. The same syntax can be entered or edited
using the built-in function-breakpoint `+` or **Edit Function Breakpoint...**.
Scoped function breakpoints require the agent's `ContextIds` support and are
never silently planted globally when it is unavailable. Their scope applies
A context query is written after ` @? ` instead, such as
`start_kernel @? **/HasState=true`, and is sent as the breakpoint's
`ContextQuery`. Scoped function breakpoints require the agent's `ContextIds`
or `ContextQuery` support and are never silently planted globally when it is
unavailable. Their scope applies
to those contexts (and, for a process context, its threads), not other cores.

To change the contexts of an existing function breakpoint, use **Simics Target
Debug: Edit Function Breakpoint Contexts...** from the Command Palette or the
edit icon in the Breakpoints toolbar. VS Code does not tell extensions which
breakpoint is selected in the Breakpoints panel, so the command asks for the
function breakpoint when there is more than one. The checklist starts with the
breakpoint's current contexts checked; contexts that are not in the current
session stay listed so they are not dropped by accident. The breakpoint is
function breakpoint when there is more than one. The menu starts on the
breakpoint's current scope, and **Pick Contexts...** starts with its contexts
checked; contexts that are not in the current session stay listed so they are
not dropped by accident. The breakpoint is
replaced by one with the new name and the same enabled state, condition, hit
count, and log message, so it moves to the end of the Breakpoints panel.

In **Symbol Files**, right-click a configured symbol file with a context and
select **Add Function Breakpoint...** to enter a symbol directly. The breakpoint
uses the file's context rather than the selected call-stack core. Context names
are resolved to exact TCF IDs; unavailable or ambiguous contexts produce an error
instead of creating a global breakpoint. Files without a context do not offer
this action.
In **Symbol Files**, right-click a configured symbol file with contexts or a
context query and select **Add Function Breakpoint...** to enter a symbol
directly. The breakpoint uses the file's contexts or query rather than the
selected call-stack core. Context names are resolved to exact TCF IDs;
unavailable or ambiguous contexts produce an error instead of creating a global
breakpoint. Files for all contexts do not offer this action.

An address only has a meaning in one address space, so an instruction
breakpoint is limited to the process of the context shown in the Disassembly
Expand Down Expand Up @@ -559,6 +565,13 @@ buttons in the editor title switch between the form and the text of
under **Advanced** at the end, with `connectTimeout`. Others, like
`preLaunchTask`, are listed under **Other Attributes** when set, and can be
edited in the text.
- The **Contexts** column of Symbol Files and Path Map chooses all contexts,
a list of contexts separated by commas (IDs or names for symbol files, IDs
for path map rules), or a context query. Its checklist
button picks them with the picker of the Symbol Files view, from the
contexts of a running debug session to the configuration's agent; without
one, type them. Changing the contexts writes `contexts` or `contextQuery`
and removes the old single `context`.
- The options that apply to all configurations are [settings](#settings),
see the link at the end of the form.

Expand All @@ -577,7 +590,7 @@ addition to) `add-symbol-file` in Simics:
"port": 1534,
"symbolFiles": [
{ "path": "${workspaceFolder}/build/firmware.elf" },
{ "path": "build/app.elf", "context": "board.mb.cpu0.core[0][0]" },
{ "path": "build/app.elf", "contexts": ["board.mb.cpu0.core[0][0]", "board.mb.cpu0.core[0][1]"] },
{ "path": "build/driver.elf", "contextQuery": "**/HasState=true", "address": "0x40000000" },
{ "path": "build/module.elf", "address": "0xff000", "absolute": true }
]
Expand All @@ -587,13 +600,15 @@ addition to) `add-symbol-file` in Simics:
| Property | Description |
|----------------|-------------|
| `path` | The symbol file (ELF with debug information), as seen by the agent. Relative paths are relative to the workspace folder. |
| `context` | ID or name of the context the symbols apply to. |
| `contexts` | IDs or names of the contexts the symbols apply to. |
| `contextQuery` | A TCF context query selecting the contexts the symbols apply to, for example `**/HasState=true` for all processors. |
| `context` | Deprecated: one context ID or name, the same as `contexts` with one entry. |
| `address` | Relocation offset added to all addresses in the file, like the Simics command `add-symbol-file -relative`. It may be negative, for example `"-0x1000"`. If not set, the addresses in the file are used. With `absolute`, a load address instead, see below. |
| `absolute` | If `true`, `address` is a load address: the symbols are relocated so that the loadable segment with the lowest file offset (normally the first one, see `readelf -lW`) is at this address. |

Without `context` and `contextQuery` the symbols apply to all contexts. Both
can be combined.
Without `contexts` and `contextQuery` the symbols apply to all contexts. Set
only one of them; an entry with both is ignored with an error in the Debug
Console.

The two ways of relocating differ in what the address refers to. For a file
whose first loadable segment is linked at 0x3ff000, with `.text` at 0x400000:
Expand All @@ -606,28 +621,31 @@ whose first loadable segment is linked at 0x3ff000, with `.text` at 0x400000:

This works like "Load symbols" in the Eclipse TCF client: each file becomes a
memory map region that is sent to the agent with `MemoryMap.set` when
attaching, for the given context or for all contexts (`""`) with a
`ContextQuery`. The region has the `FileName`, plus the standard `BaseAddress`
attaching, for each of the given contexts or for all contexts (`""`) with a
`ContextQuery`. `MemoryMap.set` takes a single context, so a file with several
contexts is set in the memory map of each one. The region has the `FileName`, plus the standard `BaseAddress`
property for an offset (which is what Simics `add-symbol-file -relative` uses
too) or `Addr` for an absolute load address. The agent removes the regions
when the debug session ends. File names in the memory map are translated with
the path map rules, so `pathMap` also applies to symbol files.

To add a symbol file after attaching, open **Symbol Files** in Run and Debug
and use its **+** button (or **Simics Target Debug: Add Symbol File...** in the
Command Palette). Enter the path as seen by the agent, an optional context
ID/name and context query, and how the symbols are placed: the file addresses,
a relocation offset (like `-relative`), or an absolute load address. Relative
paths are resolved against the debug session's workspace folder. As you type
the path, local files and folders are suggested; select a folder to browse it,
or enter a path directly if the file is only available to the agent. The
context picker suggests cores returned by the agent's
`ContextQuery.query("HasState=true")` (or stateful RunControl contexts if that
service is unavailable). Selecting one uses its ID; you can also enter a name
directly or select **All contexts**. New entries are added to those from
Command Palette). Enter the path as seen by the agent, the contexts, and how
the symbols are placed: the file addresses, a relocation offset (like
`-relative`), or an absolute load address. Relative paths are resolved against
the debug session's workspace folder. As you type the path, local files and
folders are suggested; select a folder to browse it, or enter a path directly
if the file is only available to the agent. The contexts are picked with the
same checklist as for function breakpoints: it lists the cores returned by the
agent's `ContextQuery.query("HasState=true")` (or stateful RunControl contexts
if that service is unavailable). Choose **All contexts**, the selected
call-stack context, **Pick Contexts...** to check one or more, or **Context
Query...** to enter a TCF context query. Checking a listed context uses its
ID; type an ID or name that is not listed to check it too. New entries are added to those from
`symbolFiles` for the running session only unless explicitly saved. Use the
pencil action on a file in the Symbol Files view to edit its path, context,
context query, or load address. The same view lets you reload or remove a
pencil action on a file in the Symbol Files view to edit its path, contexts
(or context query), or load address. The same view lets you reload or remove a
mapping. If a configured file is missing on the VS Code host at startup, a
warning offers to update its path using the file picker. The file may still
exist on a remote TCF agent, so the warning can be dismissed. Mapping edits
Expand All @@ -640,7 +658,7 @@ Use **Save Symbol Files to Debug Configuration** (the save button in the
Symbol Files view, also available in the Command Palette) to persist the
session's current list. After confirmation, it replaces `symbolFiles` in
the active session's uniquely named workspace configuration in
`.vscode/launch.json`, including removals, context IDs, context queries,
`.vscode/launch.json`, including removals, contexts, context queries,
relocation offsets, and absolute load addresses. Saving an empty list clears
the configured symbol files. Paths are saved as reported by the session,
since symbol files are opened on the agent and may not exist on this host.
Expand Down Expand Up @@ -701,14 +719,14 @@ A prefix only matches at a path separator, so `/build/src` maps
compiled paths. Invalid rules are reported in the Debug Console and ignored.

Rules apply to **all contexts by default**. To scope a rule, set either
`context` to an exact context ID or `contextQuery` to a TCF query:
`contexts` to a list of exact context IDs or `contextQuery` to a TCF query:

```json
"pathMap": [
{
"source": "/build/src",
"destination": "${workspaceFolder}/cpu0",
"context": "cpu0"
"contexts": ["cpu0", "cpu1"]
},
{
"source": "/build/src",
Expand All @@ -719,11 +737,13 @@ Rules apply to **all contexts by default**. To scope a rule, set either
```

Both options use the protocol's `ContextQuery` property in `PathMap.set`.
For example, `context: "cpu0"` is sent as `ContextQuery: "ID=cpu0"`;
`contextQuery: "ID=cpu0"` is equivalent. IDs containing punctuation are
quoted and escaped as TCF query values. Set only one scope field per rule;
to select an ID together with additional criteria, use a query such as
`ID=cpu0,HasState=true`.
For example, `contexts: ["cpu0"]` is sent as `ContextQuery: "ID=cpu0"`;
`contextQuery: "ID=cpu0"` is equivalent. A query cannot select one of several
IDs, so a rule with several contexts is sent as one agent rule per context.
IDs containing punctuation are quoted and escaped as TCF query values. Set
only one scope field per rule; to select an ID together with additional
criteria, use a query such as `ID=cpu0,HasState=true`. The old `context`, a
single ID, still works and is deprecated.

Source lookups and their caches are context-specific, including rules
reported by `PathMap.get`, so identical compiled paths in different contexts
Expand All @@ -742,13 +762,15 @@ path map rule is made from the part of the two paths that differs, for example
`/build` → `/home/me` for `/build/fw/a.c` and `/home/me/fw/a.c`. The rule is
used at once for the rest of the session, including breakpoints, and can be
saved to the configuration's `pathMap` in launch.json. Before applying the
new rule, choose **All contexts**, **Context ID** (prefilled with the frame's
context ID), or **Context query**.
new rule, choose its contexts with the same picker as for breakpoints and
symbol files: **All contexts**, the frame's context, **Pick Contexts...** or
**Context Query...**.

During a Simics Target Debug session, **Run and Debug > Path Maps** lists the
session's rules in matching order, with the compiled prefix on the left and the
host destination and scope beside it. Use **+** to add a rule, click a rule to
edit its paths and scope, or use its trash button to remove it.
edit its paths and contexts, or use its trash button to remove it. The
contexts are chosen with the same picker as for breakpoints and symbol files.
The context menu has **Move Rule
Up/Down** to change priority. Changes apply immediately and refresh the call
stack; rules created by **Locate Source File...** appear here too.
Expand All @@ -758,8 +780,11 @@ in the current session's named configuration in `.vscode/launch.json` after
confirmation, including scopes, removals and ordering. Workspace destinations are
saved using `${workspaceFolder}`. Saving requires a workspace launch
configuration with a unique name; session-only changes do not modify it.
The view manages this debug client's rules, not rules installed separately
on the agent (for example with `add-pathmap-entry`).
The view manages this debug client's rules. Rules the agent has from
elsewhere, for example added with `add-pathmap-entry` in Simics or by another
client, are listed read-only under **Added Elsewhere**, read with
`PathMap.get`. Rules for another host are listed too, but are not used. The
view is refreshed when the agent reports that its path map changed.

## Source layout

Expand Down
Loading