Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- type Builder
- func (p Builder[F]) Build(trace tr.Trace[F]) TraceView
- func (p Builder[F]) WithCellWidth(cellWidth uint) Builder[F]
- func (p Builder[F]) WithComputed(computed bool) Builder[F]
- func (p Builder[F]) WithFormatting(formatting TraceFormatting) Builder[F]
- func (p Builder[F]) WithLimbs(limbs bool) Builder[F]
- func (p Builder[F]) WithSourceMap(srcmap corset.SourceMap) Builder[F]
- func (p Builder[F]) WithTitleWidth(titleWidth uint) Builder[F]
- func (p Builder[F]) WithVisibility(public func(tr.ModuleName) bool) Builder[F]
- type CellRefSet
- type ModuleConfig
- type ModuleData
- type ModuleFilter
- type ModuleFormatting
- type ModuleView
- type RegisterView
- type SourceColumn
- type SourceColumnId
- type TraceFilter
- type TraceFormatting
- type TraceView
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
Builder is responsible for building the viewing window for a trace.
func NewBuilder ¶
NewBuilder constructs a default builder.
func (Builder[F]) WithCellWidth ¶
WithCellWidth sets the maximum width of any cell in the view.
func (Builder[F]) WithComputed ¶
WithComputed determines whether to show low-level computed registers.
func (Builder[F]) WithFormatting ¶
func (p Builder[F]) WithFormatting(formatting TraceFormatting) Builder[F]
WithFormatting determines what formatting to use when rendering this view.
func (Builder[F]) WithLimbs ¶
WithLimbs determines whether to show columns as raw limbs, or as combined source-level registers.
func (Builder[F]) WithSourceMap ¶
WithSourceMap applies source-mapping information to the view. The main benefit of this is that it includes display modifiers.
func (Builder[F]) WithTitleWidth ¶
WithTitleWidth sets the maximum width of any row title in the view.
func (Builder[F]) WithVisibility ¶ added in v1.2.21
func (p Builder[F]) WithVisibility(public func(tr.ModuleName) bool) Builder[F]
WithVisibility applies a predicate determining whether a given module is publicly visible. When set, it overrides the public flag otherwise derived from the source map (or the default).
type CellRefSet ¶
type CellRefSet = set.AnySortedSet[tr.CellRef]
CellRefSet defines a type for sets of cell references.
type ModuleConfig ¶
type ModuleConfig interface {
// CellWidth returns the current maximum width of any cell in the table.
CellWidth() uint
// TitleWidth returns the current maximum width of any title in the table.
TitleWidth() uint
// SetCellWidth sets the maximum width of any cells in the table.
SetCellWidth(cellWidth uint)
// SetTitleWidth set the maximum width of any title in the table.
SetTitleWidth(titleWidth uint)
}
ModuleConfig encapsulates various configuration settings for a ModuleView.
type ModuleData ¶
type ModuleData interface {
// Id returns the module identifier
Id() sc.ModuleId
// Access abtract data for given set of register limbs register
DataOf([]register.LimbId) RegisterView
// Dimensions returns width and height of data
Dimensions() (uint, uint)
// Determine whether a given source column is active on a given row. A
// source column declared within a perspective will only be active when the
// given perspective's selector is enabled.
IsActive(SourceColumn, uint) bool
// Determines whether or not this module is externally visible.
IsPublic() bool
// Mapping returns the register limbs map being used by this module view.
Mapping() register.LimbsMap
// Name returns the name of the given module
Name() module.Name
// HasSourceColumn is useful for querying whether a source column exists
// with the given name.
HasSourceColumn(name string) (SourceColumnId, bool)
// SourceColumn returns the source column associated with a given id.
SourceColumn(col SourceColumnId) SourceColumn
// SourceColumnOf returns the source column associated with a given name.
SourceColumnOf(name string) SourceColumn
// SourceColumns returns the set of all known source columns.
SourceColumns() []SourceColumn
}
ModuleData abstracts the raw data of a module.
type ModuleFilter ¶
type ModuleFilter interface {
// Determine filter for cells of this column; if nil is returned, then
// column is ignored.
Column(SourceColumn) bool
// Window specifies a specific viewport to use.
Range() (start, end uint)
}
ModuleFilter is used to focus on a subset of columns in a given module.
func DefaultModuleFilter ¶
func DefaultModuleFilter() ModuleFilter
DefaultModuleFilter constructs a default column filter which filters nothing.
func NewModuleFilter ¶
func NewModuleFilter(start, end uint, filter func(SourceColumn) bool) ModuleFilter
NewModuleFilter constructs a filter from a given predicate.
type ModuleFormatting ¶
type ModuleFormatting interface {
// ColumnTitle returns optional formating for a given column title.
ColumnTitle(uint, string) termio.FormattedText
// ColumnTitle returns optional formating for a given row title.
RowTitle(SourceColumnId, string) termio.FormattedText
// Cell returns optional formating for a given cells in the trace.
Cell(SourceColumn, uint, string) termio.FormattedText
}
ModuleFormatting provides a generic mechanism for applying formatting to modules being refendered.
type ModuleView ¶
type ModuleView interface {
widget.TableSource
// Config returns config settings for this module.
Config() ModuleConfig
// Data abstracts the raw data of the underlying module.
Data() ModuleData
// Filter this view to produce a more focused view.
Filter(ModuleFilter) ModuleView
// Return offset position within module
Offset() (uint, uint)
// Set offset position within module
Goto(uint, uint)
// Window returns the active window for this module.
Window() Window
}
ModuleView abstracts an underlying trace module. For example, it manages the way that column data is displayed (e.g. in hex or in decimal, etc), whether or not register limbs are shown, and provides a mechanism for querying whether a given cell is "active" or not. Specifically, cells in a perspective are not active when that perspective is not active.
type RegisterView ¶
RegisterView provides an abstract view of a given column.
type SourceColumn ¶
type SourceColumn struct {
// column Name
Name string
// Display modifier
Display uint
// Determines whether this is a Computed column.
Computed bool
// Selector determines when column active.
Selector util.Option[string]
// RegisterId to which this column was allocated.
Register register.Id
// Limbs making up the register to which this column is allocated.
Limbs []register.Id
// contains filtered or unexported fields
}
SourceColumn provides key information to the inspector about source-level columns and their mapping to registers at the MIR/AIR levels (i.e. columns we would find in the trace).
type SourceColumnId ¶
SourceColumnId abstracts the idea of a source-level column declaration. Due to register allocation, we can have multiple source-level columns mapped to the same register; likewise, due to register splitting, we can have one register mapping to multiple limbs.
type TraceFilter ¶
type TraceFilter interface {
// Determine filter for columns in the given module; if nil is returned,
// then module is ignored.
Module(sc.ModuleId) ModuleFilter
}
TraceFilter is used to filter a given TraceView to focus on key aspects of the view, as required for the task at hand.
func DefaultTraceFilter ¶
func DefaultTraceFilter() TraceFilter
DefaultTraceFilter constructs a default filter which filters nothing.
func FilterForCells ¶
func FilterForCells(cells CellRefSet, padding uint) TraceFilter
FilterForCells returns a filter which focuses specifically on the given cells.
func NewTraceFilter ¶
func NewTraceFilter(fn func(sc.ModuleId) ModuleFilter) TraceFilter
NewTraceFilter constructs a filter from a given predicate.
type TraceFormatting ¶
type TraceFormatting interface {
Module(ModuleData) ModuleFormatting
}
TraceFormatting provides a top-level notion of formatting
func DefaultFormatter ¶
func DefaultFormatter() TraceFormatting
DefaultFormatter returns a default formatting
func NewCellFormatter ¶
func NewCellFormatter(cells CellRefSet, ansiEscapes bool) TraceFormatting
NewCellFormatter constructs a new cell formatter
type TraceView ¶
type TraceView interface {
// Filter this view to produce a more focused view.
Filter(TraceFilter) TraceView
// Access ith module view
Module(uint) ModuleView
// Sort the modules of this view
Sort(func(sc.ModuleId, sc.ModuleId) int) TraceView
// Determine number of modules in this view
Width() uint
}
TraceView provides an abstract view of a trace. As such, it may not include all modules found in a trace; rather it may include some subset matching a predicate, or only those which are publically visible, etc.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window provides a "view port" into the trace data.
func NewWindow ¶
func NewWindow(width uint, rows []SourceColumnId) Window
NewWindow constructs a new window
func (Window) Dimensions ¶
Dimensions returns the width and height this window.
func (Window) Row ¶
func (p Window) Row(index uint) SourceColumnId
Row returns the source column represented by the given row in this window.
func (Window) Rows ¶
func (p Window) Rows() []SourceColumnId
Rows returns the set of all active rows in this window.