Commit Graph

27 Commits

Author SHA1 Message Date
Stephan Aßmus
5147963dcd headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than
Tracker's OpenHashTable.h which it should eventually replace. We've renamed the
class to BOpenHashTable and changed the interface slightly so that HashTableLink
became superfluous.
Adapted all the code that used it. Since the OpenHashTables no longer clash,
this should fix the GCC4 build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 00:39:12 +00:00
Ingo Weinhold
2bf55b39a5 * Made FunctionID abstract. There are now two implementing subclasses,
SourceFunctionID (where we know the souce location of the function) and
  ImageFunctionID (where we don't know the source location). Made the
  classes archivable.
* Added support to find functions by ID.
* Improved user breakpoint handling. We can now "install" a breakpoint before we
  even know the function instances in which to install it. Whenever image debug
  information become available, breakpoints are installed in the concerned
  function instances of the respective image.
* Always trigger loading image debug info as soon as we become aware of an
  image.
* Implemented a settings management mechanism. ATM only the breakpoint
  locations for debugged teams are persisted. This seriously improves the
  debugging fun, though. :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31728 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-24 02:35:30 +00:00
Ingo Weinhold
a5e1e7ceba Refactoring: Moved TeamDebugModel functionality into Team and got rid of the
former.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31705 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-22 19:20:06 +00:00
Ingo Weinhold
25598171b1 GetStatementAtAddress(): Terminate, if we couldn't get the statement from the
disassembled code of the function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31685 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-22 01:53:59 +00:00
Ingo Weinhold
da4d62db94 * Worker:
- Made Job Referenceable.
  - Turned JobKey into an abstract base class to add flexibility. The new
    SimpleJobKey is a subclass with the former functionality.
* TeamWindow: Removed the TeamWindow* parameter from the listener hooks. The
  TeamDebugger knows anyway.
* Added IDs to Variable, Function, and FunctionInstance. The latter two generate
  the ID on the fly, Variable stores it.
* SpecificImageDebugInfo::CreateFrame(): Changed FunctionDebugInfo* debug
  parameter to FunctionInstance* to provide more info (the function ID).
* DwarfInterfaceFactory/DwarfImageDebugInfo:
  - Added class DwarfFunctionParameterID, an ID class implementation for
    function parameters and set the IDs on the parameter objects.
  - Retrieve the size of a type (i.e. the size of its objects) and store it in
    DwarfType.
  - If a parameter's ValueLocation doesn't have a size, set that of the
    respective type.
  - Map the register indicies in the parameters' ValueLocations from DWARF to
    our indices.
* Added class TypeComponentPath for identifying subcomponents in types.
* Added class StackFrameValues, a container associating variables and their
  subcomponents with values.
* StackFrame does now have a StackFrameValues object for parameters and local
  variables and a mechanism to notify listeners when values have been retrieved.
* Added GetStackFrameValueJob to retrieve variable values. Lots of functionality
  is missing yet. Most notably it doesn't retrieves values for subcomponents.
* Wired everything to trigger loading of variable values and getting notified
  when done.
* VariablesView: Added a value column. This is all very basic and has to be
  done differently, but at least values for the parameters can be seen already.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31636 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-18 23:52:16 +00:00
Ingo Weinhold
d315bfd510 * Added class ValueLocation to represent a location of a value on the target
machine.
* DWARF:
  - Various additions to the DIE classes.
  - DwarfExpressionEvaluationContext:
    - Added support for location expressions and thus the missing DW_OP_piece
      and DW_OP_bit_piece operations.
    - Fixed some deviations from the specs.
    - Added debug output.
  - DwarfFile:
    - Added missing evaluation of CFA expression rules.
    - Added service methods to evaluate expressions, location expressions,
      and constant and dynamic values.
* Added model classes for representing types and variables. Particularly the
  types part is not finished yet.
* StackFrame does now contain parameters and local variables.
* Added DwarfInterfaceFactory, which creates implementation objects for the
  types, as well as variables objects. It's even less finished.
* DwarfImageDebugInfo::CreateFrame(): Resolve function parameters and add them
  to the stack frame. No local variables yet.
* Added the beginnings of a variables view. Only lists the names of parameters
  and local variables (of understood types) ATM.
* Renamed RegisterView to RegistersView.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31614 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-17 01:54:43 +00:00
Rene Gollent
3c0955a1ce * Removed no longer needed workaround for mouse wheel messages (thanks Axel!).
* Introduced SourceCode::LineLengthAt(index) and respective implementations in FileSourceCode and DisassembledCode for getting the cached length of the line at the given index.
* Use LineLengthAt in various places in SourceView::TextView to avoid having to calculate string lengths on the fly.
* Clamp the size of the drag and drop rect to the window size. Otherwise in cases of large selections, said rect would get quite large.
* Add support for double click word and triple click line selection.
* Fix problems with tracking state which would erroneously cause the mouse entering the view while dragging on a scroll bar to initiate a drag and drop if there was selected text.
* Add Select All menu/keyboard shortcut and implement corresponding functionality in SourceView::TextView.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31587 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-15 12:52:18 +00:00
Ingo Weinhold
fd1f509330 Skeleton for source language abstraction. There's SourceLanguage with several
subclasses, though they don't do much yet. SourceCode is now associated with a
SourceLanguage.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31544 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-13 20:45:15 +00:00
Ingo Weinhold
18ca318a3d * Since disassembled code is actually function instance specific,
FunctionInstance does now also have a (DisassembledCode) source code
  attribute. Function keeps its attribute, but it explicitly is a
  FileSourceCode now.
* SourceCode:
  - Removed GetStatementAtLocation(). Instead DisassembledCode has a
    StatementAtLocation() now. As well as a StatementAtAddress() and
    StatementAddressRange(). Rather cast to the subclass (in two instances)
    instead of having those methods in the base class. In most cases we already
    have the subclasses now, anyway.
  - Added Lock()/Unlock(), which are implemented in FileSourceCode. The
    statement ranges are no longer immutable, so we have to lock.
* TeamDebugModel:
  - Revived GetBreakpointsInAddressRange().
  - GetBreakpointsForSourceCode(): Optimized for DisassembledCode and fixed
    in the FileSourceCode case. We need to compare with the functions' source
    file instead of their source code, since they might not have the source
    code set yet. Fixed two instances of the same problem in SourceView. Setting
    breakpoints in functions that have no associated source code yet, works now.
* Team:
  - GetStatementAtAddress(): Optimized by using the DisassembledCode, if
    available.
  - GetStatementAtSourceLocation(): If the supplied source code is
    DisassembledCode, we have to get the statement from it directly, since
    we can't get that information from the image debug info.
* TeamDebugInfo: Added LoadSourceCode() and DisassembleFunction(), the new way
  to get FileSourceCode respectively DisassembledCode. SpecificTeamDebugInfo
  has lost LoadSourceCode() and gained service methods AddSourceCodeInfo() and
  ReadCode(). This avoids unnecessary code duplication in the subclasses.
  Moreover it allows for joining source location info source files from
  different images (and compilation units) -- interesting for inline functions
  in headers.
* Adjusted LoadSourceCodeJob and TeamDebugger::FunctionSourceCodeRequested()
  accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-11 00:05:26 +00:00
Ingo Weinhold
a4b0c19209 * Finished the transformation of the SourceCode interface:
- Replaced StatementAtLine() by GetStatementLocationRange(), which doesn't
    return a statement (i.e. also target addresses), but just a range in the
    source code. This can also be implemented by FileSourceCode, which can
    therefore be used for more than one instance of a function.
  - Added GetStatementAtLocation() which kind of is also a replacement for
    StatementAtLine(), but is optional and only provided by
    DisassembledSourceCode.
  - Added GetSourceFile(), which has to be provided when
    GetStatementAtLocation() is not implemented.
  - Kicked the statement stuff out of FileSourceCode. It only knows source
    ranges, now.
* Team: Added GetStatementAtSourceLocation(), which is the real replacement for
  SourceCode::StatementAtLine() in cases where a statement is actually
  needed. It uses SourceCode::GetStatementAtLocation(), if available and
  otherwise finds a function at the source location, and gets a statement for
  one of its instances.
* TeamDebugInfo: Does now manage a source file -> functions map allowing to
  look up functions at source file locations.
* DwarfImageDebugInfo:
  - Switched the path in the source code hash table key for a LocatableFile,
    which is cheaper to hash and to compare.
  - Fixed bugs where the relocation delta was ignored.
  - Replace a -1 in the SourceLocation column component by 0 to avoid
    mismatches.
* SourceLocation: Changed component types from uint32 to int32. Otherwise -1 is
  not representable.

Things mostly work as before starting the refactoring to support function
instances. All is not well yet, though. E.g. we don't merge the source code
information for common source files (like headers) provided by different
compilation units (or even images) yet. We need to do that, since the debug
info for a compilation unit only contains line number information for inline
functions (in headers) that are actually used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31495 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 00:08:45 +00:00
Ingo Weinhold
f66bd6256a Very much work in progress, not in a particularly working state. Haiku munged
a good part of the source tree, so I rather get those changes into the
repository before continuing.
The general aim of the work is to deal with multiple instances of the same
function, e.g. inlined or non-inlined inline functions or those weird duplicates
gcc (4 at least) seems to be generating for no apparent reason.
* Added classes FunctionInstance (wrapping FunctionDebugInfo) and Function.
  FunctionInstance represents a physical instance of a function (e.g. inlined
  function at a particular address). A Function collects all FunctionInstances
  referring to the same source code location.
* Moved the SourceCode property from FunctionDebugInfo to Function accordingly.
* Since SourceCode is no longer associated with a concrete function instance,
  several methods dealing with statements have been removed and the
  functionality has been provided through other means (e.g. TeamDebugModel or
  SpecificImageDebugModel). This part is not yet completed.
* Introduced UserBreakpoint and UserBreakpointInstance. The user sets a
  breakpoint at a source code location, which is represented by a
  UserBreakpoint. Since that source location can be mapped to one address per
  instance of the respective function, UserBreakpoint has a
  UserBreakpointInstance per such function instance, which in turn refers to a
  Breakpoint (an actual breakpoint at an address).
* Adjusted Breakpoint, BreakpointManager, and TeamDebugger accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31447 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-07 20:47:39 +00:00
Ingo Weinhold
d9b10dea3b * Extended ImageInfo and Image so they know the image type.
* Added DebuggerInterface::GetSymbolInfo().
* Implementing stopping the thread in main() when the debugger started the
  debugged program.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31393 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-03 14:23:19 +00:00
Ingo Weinhold
593fa6776a * DWARF:
- DwarfUtils::GetDeclarationLocation(): Line/column numbers are one-based.
  - Added line number program interpretation (LineNumberProgram).
* FunctionDebugInfo: Return the source file (LocatableFile) instead of the
  file name.
* FileManager/LocatableEntry: Fixed handling when a LocatableEntry is
  unreferenced. There was a race condition before, since an unreferenced entry
  could be referenced and unreferenced again before removing it from the hash
  table, which could lead to double deletion. Now we never reuse an unreferenced
  entry and just remove it from the hash table when encountering one.
* FileManager/SourceFile: Added class SourceFile which loads a source file from
  disk and slices it into lines. Managed by FileManager.
* Added class FileSourceCode, a SourceCode implementation using a SourceFile as
  line provider. The statement management works pretty much exactly as in
  DissassembledCode.
* DwarfImageDebugInfo: Implemented LoadSourceCode for real. It creates a
  FileSourceCode and uses the DWARF line number information for the statement
  information. This basically gets the source level view going, though there
  are still several problems -- stepping doesn't work perfectly yet, the source
  isn't found for all functions, there's no handling of duplicate functions (no
  idea why gcc generates them in the first place), etc.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31382 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-03 00:56:39 +00:00
Ingo Weinhold
3c5dbb462d * Moved Array.h to new directory "types".
* Added StringUtils with string hash functions.
* Added Locatable{Entry,File,Directory} and FileManager classes to manage the
  mapping from debug info/target file names to local file names.
* Image does now have a LocatableFile referring to the image's shared object
  file. Added listening to location changes of these files to TeamDebugger. No
  action is taken yet (should trigger reloading the debug info).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31368 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-01 22:09:33 +00:00
Ingo Weinhold
5b60969c5c * Renamed ArchitectureTypes.h to Types.h.
* Created "types" subdirectory for basic types and moved Types.h,
  SourceLocation, TargetAddressRange there.
* Added TargetAddressRangeList, representing a list of address ranges.
* Array: Added copy constructor and assignment operator.
* Added DwarfFunctionDebugInfo.
* ElfFile: Also read the program headers and provide access to the segment
  information.
* DWARF:
  - Some work on DIECompileUnitBase and DIESubprogram to handle attributes we
    need.
  - Added DwarfUtils class which provides static utility methods. Currently some
    to get DIE names. Only provisionally implemented yet.
  - Read range list attribute values from the .debug_ranges section. Extended
    AttributeValue to handle them correctly (ref-counting).
* DwarfImageDebugInfo:
  - Implemented GetFunctions() for real, i.e. we return functions for all
    subprogram debug info entries we find (those that refer to actual
    functions, that is).
  - Implemented the fallback part of LoadSourceCode() (reading the code from the
    file and disassembling it).

Things should hopefully work as before, just a bit slower and with less accurate
function names, if DWARF debug info is available. Promising, eh? ;-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31321 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-29 22:38:15 +00:00
Ingo Weinhold
671ef9b084 * Some moving and renaming.
* Added TeamDebugInfo which serves as factory for ImageDebugInfos.
* Added the DWARF code to the build again. It's not used yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31278 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-27 21:09:21 +00:00
Ingo Weinhold
93b6484548 * Added support for loading the debug info for an image lazily and adjusted
the jobs accordingly.
* Added a view to list the source files and functions for an image.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31271 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-27 16:49:55 +00:00
Ingo Weinhold
6fb6551c97 * ThreadHandler::_ClearContinuationState(): Forgot to set fStepStatement to
NULL after releasing its reference, so it could be released again later.
* No longer attach the source code to StackFrame, but rather to
  FunctionDebugInfo. Besides being the more obvious place it also prevents
  un-/reloading the source code when stepping. Only disadvantage is that we
  never unload the source again yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31256 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-26 15:11:56 +00:00
Ingo Weinhold
1c6fd17f75 Pulled interface TeamMemory out of DebuggerInterface to make the arch and model
packages indepent of the latter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-26 00:39:23 +00:00
Ingo Weinhold
2460bf468b * Changes that should already have been part of r31228: StackFrame and
SourceView.
* Fixed the information flow problem in Architecture::CreateStackTrace()/
  ArchitectureX86::UpdateStackCpuState() by introducing a virtual
  UpdateStackFrameCpuState() which allows the architecture to update the CPU
  state it generated before after the function the state belongs to is known.
  That's where moving the instruction pointer to the previous instruction
  happens now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31229 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-24 22:10:07 +00:00
Ingo Weinhold
6381d6cc4e * Added Breakpoint class and extended TeamDebugModel to manage the objects.
Extended the event mechanism respectively.
* Added support to SourceView to display breakpoints and manipulate them.
* Extended TeamDebugger to install/uninstall breakpoints.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31189 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 21:51:32 +00:00
Ingo Weinhold
7367310fbe * Virtualized SourceCode and implemented a derived class DisassembledCode, which
allows to implement StatementAtAddress() in O(log(n).
* Added SourceCode::StatementAtLine().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31174 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 01:13:57 +00:00
Ingo Weinhold
21821017e7 Added ContiguousStatement::AddressRange() for cheaper address range access.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31173 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-22 01:09:26 +00:00
Ingo Weinhold
49ad0141cf Added StatementAtAddress() returning the statement at a given target address.
Needs optimization (iterates through all statements ATM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31169 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 23:30:18 +00:00
Ingo Weinhold
1df9bf1220 Added Statement::ContainsAddress().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31168 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 23:28:13 +00:00
Ingo Weinhold
0bcacd22ab * Added classes to represent source code (SourceCode, Statement).
* Added x86 disassembler (via libudis86).
* Added Architecture::DisassembleCode() to disassemble a function to SourceCode.
* Added virtual DebugInfo::LoadSourceCode() to retrieve the source code for a
  given function. The implementation in DebuggerDebugInfo disassembles the
  function.
* Added source code info to StackFrame. Also added a listener mechanism to get
  notified on source code changes.
* Added job to load the source code for a stack frame.
* Added (very basic) source code view and wired everything so that when a stack
  frame is selected the source code (respectively disassembly) for the
  underlying function is retrieved and shown.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31158 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-21 13:17:21 +00:00
Ingo Weinhold
c9fc1d5064 Moved several classes into new "model" subdir.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31143 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-20 18:17:48 +00:00