Commit Graph
100 Commits
Author SHA1 Message Date
Rene Gollent 28b3438ecd adding disable_ide_dma true in the kernel settings file
From a quick look, the ATA driver only looks to safe mode settings for
that, and not the kernel file. The attached patch should address that.

ticket : #10253

Change-Id: I5e5c2474fecbd441a36a3600f7f16a964e0945dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/56
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2020-05-03 13:22:31 +00:00
Rene Gollent fc48ae3f80 Debugger: Fix #14375, #12343.
TeamDebugger:
- When a job is aborted, instead of calling into the user interface directly
  to reset the status message, post a message to do so. Also, only post the
  message if we aren't already in a terminating state. Otherwise, if jobs
  were still running while the team debugger is executing its destructor, it
  would attempt to make calls to the already destroyed user interface. This
  bug has likely been with us for quite some time, but was hidden by incorrect
  ref counting in the past (see #12343).
2018-08-20 16:44:20 -04:00
Rene Gollent 9ebb7ab422 Debugger: Fix #14374.
ExpressionPromptWindow:
- Post a quit requested rather than quitting directly. As a consequence of
  this oversight, the team window would never get the notification that the
  prompt had been closed, and would consequently not reset its internal state
  properly.
2018-08-20 16:41:58 -04:00
Rene Gollent 57893202f1 Debugger: Fix #14321.
DIESubprogram:
- Adjust to inherit from DIENamespace, as gcc can and will use it as a
  container in some circumstances.

DIEClassBaseType:
- Add accessor for member functions.

DwarfImageDebugInfo:
- Adjust recursive walking for types to take into account any DIENamespace,
  not just DW_TAG_namespace specifically.
- Factor out adding function to list into a helper.
- When retrieving the list of functions, perform a similar recursive walk as is
  done when building the types table, as some subprograms are apparently not
  always added to the root compilation unit entry. Curiously, this behavior
  seems to be relatively specific to a struct/class type declared inside a
  function in GCC's case, but based on the DWARF spec, there does not appear to
  be any specific restriction as far as where these can be nested, so be a bit
  more paranoid to ensure we don't encounter similar cases in the future.
2018-08-07 22:28:04 -04:00
Rene Gollent 211cb77acf Debugger: don't auto-download packages non-interactively.
- When in non-interactive mode, i.e. saving a crash report, don't
  allow the image debug info loader to automatically grab missing but
  available info packages. Otherwise we potentially download very large
  packages with the user being entirely unaware, i.e. the 200MB debug
  information package now present by default for gcc7's libgcc. This
  should eventually be made a configurable preference though.
2018-06-14 16:51:32 -04:00
Rene Gollent 364cbeb2e3 Debugger: Adjust type handling with namespaces.
DwarfImageDebugInfo:
- In some, but not all cases, gcc5 generates type information where the DIEType
  is a child of a namespace rather than of its containing compilation unit.
  This needs to be taken into account when building our name lookup table, as
  we'll otherwise not find the full definition of such types when attempting to
  locate them for corresponding variables. Fixes an issue reported by Axel.
2018-03-17 17:00:50 -04:00
Rene Gollent 770075026c Debugger: Rework type handlers to allow for custom selection.
TypeHandler:
- Add name field for presentation purposes. Adapt subclasses accordingly.

TypeHandlerRoster:
- Add methods to count and retrieve all type handlers for a given type,
  and adjust CreateValueNode to allow for passing in an explicit handler.
  Adjust callers accordingly.

VariablesViewState:
- Add helpers to store an explicitly chosen type handler for a node.

TypeHandlerMenuItem:
- ActionMenuItem subclass that takes care of reference management
  for its contained type handler.

VariablesView:
- Add context menu for choosing type handlers if applicable. Implement
  support for invoking said type handlers in a similar manner to explicit
  typecasts.
- Adjust saving/restoring the view state so that hidden nodes are taken
  into account as well. This is necessary since it may be the case that
  the handler had to be applied to the hidden child rather than the visible
  node (i.e. the BMessage handler when applied to a pointer to a BMessage).

All together, these changes allow choosing to switch between views of a type
when the Debugger has multiple handlers for it. For example, for BMessages
this allows switching between displaying the raw underlying structure vs
the decoded message content.
2018-02-04 14:13:01 -05:00
Rene Gollent 7082366900 Debugger: Fix crash in teams window.
- Some of the recent changes for memory management exposed a race
  condition, where the teams window would potentially try to access
  already freed objects on quit. Ensure we acquire references to the target
  host so this doesn't happen.
2018-01-13 15:36:22 -05:00
Rene Gollent ac9e464b78 Debugger: Fix various issues in the DWARF subsystem.
AttributeClasses:
- Fix typo in get_attribute_name_classes which resulted in us not
  handling DW_AT_linkage_name properly.
- Fix incorrect class specification for DW_AT_default_value due
  to inconsistencies in the DWARF documentation (the table of attribute
  classes indicates it is only a reference, but the detailed description
  indicates it also being possible to be a flag or constant, both of
  which gcc outputs).

DebugInfoEntries:
- Add accessor for DIEClassBaseType's inner types.

DwarfImageDebugInfo:
- When looking up types, create a basic target interface to pass on
  to the type context. Otherwise, type lookups that required DWARF
  expression evaluation would crash.
- When building the type name table, we now recursively walk a class's
  inner types, and add them to the list as well. This omission would
  cause the debugger to lack the type description for such classes,
  and consequently be unable to display their details in the variables
  view.
2018-01-12 22:23:57 -05:00
Rene Gollent c0936b5a03 Debugger: Another set of #13800 fixes.
AbstractTable/Table/TreeTable:
- Let BColumnListView take care of deleting columns. The previous
  approach was resulting in the columns being leaked.

Debugger:
- Don't detach the UI reference, as TeamDebugger will acquire its own.

GraphicalUserInterface:
- Cleanup of file panel handler.

SourceView:
- Clean up marker manager.

*Roster:
- Clean up registered objects in destructors.

GlobalTypeLookup:
- Clean up hash tables.

NetworkTargetHostInterfaceInfo:
- Fix reference handling for settings.
2018-01-11 22:39:55 -05:00
Rene Gollent ffe684b96c Debugger: Fix type issue in BList handler.
BListValueNode:
- BList's item count member is an int32. However, when the handler was reading
  said variable, it was mistakenly reading the number of bytes corresponding to
  to the address size of the architecture instead.This would cause the read to
  fail, and consequently BList and/or BObjectList variables to not display
  their contents properly on x86-64.
2018-01-11 22:39:55 -05:00
Rene Gollent 3995592cdf Debugger: Fix #13939, more work on #13800.
- Fix various cases where OpenHashTables weren't being cleared properly.
- Fix various reference counting errors.
- Simplify FileManager reference handling.
- Fix bug in LocatableDirectory where the directory named '/' would have its
  name returned as empty. This would lead to failed lookups for entries already
  in the table, and ultimately corrupted the hash table when deleting unused
  entries, leading to #13939. This was previously never noticed due to the
  entries not being freed properly.
- AbbreviationTable wasn't clearing its entries.
2018-01-10 19:29:36 -05:00
Rene Gollent b1ab02c434 Debugger: More memory management fixes.
DwarfImageDebugInfo:
- Type name/info entries weren't being freed properly.

BaseUnit:
- The array of entries itself was being destroyed, but not the actual
  objects. Consequently none of the DIE objects were ever being freed.

CfaRuleSet:
- The register rules array wasn't being freed.

FileManager:
- References to entries weren't being released. Some more work remains to be
  done here though, as a subset of these objects still have a non-zero ref
  count in the end.
2017-12-31 17:52:59 -05:00
Rene Gollent 3d9b569384 Debugger: Further work on memory leak hunting.
TeamWindow:
- Properly delete stack frame selection entries in destructor.

TeamDebugger:
- The reference to TeamDebugInfo wasn't correctly initialized to own,
  leading to TeamDebugInfo never being destroyed.

FunctionInstance:
- Also clear source code reference in destructor.

ImageDebugInfo:
- Release references to specific infos in destructor. These are acquired
  on our behalf when loading the image info, but were never released,
  leading to the latter never being freed.

DwarfManager:
- Release references to files in destructor.

FileManager:
- Release entries in various destructors.

Somewhat improves the situation in #13800, but is still far from complete,
as a thorough review of this nature hasn't ever really been done.
2017-12-28 23:22:13 -05:00
Rene Gollent 8bb774fc37 Debugger: Fix a memory leak.
TeamDebugger:
- In several cases, BReferences on thread handlers after a call to
  _GetThreadHandler() weren't correctly initialized to account for
  that function implicitly acquiring a reference on our behalf, leading
  to the reference count to spiral out of control, and consequently the
  handler would never be freed. Found while attempting to address
  #13800, likely more to come.
2017-12-27 23:52:13 -05:00
Rene Gollent 16b34a8fc7 Fix FreeBSD build.
- Recent changes to the build system appear to make the assumption
  that the GNU regex APIs are universally available. This isn't the
  case on FreeBSD, which requires libgnuregex to provide that
  functionality. This broke the host keymap build.
2017-12-27 23:06:56 -05:00
Rene Gollent 737de463dd Debugger: Fix #13797.
- When reading the areas note, there was no check in place to ensure that a
  matching segment for the address was actually found. This would later lead
  to a crash when attempting to read memory from the corresponding (missing)
  piece of memory in the core.
2017-12-02 15:58:28 -05:00
Rene Gollent dfc46d83b7 runtime_loader: Fix #13799.
- Don't remove .eh_frame in the linker scripts, as this saves little
  space in practice, and results in debug binaries of the runtime loader
  not being properly debuggable due to missing canonical frame
  information.
2017-12-02 15:41:41 -05:00
Rene Gollent 456342ca99 Debugger: Reimplement #10671.
- Rather than the previous (reverted) approach of tracking the last selected
  stack frame from within the StackTraceView, we now do so from the TeamWindow,
  where the selection can be mapped by thread. This fixes a subtle issue where,
  due to a lack of contextual information, the stack trace view would restore
  the remembered last selected frame rather than an explicitly chosen one. This
  was most noticeable upon selecting a function that had a corresponding stack
  frame in the current stack trace, where, instead of selecting that frame,
  the existing one would remain highlighted, even though the state of all other
  views had updated. Found while investigating the cause of #13710.
2017-09-24 20:23:34 -04:00
Rene Gollent 93f521060e Revert "Debugger: Implement #10671."
This reverts commit 02c7127cb9.
2017-09-24 15:51:41 -04:00
Rene Gollent e7b5894981 Update FreeBSD case for libsolv build. 2017-09-24 15:32:59 -04:00
Rene Gollent cdf821eb2a Debugger: Fix #13710.
TeamWindow:
- When changing the active function, we would also attempt to select a stack
  frame matching that function. However, in the case where the active function
  was set via changing stack frames, this logic would break if the function was
  recursive, and would cause the topmost frame to be selected instead of one at
  the desired recursion depth.
2017-09-13 21:20:18 -04:00
Rene Gollent f67172ac7e x86: Fix Pe package.
- Update Pe to 2.4.5-5 to account for BCollator API changes. Thanks to korli
  for flex-related build fixes!
2017-06-07 22:07:13 -04:00
Rene Gollent 76ca671925 Debugger: Implement listener hooks in ConnectionConfigWindow.
ConnectionConfigWindow:
- When notified that settings have been changed by the current config view,
  validate them, and if complete, enable the connect button.
- Implement message handler for connect button.
2017-05-21 19:54:48 -04:00
Rene Gollent 1dda890ae2 Debugger: Flesh out network config view.
NetworkConnectionConfigView:
- Port input field is now prepopulated with the default remote debug port
  number.
- Changes to either field now trigger listener notifications.
2017-05-21 19:54:48 -04:00
Rene Gollent f9065b53ad libdebugger: Minor fixes to NetworkTargetHostInterface classes.
NetworkTargetHostInterface:
- Fix missing initializer. This would lead to a crash in the destructor.

NetworkTargetHostInterfaceInfo:
- Implement IsConfigured() to validate passed in settings.
2017-05-21 19:54:48 -04:00
Rene Gollent 6889394848 libdebugger: Fix missing init in TargetHostInterfaceRoster.
- When adding the TargetHostInterfaceInfos to the roster, Init() was not
  called on the individual instances, leading to them potentially being
  incomplete.
2017-05-21 19:54:48 -04:00
Rene Gollent 766a9a49b6 x86: Update HaikuWebkit to 1.5.4. 2017-01-30 22:04:27 -05:00
Rene Gollent 9a3409492a Debugger: Fix #13261.
ThreadsTableModel:
- When returning field values for the stop reason column, only return valid if
  we actually populated it with a value (ergo, the thread was actually
  stopped). Otherwise, the table will attempt to perform comparisons on a
  BVariant which was never actually populated, leading to crashes.
2017-01-29 20:20:35 -05:00
Rene Gollent 99dde24c86 HaikuDepot: Fix gcc5 build. 2017-01-28 22:32:12 -05:00
Rene Gollent 4e9f7b8efa x86: Update Pe package due to BString ABI changes. 2017-01-22 14:22:37 -05:00
Rene Gollent 4ee47fe9e8 BListView: Cleanup, no functional change.
- Rename _FontChanged() to _UpdateItems() to more accurately reflect its
  purpose, as discussed on commits list. Adjust callers accordingly.
2016-12-25 16:16:43 -05:00
Rene Gollent 078b08e4ed BListView: Fix missing update for list items.
- According to the Be Book, one of BListItem::Update()'s responsibilities
  is updating the item's internal height/width. However, while we were
  providing such updates in the case of the item initially being added
  to the view, or when the list view's font was changed, we were not doing
  so on frame resize. This would lead to items having a stale width field
  in such a circumstance, leading to possibly incorrect behavior in apps
  relying on that field to be correct.
2016-12-20 22:33:26 -05:00
Rene Gollent c5dcedecae Debugger: Fix oversight.
DebugReportGenerator:
- In the case where the function was already disassembled beforehand,
  we weren't retrieving the statement, leading to a null pointer
  dereference.
2016-12-11 11:09:53 -05:00
Rene Gollent 7bdeef54a2 Debugger: Rework parts of report generation.
Team:
- Adjust report generation event to include a final status code for listeners.

CliContext,TeamWindow,ReportUserinterface:
- Use aforementioned status code to indicate whether report generation
  succeeded or failed.

DebugReportGenerator:
- Notify listeners if report generation fails. This may have previously
  been responsible for some bug reports where it was indicated that the
  debugger hung without exiting after being asked to save a report from
  a crashed app.
- When dumping disassembly, retrieve it directly if necessary rather than
  requesting it via the user interface listener. This also fixes the quirk
  that requesting to save a crash report while looking at the source code
  of a function would trigger switching it to disassembly visually.
- When walking the list of threads to dump, acquire references to all of
  them before starting. Otherwise, it was potentially possible for a running
  but not crashed thread to exit while we were generating the report, leaving
  us with a pointer to a deleted thread. This was most likely the cause of one
  of the crashes reported in #13082.
- When receiving the notification that source code state has changed, clear
  the waiting function. Otherwise, it was potentially possible for us to get
  other state change notifications, leading to the data semaphore being
  released too often. This would then cause later potential waits such as
  the stack frame memory dump to not actually wait when they should,
  potentially leading them to dereference objects that weren't yet ready.
  This fixes another of the crashes in #13802.
2016-12-09 23:11:23 -05:00
Rene Gollent 67e0301477 Debugger: Adjustments to report generator.
DebugReportGenerator:
- Due to the changes made with respect to correctly handling switching to
  disassembly explicitly, the report generator needs to request loading
  source files as it walks the stack trace in order to get source-based
  line number information. Fixes crash reports having -1 as the line number
  in cases where debug information was available, but the user hadn't yet
  looked at the source file in question.

LoadSourceCodeJob:
- Cleanup.
2016-12-07 23:58:36 -05:00
Rene Gollent 7cfc043e00 libdebugger: Fix a regression with ELF loading in some cases.
ElfFile:
- The refactoring in commit 2c50fbb8e1
  inadvertently introduced a failure case if a section in the ELF file
  is skipped, since it was explicitly passing in the insertion index
  to BObjectList::AddItem(). Since in the skipped case, this would be
  out of bounds for the list's current size, this would cause the whole
  operation to fail with an out of memory error, and consequently halt
  all further loading of debug information for that particular file.
  This manifested itself with libroot on at least gcc5, where no symbols
  could be seen.
2016-12-07 22:17:34 -05:00
Rene Gollent e218ec0288 Debugger: Hide connection controls.
TeamsWindow:
- As the functionality isn't yet actually ready, hide the controls in the
  teams window for now.
2016-12-05 18:18:14 -05:00
Rene Gollent 7e6e3c1be2 Debugger: Implement use of connection config roster.
Debugger:
- Initialize/Deinitialize roster as appropriate.

ConnectionConfigWindow:
- Implement config view listener interface, and use roster
  to retrieve and add appropriate config view when switching
  between interface types.
2016-12-05 18:18:11 -05:00
Rene Gollent eede6646dd Debugger: Add connection config handler framework.
ConnectionConfigHandler:
- Abstract base class for the different types of connection that allows one to
  retrieve an appropriate configuration view based on the target host interface
  type. This will allow the configuration window to switch dynamically between
  network, USB, etc. without having to know the details of any of those.
  Initially only a network subclass has been implemented though.

ConnectionConfigHandlerRoster:
- Keeps track of the list of available config handlers, and handles mapping a
  request for a given interface info to the appropriate type of handler.

ConnectionConfigView:
- Abstract base class for the actual configuration views returned by the config
  handlers. This exposes a listener interface via which the view can notify
  an interested party that the configuration has been changed. Correspondingly,
  the configuration window will use this to determine if the configuration is
  complete enough to allow a connection attempt.
2016-12-05 18:18:09 -05:00
Rene Gollent 445f00371c Debugger: Implement spawning connection window.
TeamsWindow:
- Create new connection button now sends a message to the main app,
  which manages the connection window as a singleton.

Debugger:
- Handle creating/showing connection configuration window as requested.
2016-12-05 18:18:06 -05:00
Rene Gollent c4b2191889 Debugger: Fix incorrect indentation. 2016-12-05 18:18:04 -05:00
Rene Gollent c521fed0da Debugger: Add connection configuration window.
ConnectionConfigWindow:
- Utility window that is spawned in response to requests to create a new
  remote host connection. Allows setting up and attempting to make a
  connection.
2016-12-05 18:18:01 -05:00
Rene Gollent 10ba334855 Debugger: Cleanup.
- Split MessageCodes.h into a second file that separates out the
  application-specific message codes from those used by the core.
  Adjust includes accordingly. No functional change.
2016-12-05 18:17:58 -05:00
Rene Gollent 918f4a0733 Debugger: StartTeamWindow Style fix. 2016-12-05 18:17:56 -05:00
Rene Gollent 365840af1c Debugger: Adjust TeamsWindow for connection selection.
TeamsWindow:
- Add Listener interface for selected target host interface changes.
- Add menu field to display/choose between active host connections.
- Add button to create a new connection (not yet functional).

TeamsListView:
- Implement TeamsWindow Listener interface to decide when to update
  the displayed team list.
- Remove unused current team ID.
2016-12-05 18:17:53 -05:00
Rene Gollent 692fe55503 libdebugger: Add initial version of network interface.
NetworkTargetHostInterface{Info}:
- Barebones classes for implementing a target host interface over TCP.
2016-12-05 18:17:50 -05:00
Rene Gollent 25ec63dbf5 libdebugger: Add string setting type.
- Needed in order to properly implement a settings description for
  a remote interface.
2016-12-05 18:17:48 -05:00
Rene Gollent 9e4d0fd483 libdebugger: Implement remaining remote request/response pairs. 2016-12-05 18:03:14 -05:00
Rene Gollent bcca096ae5 libdebugger: Fix header order in RemoteDebugRequest. 2016-12-05 18:03:13 -05:00
Rene Gollent a9d53d9e7e Debugger: Fix regression introduced in hrev50534.
FunctionInstance:
- Add new state FUNCTION_SOURCE_SUPPRESSED. This signals that the user
  explicitly forced disassembly to be loaded despite source code being
  available.

LoadSourceCodeJob:
- When forced to disassembly, use the above suppressed state accordingly.

SourceView/TeamWindow/TeamDebugger:
- Adjust to take new state into account as needed.

TeamDebugInfo::GetActiveSourceCode:
- When looking at a function to decide whether to return line information
  based on source or disassembly, first examine the source code state. If
  the source has never been loaded for that function, but we have it available,
  set it on the function at that point. This lazily addresses the fact that
  LoadSourceCodeJob is called on behalf of a specific function, and
  consequently only sets the source code onto that function, and not all others
  present in the same file. This allows us to differentiate between the case
  where a function doesn't have source code available at all, versus a function
  that has simply been forced to disassembly view at this point in time.

The primary symptom of the above issue was that attempting to set a breakpoint
outside of the currently active function, but within the same file would result
in the breakpoints view indicating that the breakpoint was at line 0 rather
than the appropriate line, and breakpoints would also not be drawn in the
source view for such locations.

Thanks to Humdinger for the heads up!
2016-11-22 23:06:09 -05:00
Rene Gollent bdac77bf2e ram_disk: FIx x86-64 build. 2016-11-03 23:21:04 -04:00
Rene Gollent d8d6cf9658 x86_64: Update haikuwebkit to 1.5.3. 2016-11-03 23:04:30 -04:00
Rene Gollent b72a28a268 x86: Update haikuwebkit to 1.5.3. 2016-11-03 21:49:08 -04:00
Rene Gollent b65adbdfbc Debugger: Fix #12940.
- Add new interface TeamFunctionSourceInformation. Currently this
  exposes a single function allowing one to query for the currently
  active source code given a FunctionDebugInfo instance.
- Implement TeamFunctionSourceInformation on TeamDebugInfo.
- Pass TeamFunctionSourceInformation to Dwarf{Team,Image}DebugInfo.
  In turn, make use of it in DwarfImageDebugInfo::GetStatement() in
  order to determine whether to return the corresponding assembly
  or source statement.

With this piece of information, the debugger is now correctly able to
determine that the user is currently looking at disassembly despite debug
info being available, and consequently adjust its stepping behavior based on
that. Previously, the source code statement was always used, leading to it
not being possible to single step assembly lines in such a circumstance
without manually using run to cursor.

Other related cleanups:
- TeamDebugInfo now inherits BReferenceable directly, rather than relying on
  indirectly inheriting it from TeamTypeInformation.
- Remove BReferenceable from TeamTypeInformation. The latter is only an
  interface anyways, and inheriting that base class from multiple locations
  was causing GCC5 trouble when resolving BReference<TeamDebugInfo>, even
  when virtual inheritance was used.
2016-09-13 22:14:10 -04:00
Rene Gollent 584fd9619c libdebugger: Fix #12944.
LocatableFile:
- If there is no parent path, don't insert a path separator between parent
  and filename. This may be the case depending on how the source file was
  specified during compilation.

FileManager:
- When constructing an EntryPath from a LocatableEntry, ensure that the
  parent folder actually has a path string that isn't simply empty to ensure
  consistency with the raw dir/file case. Otherwise, hash lookups that are
  dependent on the parent dir being NULL if not specified will fail, causing
  us to not locate the file successfully. This was preventing us from updating
  source location information for make 4.2's main.c, as the latter was
  specified in such a way that the above combination of conditions would
  occur, and consequently when asking the FileManager to update the source
  location with the actual file, the entry couldn't be found in the table,
  and no information would be updated.
2016-09-06 22:56:52 -04:00
Rene Gollent 8471ec3d56 libdebugger: Fix #12913.
ThreadHandler:
- When single stepping, verify that current instruction pointer is
  actually within a valid image. Otherwise we'll crash attempting to
  retrieve debug information for it.
2016-08-13 21:24:00 -04:00
Rene Gollent b7012e6c46 libdebugger: Fix #12914.
DwarfImageDebugInfo:
- While computing return value locations, we need to re-evaluate
  the availability of debug information as we're forced to traverse
  around images to resolve the location of a function call. Otherwise,
  we may crash as one of the called functions may belong to an image
  that wasn't compiled with debug info.
2016-08-13 21:23:11 -04:00
Rene Gollent 17954f2e22 libdebugger: Initial work for remote support.
- Introduce base classes RemoteDebug{Request,Response} and the first set of
  implementing subclasses for the various types of debug requests. These
  encapsulate the information needed to make a request to the target debugger
  interface, as well as a means to flatten/unflatten to a BMessage. These will
  be used to marshal the relevant information for transmission across the
  eventual transport interface. Not used anywhere yet since there still remain
  some requests and responses to implement, among other things.
2016-07-31 17:30:23 -04:00
Rene Gollent 9c9c24ce08 libdebugger: Add accessor for cpu state size.
Architecture:
- Store and provide accessor for the size in bytes of the low-level
  debug_cpu_state size of the respective target CPU. Adjust subclasses
  to pass in the appropriate size information.
2016-07-31 17:30:12 -04:00
Rene Gollent b02ee147b1 libdebugger: Reorganize debugger_interface subdir.
- Split into separate subdirectories for each interface type, as is done in
  the target_host_interface subdir. Preparation for the remote interfaces,
  which will have quite a few more components than the existing local ones.
2016-07-31 17:30:04 -04:00
Rene Gollent 05fc1277c4 Debugger: Fix team restart request.
UserInterface:
- Add Clone() function to set of required virtuals. This asks the subclass
  to create a new instance of its respective type.

{CommandLine,Graphical,Report}UserInterface:
- Implement the above function.

TeamDebugger:
- Add accessor for the currently active UI.

TargetHostInterface:
- Set correct request type when setting up the options for a team restart.
- Ask the TeamDebugger for its user interface and clone it in order to fill
  in that aspect of the debug options. This fixes a regression introduced in
  commit 880a64, which inadvertently resulted in team restarts no longer
  working.
2016-07-03 13:53:51 -04:00
Rene Gollent 0b20cac7c3 libdebugger: Remove unnecessary header dependency.
- The library does not depend on libedit/ncurses, these were contained
  entirely within the application level code.
2016-06-05 18:25:33 -04:00
Rene Gollent 9968f34302 Debugger: Adjust header order.
- Ensure that the debugger lib's headers are included before those of libshared
  to minimize conflicts between the respective Thread classes. Fixes gcc2 build.

Thanks to Jerome for reporting.
2016-06-05 18:25:32 -04:00
Rene Gollent 76477fc5a7 Cleanups.
- Move libdebugger into the body with the rest of the libraries. Cleanup
  suggested by Ingo. No functional change.
2016-06-04 18:43:20 -04:00
Rene Gollent 3ef3dbceda Debugger: Fix Jamfile typo. 2016-06-04 18:42:20 -04:00
Rene Gollent 1fd3e0783b Debugger: Fix build.
- Accidentally removed necessary header dependencies during refactoring.
2016-06-04 14:17:18 -04:00
Rene Gollent fce4895d18 Debugger: Split into core library and application.
- Add subfolder src/kits/debugger which contains the debugger's core
  functionality and lower layers. Correspondingly add headers/private/debugger
  for shared headers to be used by clients such as the Debugger application
  and eventual remote_debug_server. Adjust various files to account for
  differences as a result of the split and moves.
- Add libdebugger.so to minimal Jamfile.
2016-06-04 13:18:39 -04:00
Rene Gollent e6687e8f3d Debugger: Add dedicated functions for global {un}init.
- Add new source file DebuggerGlobals, which contains the relevant
  functions for initializing/destroying the various singleton rosters
  that the core subsystems rely upon. It is the app's responsibility
  to ensure these are called before anything else, and as final cleanup
  at exit.
- The GUI/CLI app objects now take care of initializing the settings factory
  and ValueHandlerRoster, as those are entirely app-specific.
- Refactor calls to init functions appropriately.
2016-06-04 13:18:37 -04:00
Rene Gollent 5c8ba745e5 Debugger: Refactor SettingsManager.
- SettingsManager is now a pure virtual interface. The debugger core provides
  a no-op implementation of it which is used by default if no explicit manager
  is provided by the client requesting a new TeamDebugger. This allows consumers
  of the debugger core that have no need for settings persistence such as the
  report generator to not have to care about that particular detail at all.
- Add subclass DebuggerSettingsManager which is essentially the previous
  existing implementation. This one will go with the application portion
  of the Debugger once the separation of app and lib has been completed.
  Adjust callers accordingly.
2016-06-04 13:18:35 -04:00
Rene Gollent 20df96b029 Debugger: Relocate value_handlers.
- As they are currently only used by the VariablesView, move ValueHandler
  and related code into user_interface/gui.
2016-05-22 15:57:13 -04:00
Rene Gollent ec60909a20 Debugger: Reorganize settings classes.
- Refactor TeamUiSettingsFactory into an abstract base class with implementing
  subclass DebuggerUiSettingsFactory.
- Adjust SettingsManager to expect the UiSettingsFactory to be passed in as an
  initialization parameter, and refactor accordingly.
- Move GuiTeamUiSettings.* into a user_interface/gui subfolder.

No functional change, simply reorganization towards splitting the debugger's
core functionality into a separate library from the application to aid in
sharing with remote_debug_server.
2016-05-22 15:57:12 -04:00
Rene Gollent 880a646413 Debugger: Cleanup.
TargetHostInterface:
- Adjust _StartTeamDebugger to always require a user interface object to
  be passed in rather than implicitly falling back to GUI if unspecified.

Debugger:
- Refactor to be in compliance with the above.
2016-05-22 15:57:10 -04:00
Rene Gollent b8a716965a BSocketMessenger: Further improvements.
- Messages that expect a reply are now tagged with a unique ID field to
  indicate that expectation to the receiving socket messenger.
- The messenger now maintains a map of received reply IDs and their
  corresponding messages, along with a message queue of other unsolicited
  replies.
- After successfully connecting, the messenger now spawns a thread
  whose sole responsibility is receiving and parsing all incoming messages,
  and consequently sorting them into the aforementioned data structures based
  on the presence of the reply ID. Callers who are awaiting either replies or
  other messages are signalled appropriately via a semaphore. This allows
  multiplexing of both types of messages on the same socket.
2016-05-14 21:31:24 -04:00
Rene Gollent 6d4e35f60e BSocketMessenger: Fix size mismatch.
- The header size was accidentally being included in the flat buffer size,
  leading to a mismatch error when reading the incoming message.
2016-05-01 14:23:58 -04:00
Rene Gollent 6dd98243c2 BSocketMessenger: Style fixes. 2016-05-01 09:53:42 -04:00
Rene Gollent 493cced1ef libbnetapi: Add socket messenger class.
- Introduces new network API class BSocketMessenger, allowing one to send
  and receive BMessages across a network socket in a BMessenger-like
  fashion. Still very much WIP, hence currently not exposed via public headers.
  Based partly on previous work by Axel.
2016-04-30 18:32:50 -04:00
Rene Gollent c9dd7d0ddf libbnetapi: Extend socket classes.
B{Abstract,Datagram,Secure}Socket:
- Add functionality to listen for and accept new connections, thus allowing
  one to use the socket classes for server functionality as well.

BSecureSocket:
- Adjust to take into account differences between how SSL needs to be called
  when accepting an incoming connection vs initiating an outbound one.
  The handshake on the accepted connection stills fails for unknown reasons
  at the moment though.

Note that these changes break the ABI, and thus any packages making use of
them directly will need a rebuild.
2016-04-28 22:30:40 -04:00
Rene Gollent e2d845a47f Debugger: Implement remainder of #12729.
UserInterfaceListener:
- Add request hook for writing a core file. Implement in TeamDebugger.

Jobs/WriteCoreFileJob:
- Add new job to actually dispatch the core file request via the debugger
  interface.

Team{::Listener}
- Add listener event + hook for notifications when a core file gets written.
  Implement in CLI.

CliContext:
- Add event flag for core file changed.

CommandLineUserInterface:
- Add 'write-core' command. This optionally takes a path to write the core to,
  otherwise one is automatically generated by, similarly to debug reports. As
  such, one can now generate cores for things like app_server and registrar
  crashes if desired, in addition to reports.
2016-04-26 22:36:26 -04:00
Rene Gollent 5c8966c740 Debugger: Fix crash regression.
- During the TargetHostInterface refactoring, a parameter was accidentally
  omitted for the debugger options in the command line and report interfaces,
  leading to a crash during TeamDebugger init.
2016-04-26 22:34:00 -04:00
Rene Gollent bac2e686dc Debugger: Add core file request to DebuggerInterface.
{CoreFile,Local}DebuggerInterface:
- Add virtual hook for requesting a core dump of the current team. Implement
  accordingly in LocalDebuggerInterface, and add a no-op stub in
  CoreFileDebuggerInterface.
2016-04-26 21:48:44 -04:00
Rene Gollent 63a0065c83 Debugger: Implement part of #12729.
TeamsWindow:
- Add a button allowing one to specify loading a core file in addition
  to attaching to/creating teams.
- Slight layout tweak.
2016-04-26 18:28:09 -04:00
Rene Gollent ef969bcb59 Debugger: Fix incorrect behavior when asking to activat.
GraphicalUserInterface:
- The Show() method now checks if the team window is already visible. If
  it is, we instead call Activate() to focus it. Fixes the problem that
  attempting to attach to a team which we already had a running team
  debugger for would appear to do nothing, rather than focusing that window.
2016-04-25 21:56:10 -04:00
Rene Gollent 61f0bf59fb Debugger: Fix handling of team_id clashes.
TeamDebugger:
- Add accessor to query whether the debugger's interface is a post mortem core
  rather than a live team.

TargetHostInterface:
- When asked to locate a team debugger by team_id, as is done for attach
  requests to determine if we already have an existing instance attached, skip
  over post mortems. This takes care of the potential problem of detecting a
  core instance with the same team_id as a live team, and consequently refusing
  the attach request.
- When a team debugger quits, use its actual pointer to look it up rather than its
  team ID, as we could otherwise potentially remove the wrong one in the case of a
  clash.
2016-04-25 21:49:46 -04:00
Rene Gollent 2c4195e840 Debugger: Integrate core handling into TargetHostInterface.
{Local}TargetHostInterface:
- Add virtual method for requesting a debugger interface for a core file.
  Implement accordingly in LocalTargetHostInterface based on Ingo's
  previous implementation in the Debugger app.

TeamDebuggerOptions:
- Add an enum to define the type of team debugger request being made
  to explicitly make this clear rather than guessing based on the provided
  arguments. Set accordingly in the various cases.
- Add a parameter for the core file path.

Debugger:
- Refactor to fill in TeamDebuggerOptions appropriately for core file
  requests, and consequently simplify code.

This doesn't yet deal with the fact that a post-mortem team's ID can
clash with that of a live team, which may lead to issues when attempting
to attach to a live team in such a case.
2016-04-25 16:48:37 -04:00
Rene Gollent c084d6c49a Debugger: Minor tweak.
LocalTargetHostInterface:
- Set interface's friendly name to include local hostname.
2016-04-20 20:50:02 -04:00
Rene Gollent aed5c39d97 Debugger: Implement host interface roster listener.
TargetHostInterfaceRoster:
- Add Listener interface. For now, this simply notifies the listener of
  changes to the active debugger count.
- Adjust show new team window command to automatically fall back to the local
  interface window if one isn't specified. Fixes the Start New Team menu item
  in the TeamWindow. The latter will later be expanded to show the available
  interfaces to start a new team on in a submenu.

Debugger:
- Implement roster listener interface in order to know when to attempt
  application quit.

With this commit, all necessary work to isolate the application from the target
host is complete, and work on the actual remote interface and protocol can
begin.
2016-04-20 20:47:56 -04:00
Rene Gollent 8527cd4d28 Debugger: Add host listener implementation.
TargetHostInterfaceRoster:
- Implement TargetHostInterface's Listener interface. This allows us
  to more cheaply track the total number of running team debuggers,
  as well as automatically removing an interface that is destroyed.
2016-04-20 20:47:32 -04:00
Rene Gollent 5bb138f751 Debugger: Add listener interface for TargetHostInterface. 2016-04-20 20:47:30 -04:00
Rene Gollent a1afac4dca Debugger: Rework to fully use TargetHostInterface.
Application objects:
- Rework and simplify to take into account that they will no longer be
  directly managing the team debugger list. Requests to start a new debugger
  are still funnelled through here however, and as such, said requests must
  now provide the appropriate target host to start with. Adjust StartTeamWindow
  and TeamsWindow accordingly.
- On global init, always create an instance of the local interface.

TargetHostInterface:
- Convert to BLooper and implement TeamDebugger's Listener interface.
  TargetHostInterfaces now directly manage their TeamDebugger instances,
  and consequently take over the equivalent duties that the main application
  previously had.
- Adjust signatures of Attach/CreateTeam to add const. Adjust
  LocalTargetHostInterface accordingly.
- Add accessor to determine if a given interface is local or not. Will be
  needed for the TeamDebugger's file manager eventually so it knows if it
  needs to request remote files if no matching local file is found.
- Add accessor to start a TeamDebugger instance, and corresponding options
  structure.

TargetHostInterfaceRoster:
- Minor adjustments to host interface initialization to take into account
  needing to start the looper.
- Add accessor for number of running team debuggers, for the main app to
  use when deciding to quit.

TeamDebugger:
- Add accessor for SettingsManager. Needed for the case of a restart request,
  as the host interfaces do not have direct access to it.

TeamsWindow:
- For now, always grab the local host interface when initializing the window.
  Once the remote interface is implemented, this will need to be adjusted, but
  the appropriate UI for creating/selecting it is needed first anyways.

With these changes, the main application is fully host-agnostic, and all
management of actual debuggers is delegated to their parent host interfaces.
There still needs to be a listener interface for the host interface and/or
roster though, so that the application can be made aware of when debuggers
quit, as this drives whether it's time to terminate the app or not.
2016-04-20 20:47:29 -04:00
Rene Gollent 0a1838cb44 Debugger: Implement Create/Attach on LocalTargetHostInterface.
LocalTargetHostInterface:
- Implement the create and attach functionality. In theory, this completes
  everything that's needed in order to adjust the main application to do
  all debugger interface creation via the roster.
2016-04-13 20:10:19 -04:00
Rene Gollent 7dde731f40 Debugger: Add missing roster method implementations.
TargetHostInterfaceRoster:
- Implement counting/retrieving interfaces, as well as requesting the
  creation of a new instance.
2016-04-13 20:10:17 -04:00
Rene Gollent d9e4b4cec5 Debugger: Add initial version of TargetHostInterfaceRoster.
TargetHostInterfaceRoster:
- Provides a singleton interface to enumerate both the available interface
  types, and all currently running instances. This will provide clients like
  the TeamsWindow with a way to present the user with all available types,
  as well as the necessary information to configure/instantiate them.

TargetHostInterfaceInfo:
- Provides an information object for each available type of interface,
  including an optional description of the settings needed to configure it.
  Callers can then use this to provide a configuration UI as needed, and
  once complete, request a corresponding interface instance for the desired
  configuration.

{Local}TargetHostInterface:
- Add Settings parameter to Init(). Adjust LocalTargetHostInterface
  accordingly.

LocalTargetHostInterfaceInfo:
- Implementation of TargetHostInterfaceInfo for the local system case.
2016-04-10 17:03:10 -04:00
Rene Gollent 7442abd1c5 Debugger: Further additions to TargetHostInterface.
TargetHostInterface:
- Provide interface for tracking list of TeamDebuggers attached to this
  particular interface instance. Will eventually replace the current
  mechanism where the Debugger app tracks this directly.

LocalTargetHostInterface:
- Cleanups.
2016-04-10 17:03:07 -04:00
Rene Gollent 8c7bdb72ae Debugger: Refactor TeamsWindow to use TargetHostInterface.
TeamsWindow:
- On startup, instantiate a LocalTargetHostInterface, and pass it
  to the TeamsListView.

TeamsListView:
- Refactor building and updating the teams list to work via TargetHost
  and its respective listener interface rather than the previous combination
  of be_roster and manual polling.
- Style fixes.
2016-04-04 22:17:07 -04:00
Rene Gollent 475ea59b5f Debugger: Fix handling of team creation events.
LocalTargetHostInterface:
- When receiving team creation events, check if the team in question actually
  contains a valid app image. The kernel's create notification is sent before
  the team is completely initialized, and consequently if our get_team_info()
  call gets in quickly enough, the images may not be loaded yet. If this
  situation is detected, add the team ID to a wait list.
- If we have waiting teams, listen for new messages with a short timeout. If no
  message is received within the timeout, walk our list of waiting teams and
  see if they are fully initialized yet, and if so, dispatch the appropriate
  event.
2016-04-04 22:17:06 -04:00
Rene Gollent c6897b2871 Debugger: Start implementing host interface.
- Add new model class TargetHost for host-specific information such as
  the running team list.
- Add new interface class TargetHostInterface and implementing subclass
  LocalTargetHostInterface. Not yet complete/usable due to some as of yet
  unresolved issues with the involved system APIs.
2016-04-02 22:48:58 -04:00
Rene Gollent 2e7058114c Debugger: DebuggerInterface refactor.
DebuggerInterface:
- Refactor into abstract base class.
- Introduce interface configuration abstract base class.
- Move existing implementation into LocalDebuggerInterface and add
  corresponding configuration class.

Debugger:
- Adjust to instantiate LocalDebuggerInterface.

In and of itself no functional change, but paves the way for further
refactoring to make the debugger fully interface-agnostic (this isn't yet
the case for retrieving target system information such as the team listing,
and creating/attaching to teams).
2016-04-02 22:48:36 -04:00
Rene Gollent 6bef41c6a9 Debugger: Minor refactor.
TeamDebugger:
- Rather than instantiating the DebuggerInterface directly, we now
  expect it to be given to us externally. This allows TeamDebugger
  to be agnostic of where the team actually resides.

Debugger:
- Create and initialize DebuggerInterface before passing it on to
  TeamDebugger.

No functional change.
2016-04-02 15:05:19 -04:00
Rene Gollent 5632edebb4 Debugger: Resolve minor TODO. 2016-04-02 15:05:18 -04:00