From 10c186e80216d3b29f38385e92f26b79e71a6990 Mon Sep 17 00:00:00 2001 From: Philip Langer Date: Thu, 21 Mar 2024 14:43:26 +0100 Subject: [PATCH] Rename word to MAU and add link to settings docs https://github.com/eclipse-cdt-cloud/vscode-memory-inspector/issues/100 --- media/options-widget.css | 9 +++++ package.json | 8 ++--- src/common/memory-range.ts | 4 +-- src/plugin/manifest.ts | 18 +++++----- src/plugin/memory-webview-main.ts | 6 ++-- src/webview/columns/ascii-column.ts | 6 ++-- src/webview/columns/data-column.tsx | 26 +++++++------- src/webview/components/memory-table.tsx | 32 ++++++++--------- src/webview/components/memory-widget.tsx | 8 ++--- src/webview/components/options-widget.tsx | 43 +++++++++++++---------- src/webview/hovers/variable-hover.tsx | 8 ++--- src/webview/memory-webview-view.tsx | 12 +++---- src/webview/utils/view-types.ts | 4 +-- 13 files changed, 98 insertions(+), 86 deletions(-) diff --git a/media/options-widget.css b/media/options-widget.css index 73538a7..4cd3874 100644 --- a/media/options-widget.css +++ b/media/options-widget.css @@ -137,3 +137,12 @@ background-color: transparent; cursor: pointer; } + +.no-text-decoration { + text-decoration: none; +} + +.option-help-icon { + color: var(--vscode-button-background); + margin-left: 0.2em; +} diff --git a/package.json b/package.json index d9d0453..b95ba39 100644 --- a/package.json +++ b/package.json @@ -255,7 +255,7 @@ "default": "on", "description": "Refresh memory views when debugger stops" }, - "memory-inspector.groupings.bytesPerWord": { + "memory-inspector.groupings.bytesPerMAU": { "type": "number", "enum": [ 1, @@ -265,9 +265,9 @@ 16 ], "default": 1, - "description": "Default bytes per word" + "description": "Default bytes per MAU (Minimum Addressable Unit)" }, - "memory-inspector.groupings.wordsPerGroup": { + "memory-inspector.groupings.MAUsPerGroup": { "type": "number", "enum": [ 1, @@ -277,7 +277,7 @@ 16 ], "default": 1, - "description": "Default words per group" + "description": "Default MAUs (Minimum Addressable Units) per group" }, "memory-inspector.groupings.groupsPerRow": { "type": [ diff --git a/src/common/memory-range.ts b/src/common/memory-range.ts index 4d8d97f..45ec989 100644 --- a/src/common/memory-range.ts +++ b/src/common/memory-range.ts @@ -122,8 +122,8 @@ export function areVariablesEqual(one: BigIntVariableRange, other: BigIntVariabl && one.value === other.value; } -export function toOffset(startAddress: bigint, targetAddress: bigint, wordSize: number): number { - return Number(targetAddress - startAddress) * (wordSize / 8); +export function toOffset(startAddress: bigint, targetAddress: bigint, mauSize: number): number { + return Number(targetAddress - startAddress) * (mauSize / 8); } export enum Endianness { diff --git a/src/plugin/manifest.ts b/src/plugin/manifest.ts index e27a330..98f76fc 100644 --- a/src/plugin/manifest.ts +++ b/src/plugin/manifest.ts @@ -29,16 +29,16 @@ export const DEFAULT_DEBUG_TYPES = ['gdb', 'embedded-debug', 'arm-debugger']; export const CONFIG_REFRESH_ON_STOP = 'refreshOnStop'; export const DEFAULT_REFRESH_ON_STOP = 'on'; -// Words -// - Bytes per Word -export const CONFIG_BYTES_PER_WORD = 'groupings.bytesPerWord'; -export const CONFIG_BYTES_PER_WORD_CHOICES = [1, 2, 4, 8, 16] as const; -export const DEFAULT_BYTES_PER_WORD = 1; +// MAUs (Minimum Addressable Units) +// - Bytes per MAU +export const CONFIG_BYTES_PER_MAU = 'groupings.bytesPerMAU'; +export const CONFIG_BYTES_PER_MAU_CHOICES = [1, 2, 4, 8, 16] as const; +export const DEFAULT_BYTES_PER_MAU = 1; -// - Words per Group -export const CONFIG_WORDS_PER_GROUP = 'groupings.wordsPerGroup'; -export const CONFIG_WORDS_PER_GROUP_CHOICES = [1, 2, 4, 8, 16] as const; -export const DEFAULT_WORDS_PER_GROUP = 1; +// - MAU per Group +export const CONFIG_MAUS_PER_GROUP = 'groupings.MAUsPerGroup'; +export const CONFIG_MAUS_PER_GROUP_CHOICES = [1, 2, 4, 8, 16] as const; +export const DEFAULT_MAUS_PER_GROUP = 1; // - Groups per Row export const CONFIG_GROUPS_PER_ROW = 'groupings.groupsPerRow'; diff --git a/src/plugin/memory-webview-main.ts b/src/plugin/memory-webview-main.ts index ec585df..38f9473 100644 --- a/src/plugin/memory-webview-main.ts +++ b/src/plugin/memory-webview-main.ts @@ -255,8 +255,8 @@ export class MemoryWebview implements vscode.CustomReadonlyEditorProvider { protected getMemoryViewSettings(messageParticipant: WebviewIdMessageParticipant, title: string): MemoryViewSettings { const memoryInspectorConfiguration = vscode.workspace.getConfiguration(manifest.PACKAGE_NAME); - const bytesPerWord = memoryInspectorConfiguration.get(manifest.CONFIG_BYTES_PER_WORD, manifest.DEFAULT_BYTES_PER_WORD); - const wordsPerGroup = memoryInspectorConfiguration.get(manifest.CONFIG_WORDS_PER_GROUP, manifest.DEFAULT_WORDS_PER_GROUP); + const bytesPerMau = memoryInspectorConfiguration.get(manifest.CONFIG_BYTES_PER_MAU, manifest.DEFAULT_BYTES_PER_MAU); + const mausPerGroup = memoryInspectorConfiguration.get(manifest.CONFIG_MAUS_PER_GROUP, manifest.DEFAULT_MAUS_PER_GROUP); const groupsPerRow = memoryInspectorConfiguration.get(manifest.CONFIG_GROUPS_PER_ROW, manifest.DEFAULT_GROUPS_PER_ROW); const endianness = memoryInspectorConfiguration.get(manifest.CONFIG_ENDIANNESS, manifest.DEFAULT_ENDIANNESS); const scrollingBehavior = memoryInspectorConfiguration.get(manifest.CONFIG_SCROLLING_BEHAVIOR, manifest.DEFAULT_SCROLLING_BEHAVIOR); @@ -267,7 +267,7 @@ export class MemoryWebview implements vscode.CustomReadonlyEditorProvider { const addressRadix = memoryInspectorConfiguration.get(manifest.CONFIG_ADDRESS_RADIX, manifest.DEFAULT_ADDRESS_RADIX); const showRadixPrefix = memoryInspectorConfiguration.get(manifest.CONFIG_SHOW_RADIX_PREFIX, manifest.DEFAULT_SHOW_RADIX_PREFIX); return { - messageParticipant, title, bytesPerWord, wordsPerGroup, groupsPerRow, + messageParticipant, title, bytesPerMau, mausPerGroup, groupsPerRow, endianness, scrollingBehavior, visibleColumns, addressPadding, addressRadix, showRadixPrefix }; } diff --git a/src/webview/columns/ascii-column.ts b/src/webview/columns/ascii-column.ts index 794b987..b90deb7 100644 --- a/src/webview/columns/ascii-column.ts +++ b/src/webview/columns/ascii-column.ts @@ -33,9 +33,9 @@ export class AsciiColumn implements ColumnContribution { readonly label = 'ASCII'; readonly priority = 3; render(range: BigIntMemoryRange, memory: Memory, options: TableRenderOptions): ReactNode { - const wordSize = options.bytesPerWord * 8; - const startOffset = toOffset(memory.address, range.startAddress, wordSize); - const endOffset = toOffset(memory.address, range.endAddress, wordSize); + const mauSize = options.bytesPerMau * 8; + const startOffset = toOffset(memory.address, range.startAddress, mauSize); + const endOffset = toOffset(memory.address, range.endAddress, mauSize); let result = ''; for (let i = startOffset; i < endOffset; i++) { result += getASCIIForSingleByte(memory.bytes[i]); diff --git a/src/webview/columns/data-column.tsx b/src/webview/columns/data-column.tsx index 6e5185d..e968f8e 100644 --- a/src/webview/columns/data-column.tsx +++ b/src/webview/columns/data-column.tsx @@ -41,30 +41,30 @@ export class DataColumn implements ColumnContribution { protected renderGroups(range: BigIntMemoryRange, memory: Memory, options: TableRenderOptions): React.ReactNode { const groups = []; - let words: React.ReactNode[] = []; + let maus: React.ReactNode[] = []; for (let address = range.startAddress; address < range.endAddress; address++) { - words.push(this.renderWord(memory, options, address)); - if (words.length % options.wordsPerGroup === 0) { - this.applyEndianness(words, options); + maus.push(this.renderMau(memory, options, address)); + if (maus.length % options.mausPerGroup === 0) { + this.applyEndianness(maus, options); const isLast = address + 1n >= range.endAddress; const style: React.CSSProperties | undefined = isLast ? undefined : this.byteGroupStyle; - groups.push({words}); - words = []; + groups.push({maus}); + maus = []; } } - if (words.length) { groups.push({words}); } + if (maus.length) { groups.push({maus}); } return groups; } - protected renderWord(memory: Memory, options: TableRenderOptions, currentAddress: bigint): React.ReactNode { - const initialOffset = toOffset(memory.address, currentAddress, options.bytesPerWord * 8); - const finalOffset = initialOffset + options.bytesPerWord; + protected renderMau(memory: Memory, options: TableRenderOptions, currentAddress: bigint): React.ReactNode { + const initialOffset = toOffset(memory.address, currentAddress, options.bytesPerMau * 8); + const finalOffset = initialOffset + options.bytesPerMau; const bytes: React.ReactNode[] = []; for (let i = initialOffset; i < finalOffset; i++) { bytes.push(this.renderEightBits(memory, currentAddress, i)); } this.applyEndianness(bytes, options); - return {bytes}; + return {bytes}; } protected applyEndianness(group: T[], options: TableRenderOptions): T[] { @@ -118,8 +118,8 @@ export namespace DataColumn { const charactersWidth = Math.round((characterWidthInContainer(element, '0') + Number.EPSILON) * 100) / 100; const groupWidth = charactersWidth * 2 // characters per byte - * options.bytesPerWord - * options.wordsPerGroup + * options.bytesPerMau + * options.mausPerGroup + Styles.MARGIN_RIGHT_PX; // Accommodate the non-existent margin of the final element. const maxGroups = Math.max((columnWidth + Styles.MARGIN_RIGHT_PX) / groupWidth, 1); diff --git a/src/webview/components/memory-table.tsx b/src/webview/components/memory-table.tsx index 3124503..a860d76 100644 --- a/src/webview/components/memory-table.tsx +++ b/src/webview/components/memory-table.tsx @@ -142,8 +142,8 @@ interface MemoryTableProps extends TableRenderOptions, MemoryDisplayConfiguratio interface MemoryRowListOptions { numRows: number; - wordsPerRow: number; - bigWordsPerRow: bigint; + mausPerRow: number; + bigMausPerRow: bigint; } interface MemoryRowData { @@ -165,14 +165,14 @@ interface MemoryTableState { hoverContent: React.ReactNode; } -export type MemorySizeOptions = Pick & { groupsPerRow: number }; +export type MemorySizeOptions = Pick & { groupsPerRow: number }; export namespace MemorySizeOptions { export function create(props: MemoryTableProps, state: MemoryTableState): MemorySizeOptions { - const { bytesPerWord, wordsPerGroup } = props; + const { bytesPerMau, mausPerGroup } = props; return { - bytesPerWord, + bytesPerMau, groupsPerRow: tryToNumber(props.groupsPerRow) ?? state.groupsPerRowToRender, - wordsPerGroup + mausPerGroup }; } } @@ -234,7 +234,7 @@ export class MemoryTable extends React.PureComponent { const rows: MemoryRowData[] = []; for (let i = 0; i < options.numRows; i++) { - const startAddress = memory.address + options.bigWordsPerRow * BigInt(i); + const startAddress = memory.address + options.bigMausPerRow * BigInt(i); rows.push(this.createMemoryRow(i, startAddress, options)); } @@ -518,22 +518,18 @@ export class MemoryTable extends React.PureComponent candidate.active)} memory={this.props.memory} endianness={this.props.endianness} - bytesPerWord={this.props.bytesPerWord} - wordsPerGroup={this.props.wordsPerGroup} + bytesPerMau={this.props.bytesPerMau} + mausPerGroup={this.props.mausPerGroup} groupsPerRow={this.props.groupsPerRow} effectiveAddressLength={this.props.effectiveAddressLength} fetchMemory={this.props.fetchMemory} diff --git a/src/webview/components/options-widget.tsx b/src/webview/components/options-widget.tsx index cd23952..5b27c92 100644 --- a/src/webview/components/options-widget.tsx +++ b/src/webview/components/options-widget.tsx @@ -26,7 +26,7 @@ import { validateCount, validateMemoryReference, validateOffset } from '../../co import { Endianness } from '../../common/memory-range'; import { MemoryOptions, ReadMemoryArguments, SessionContext } from '../../common/messaging'; import { tryToNumber } from '../../common/typescript'; -import { CONFIG_BYTES_PER_WORD_CHOICES, CONFIG_GROUPS_PER_ROW_CHOICES, CONFIG_WORDS_PER_GROUP_CHOICES } from '../../plugin/manifest'; +import { CONFIG_BYTES_PER_MAU_CHOICES, CONFIG_GROUPS_PER_ROW_CHOICES, CONFIG_MAUS_PER_GROUP_CHOICES } from '../../plugin/manifest'; import { TableRenderOptions } from '../columns/column-contribution-service'; import { AddressPaddingOptions, MemoryState, SerializedTableRenderOptions } from '../utils/view-types'; import { createSectionVscodeContext } from '../utils/vscode-contexts'; @@ -58,8 +58,8 @@ const enum InputId { Address = 'address', Offset = 'offset', Length = 'length', - BytesPerWord = 'word-size', - WordsPerGroup = 'words-per-group', + BytesPerMau = 'mau-size', + MausPerGroup = 'maus-per-group', GroupsPerRow = 'groups-per-row', EndiannessId = 'endianness', AddressPadding = 'address-padding', @@ -304,31 +304,38 @@ export class OptionsWidget extends React.Component )} -

Memory Format

+

Memory Format + + + +