- Add dedicated ReportDebugger application class for the case where we're
asked to do nothing more than save a report. Also add a corresponding
UserInterface subclass whose sole purpose is to take those necessary
actions and then exit.
- When the debugger is invoked via the --save-report option, we now start
via the aforementioned report/interface rather than piggybacking on the
CLI.
- Clean up CommandLineUserInterface/CliContext to remove handling for the
report saving option.
Should hopefully resolve#12155.
Worker/Job:
- Add job listener hooks for when work actually begins for a job,
and when a job is suspended to wait for user input.
- Add hook for setting a job description string, and implement in several
subclasses.
LoadImageDebugInfoJob:
- Get rid of ImageDebugInfoJobListener since its functionality can be
handled via the more general job wait for user input hook. Refactor
accordingly.
TeamDebugger:
- Adjust to use new job hooks. When a worker job is initiated, we now
check if the job has a description, and if so pass it on to the UI
to display a notification.
DwarfLoadingStateHandler:
- Notify the UI when a package download is in progress.
With these changes, the status bar now notifies the user if any of the
following actions are in flight:
1) Loading/parsing debug information
2) Stack trace retrieval
3) Source code retrieval
4) Downloading a debug info package
TeamDebugger:
- When notified that an image debug info job has started loading,
notify the user interface accordingly. Also reset status to a ready
state whenever all in-flight jobs are complete. This allows the
user to know when then debug subsystem is still in the process
of parsing debug information, as this can be time consuming for
larger programs/libraries.
UserInterface:
- Add new hook function used to notify the UI that some form of
background work is taking place for informational purposes,
i.e. no interaction required. Implement accordingly in
GraphicalUserInterface.
fts.c:
- Our fts functions were imported from FreeBSD and consequently did not
use the same weak alias methodology that most of our glibc-derived
POSIX functions do. These subsequently wound up clashing with the
implementation of said functions in current versions of coreutils,
resulting in assertion failures when e.g. running a program through
stdbuf, since the BSD-derived functions had different flag constraints
than their GNU peers. Consequently, this change adjusts the fts_*
family of functions to similarly be exported as weak symbols so they
can be preempted.
- Rather than depending just on mount_server's launch, instead use
a condition that waits for the volumes mounted event. Had missed
the existence of this one previously.
- Adjust launch configuration such that media_server requires mount_server.
Otherwise, if the user has specified sound files for any events that are
on non-boot disks, these won't be found/loaded properly during the boot
process.
UiUtils:
- Fix incorrect check to see if we had hit the bounds of the current memory
block that would cause us to overflow the block's data buffer if incorrect
length values were passed in.
ThreadHandler:
- Simplify SetBreakpointAndRun() to always use the debugger interface to
continue execution, since the latter is now intelligent enough to determine
how to handle that in all cases. Adjust callers accordingly.
- B_DEBUG_MESSAGE_CONTINUE_THREAD now checks if the thread in question
is in a suspended state rather than waiting on the debug nub port, and
if so, handles resuming it automatically. This allows the continue message
to be used on the main thread of a team that was freshly created under
debug control without the API user having to be cognizant of the distinction.
- SetItemCollapsed()/IsItemCollapsed() didn't properly handle inverting
values when mapping between the collapsed flag and the layout item's
internal visibility flag, leading to them having the opposite semantics
from what their name would suggest.
TeamDebugger:
- When we're notified that the target team has called exec(), take all
necessary steps to prepare. These include saving settings for the old
team, clearing out breakpoints, resetting signal dispositions, and
removing the old team's image list. Also set a flag indicating an exec
is pending for later processing.
- On image load notification, if the pending flag is set, check if the
new image is the app image, and if so update the team's name to
the new image, load that respective team's settings, and set a
temporary breakpoint in its main() so the user has a chance to
perform any additional desired actions before starting execution
in the new executable.
- When asked to load settings, post a message and do so in the window's
message loop. This avoids a lock order reversal when asked to do so
later as a result of exec() changing the target image out.
Team:
- Add listener hook and event type for rename events. These occur on exec()
since at this point we're running a different executable.
TeamWindow:
- Factor out code for generating window title into a helper, and use from both
window initialization and newly implemented rename listener hook.
- SetBreakpointAndRun() now takes an additional argument indicating if this
invocation is for a fresh run of a team or not, as continuing the thread's
execution needs to be done differently in the two cases.
ClearImages():
- Removes all existing images from the team's image list and notifies callers.
To be used in case of an exec().
ClearSignalDispositionMappings():
- Remove any existing custom signal disposition mappings. This is intended to
be used in preparation for loading new ones from a team after exec() is
called.
VariablesView:
- Factor out setting up a variable edit request into a helper function.
Adjust table node invocation accordingly.
- Add Edit variable context menu item if appropriate.
- Don't return result of SelectOptionFor(). It's possible to attempt
to edit an enum value that hasn't yet been initialized, in which case
its current value might not map to any of the defined enumerations, and
the resulting error would prevent editing from being allowed.
- According to POSIX, these functions should map to whatever's appropriate
for the platform's intmax_t size, which in our case is a 64-bit integer.
Our (2004) implementation, however, was calling the 32-bit variations of
strto*(), leading to truncation for larger values.
FloatValueFormatter:
- Implement parsing/validation hooks.
FloatValueHandler:
- Implement GetTableCellValueEditor() to accordingly return a
(newly implemented) TableCellFloatEditor. This allows variable
value editing for float/double variables.
FloatValue:
- Store value as variant rather than double so as to be able to
later differentiate between float vs double.
PrimitiveValueNode:
- Construct float nodes with variant value.
VariablesView:
- Intercept table node invocations. If the invocation corresponds to
a writable variable, request a corresponding editor and bring up a
an edit window for it.
- Handle requests from the edit window to write the final updated value
of the variable.
This implements the last missing piece for ticket #9708, except for an
editor for floats.
VariablesView::Listener:
- Add hook for requesting value node value updates.
TeamWindow:
- Implement VariablesView listener hook and forward accordingly to
TeamDebugger.
WriteValueNodeJob:
- Implement async job that creates a ValueWriter to update a variable
value on request.
UserInterfaceListener:
- Add hook for requesting that a node be updated with a new value.
Implement in TeamDebugger by scheduling a WriteValueNodeJob.
VariableEditWindow:
- Implement container window for variable value editors. While
not as ideal as initially intended, this will handle presenting value
editing to the user until more work is done on the table cell editing
aspect of things.
TableCellOptionPopUpEditor:
- Add virtual hook for retrieving the final selected value. Implement
accordingly in Bool and Enumeration editor subclasses.
- Implement calling the edit completion hook upon value changes.
- In the case where the target team terminates, the subsequent prompt
to ask the user what action they wish to take in response needs to
take into account the possibility that the UserInterface in question
hasn't yet implemented such prompting. Treat such a case as equivalent
to asking the debugger to quit.
Addresses part of #10292.
TableCellTextControlEditor:
- Switch BTextControl inheritance to public, as gcc2 otherwise fails to
properly dynamic_cast to BTextControl, which breaks the latter
internally.
BColumnListView:
- Add helper method for getting the visible rect of a given field.
Refactor SuggestTextPosition to use it.
{Tree,Table}:
- Add wrapper to retrieve table cell rect using the aforementioned
BCLV helper.
VariablesView:
- Tooltips now indicate if there was a problem resolving either the location
or the actual value of a given variable, as well as whether or not the
variable is editable in its current location.
Value{Piece}Location:
- Add member to indicate whether the current location, respectively
all its pieces are in locations where they can theoretically be
modified.
- Introduce SignalDispositionEditWindow for add/editing disposition
exceptions.
SignalsConfigView:
- Factor out helper class SignalDispositionMenu. Use accordingly in
SignalsConfigView and SignalDispositionEditWindow.
- Watch table selection changes to update button statuses appropriately.
- On add/edit request, show disposition edit window.
- Listen for disposition changes from team and react accordingly.
UiUtils:
- Add helper function to map signal defines to strings.
Together with the previous set of commits, this implements #9720.
- Rename BreakConditionConfigWindow to TeamSettingsWindow,
and move to own dedicated subfolder. Adjust callers accordingly.
Preparation work for other changes to come.
DebugEvents:
- Add definition for SignalReceivedEvent.
DebuggerInterface:
- Generate SignalReceivedEvent upon receipt of
B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED.
- Add class TeamSignalSettings for storing signal disposition settings,
and add instance to TeamSettings.
- Adjust TeamDebugger to load signal settings.
- Add header for defining the possible signal dispositions that can be
configured.
- Add corresponding UI helper function to map to a string
representation.
ImageFunctionsView:
- For function nodes, also display the start address of the function in
question. Makes it somewhat more convenient to determine which function a
function pointer actually refers to.
VariableTableModel:
- When attempting to retrieve the type for a given node, ensure
that it actually has a value node first. This might not necessarily
be the case if no appropriate type handler was found.
AddressValueNode:
- If the address node is pointing to a function, don't bother creating
a child, as there isn't really any useful information that can be displayed
for such a node besides its target address, which is already shown by the
address node anyways.
TableCell{Bool,Enumeration}Editor:
- OptionPopUp-derived editors for their respective value types.
TableCellIntegerEditor:
- TextControl-derived editor for integer values that validates inputs
based on the target integer size and type.
Not actually used yet, but together with the previous changes, these lay
the groundwork for the remaining part of #9708.
TableCellTextControlEditor:
- Serves as a base for editors that expose their functionality via a
text control. Handles common functionality of watching for changes,
validating input, and notifying listeners appropriately.
TableCellOptionPopUpEditor:
- Serves as a base class for editors where the set of possible values
is fixed and known up front. Handles reacting to selection changes
and notifying listeners.
- Introduce interface class ValueFormatter. This one takes on the
responsibilities of formatting a value into a string, which were
previously embedded within the various TableCellValueRenderer
subclasses.
- Add implementing subclasses for the various value types.
- Introduce TableCellValueRenderer subclass TableCellFormattedValueRenderer.
This is a simple TableCellValueRenderer implementation for the simple case
of a renderer that does nothing more than use a formatter to present a
string version of its corresponding Value. Since this describes all existing
renderers, this renders them obsolete.
- Refactor the respective ValueHandler subclasses to make use of the formatters
and new rendererer subclass.
- Add new interface class TableCellValueEditor, which provides a controller
for handling editing of table cell values, and corresponding listener
notifications.
ValueHandler:
- Add new hook for requesting such an editor, given a corresponding
value.
- Remove out-of-place accessor to type lookup info on ValueLoader.
Instead, adjust CreateChildren() and CreateChildrenInRange() to take a
TeamTypeInformation parameter. This can then be used by value nodes that
need to be able to look up type information in order to properly
publish their children, such as BList and BMessage. Refactor subclasses
and callers accordingly
MemoryView:
- During edit mode, if navigating with the left or right arrow
only resulted adjusting the focus nybble and not transitioning
to another block, redraw wouldn't be triggered, leading to it appearing
as if the keypress had no effect.
MemoryView:
- fTrackingMouse wasn't being initialized in the constructor, which would
lead to the memory view sometimes thinking it was in mouse tracking mode
immediately when opened.
- Add virtual hook to TeamMemory for retrieving area information
from the target team.
- Implement said hook in DebuggerInterface.
- Adjust RetrieveMemoryBlockJob to use said hook to retrieve the
writable state of the target block rather than calling
get_memory_properties() directly.
InspectorWindow:
- Add buttons to control edit mode, and helper functions to maintain
their state.
- Implement listener hook for memory change events, to track when
requested memory writes are completed, and update the view accordingly.
Together with the previous batch of commits, this implements the first part
of #9708.
MemoryView:
- Add hooks and supporting status tracking members to enable edit mode.
When editing is requested, we allocate a duplicate copy of the current
block's data to perform edits in. Currently, editing is only supported from
within the hex view, and when edit mode is enabled, the view is locked to
8-bit hex mode in order to avoid any possible confusion with regards to
source vs target endian orientation.
- Extend Draw() to determine whether to write data from the edit data store
or the actual memory block. Also implement highlighting the current edit
position caret when in edit mode, as well as highlighting bytes that have
been changed compared to the block's original data.
InspectorWindow:
- We now display a label indicating if the currently inspected block
is writable or not, so the user knows whether it's possible to modify
the contents.
MemoryView:
- Implement {Min,Max,Preferred}Size() hooks. The default BView
versions were causing the inspector to sometimes not be properly
resizable after previous settings were restored.
InspectorWindow:
- Fix inverted error check when retrieving settings. This was
causing us to fail to successfully load/apply previously stored
settings for the inspector.
- Factor out RegistersView's SIMD output formatting functions into
UiUtils helpers. Adjust RegistersView accordingly.
- Adjust DebugReportGenerator to detect SIMD registers and format
them appropriately for report output using the aforementioned
helpers.
RegisterTableModel:
- Add member for preferred SIMD unit format, and use it to decide
what to divide up such registers as, rather than hardcoding 16 bit integer.
RegistersView:
- When right clicking on an SIMD register, display a format context menu
allowing the user to decide what packed unit format to interpret the register
data as, and adjust table model accordingly.
DebuggerInterface,Architecture{X86,X8664}:
- Add hook function for retrieving a feature flag mask for the target CPU,
and corresponding implementation in Architecture-specific classes.
ArchitectureX86:
- Read CPU features on init, and use them to restrict the exposed set of
registers such that the MMX and SSE registers will only be visible
if the target CPU actually supports the respective instructions.
- If an SIMD register is detected, retrieve its value and format
it as an array of 16-bit hex values. This will be extended to
allow other format choices in a future commit.
ArchitectureX86{-64}:
- Implement helper functions for adding floating point and SIMD registers.
- Add st0-st7 and mm0-mm7 to the list of exposed x86{-64} registers,
along with their DWARF unwind mappings.
- Add xmm0-xmm7 for x86, and xmm0-xmm15 for x86-64.
CpuStateX86{-64}:
- Implement helper functions for setting/retrieving floating point and SIMD
register values.
- Fill in values for st*, mm* and xmm* from debug_cpu_state.
BitmapDrawingEngine:
- Check if fBitmap is NULL before releasing its reference. Since this is
the case when a BitmapDrawingEngine is instantiated, this would lead to
an app_server crash upon any attempt to make use of one.
SyntaxHighlighter/CLanguageFamilySyntaxHighlighter/SourceView:
- TeamTypeInformation is now passed as a parameter when requesting parsing,
so highlighters can make use of it to identify types. Adjust callers.
CLanguageFamilySyntaxHighlightInfo:
- Use TeamTypeInformation to check if identifiers map to types, and highlight
accordingly if they do.
TeamTypeInformation:
- Add interface function to allow simply querying for whether a
type is known to exist by a name + constraints, without actually
requesting that it be instantiated, and implement in TeamDebugInfo.
GlobalTypeLookup:
- Add analogous type lookup function to the above, and implement in
TeamDebugInfo.
{Specific,Debugger,Dwarf}ImageDebugInfo:
- Add function for type existence query, and implement in subclasses.
DwarfImageDebugInfo:
- On initialization, we now walk the list of compilation units and
build a hash table of all of their contained types. The table is then
used by GetType() to quickly find the subset of DIEType objects that
match the requested name, and then compare only those to the
given constraints to find the best match.
For a more complex image such as libbe or Debugger itself, this reduces
the time for an uncached type lookup from around 50 msec to < 10 usec on
my i7.
- When resolving an identifier, first attempt to match it against
frame variable if applicable, and only attempt to look it up as a
type name if the former comes up empty. The type lookup is
significantly more expensive since if it doesn't match an already
known type, it currently needs to search through all DIEs trying
to find a candidate. This would significantly slow down expression
evaluation involving identifier names, and was particularly noticeable
for breakpoint condition processing.
- When evaluating a breakpoint condition, there's no need to change
the thread state unless the condition is actually met. This would
lead to lots of unnecessary state switching and associated overhead
in the GUI.
- When detecting a possible start of string literal, ensure that a
terminator was actually found, otherwise simply consider it as a
single character token. Otherwise, cases such as an apostrophe in
a C-style comment that spanned a single line would result in us
missing the token for the comment close, and highlighting all
subsequent lines until such a token was encountered as comments.
SourceView:
- When calculating line widths for scrollbar calculation purposes, tabstop
offsets weren't being correctly taken into account, which would result
in lines being computed as shorter than they actually were. Depending
on the content of the file, the horizontal scrollbar would consequently
be configured improperly in some cases.
- If we're asked to debug a team graphically, check if Debugger is already
running. If so, send it a message asking it to debug the team rather than
trying to invoke it by command line, as the latter will simply result in
a B_SILENT_RELAUNCH message, and won't actually process the request properly.
General:
- Move all smaller prompt/edit windows to a dedicated subfolder.
Debugger/TeamsWindow/StartTeamWindow:
- Move management of StartTeamWindow to application, rather than
Teams window.
TeamWindow:
- Add top level menu item for commands that aren't specific to the
current team. This currently consists of requesting that the
Teams window be shown, and directly starting a new team.
Fixes part of #11659 (no way to start additional teams if Debugger was
initially started with a specific team).
- Expression evaluation results are now highlighted as changed when
they're first added, since they're immediately of interest, unlike
uninitialized variables that're first coming into scope.
Get rid of ExpressionEvaluationWindow.
- When asking to evaluate an expression via the Tools menu, we now
bring up a prompt window the same as the one used to add a watch
expression. This in turn works exactly the same as the latter,
except an additional flag is sent indicating that the expression
in question should not be persisted. As such, the results are
shown in the variables view, with all the capabilities that allows,
but also without the expression following the function as a watch
expression would.
- When retrieving the type to display for a given model node, ask its
underlying value node for its corresponding type rather than relying
on the one initially stored in the model, as the latter can change
as a result of typecasts.