History log of /haiku-fatelf/src/apps/debugger/arch/x86/ArchitectureX86.cpp
Revision Date Author Comments
# 5745a40d 31-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Rework how return values are handled.

- ArchitectureX86 now hands off the work for GetInstructionInfo() to
DisassemblerX86, since the latter has all the information we need
to properly classify and evaluate instructions. Correspondingly a
CpuState is passed down to it in order to perform address calculations
for the instruction if it's a jump or call instruction. The latter's
targets are then stored on the thread for later retrieval when
constructing a stack trace. Adjust X86_64 accordingly for the
signature changes. This also fixes a bug where Step Over would
sometimes result in a Step Into instead due to the previous
implementation of GetInstructionInfo() occasionally failing to
classify call instructions correctly.

- Architecture::CreateStackTrace() now takes an argument specifying
the address of the last executed function if applicable. This is used
to decide who/where to decode a return value from. Adjust callers.

- DwarfImageDebugInfo::_CreateReturnValue() uses the above information
in order to know directly who the caller it needs to look up a return
value for is, rather than trying to walk backwards to find them.
Type resolution is now also a bit more sophisticated due to various
cases where the subprogram entry didn't directly contain the return
type but referred to another DIE that did. Retrieving return value
now appears to work properly in all cases except when position
independent code is involved. The latter however will require
resolving the appropriate function address in the PLT, which will
need some additional work.


# dc693e92 28-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Extend Architecture to help retrieve return values.

- Architecture now has a new function to retrieve the location where
a return value can be found. Added implementation for x86 and stub
for x86-64.


# 84ea02a0 28-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Extend InstructionInfo for subroutines.

- InstructionInfo now also stores the destination address of subroutine
call instructions.
- Adjust callers.


# 9a538a29 20-Dec-2012 Alex Smith <alex@alex-smith.me.uk>

A few x86_64 debugger fixes + style fixes.


# 1e11702f 01-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Fix #9247.

- If a program crashed due to an invalid function pointer, the stack
was being incorrectly unwound such that the top frame would actually
be skipped, preventing one from seeing the actual line of code that
invoked said pointer. On x86, we now check if the IP of the top frame
of the stack lies at a readable location in order to catch this case.


# 6be4555f 12-Nov-2012 Rene Gollent <anevilyak@gmail.com>

Also report back the number of bytes each register can watch.


# 22fc56ce 10-Nov-2012 Rene Gollent <anevilyak@gmail.com>

Correct an oversight. Thanks Ingo!


# 4f9eec72 11-Nov-2012 Rene Gollent <anevilyak@gmail.com>

Add watchpoint capabilities hook to Architecture.

Will be used by the watchpoint manager and/or watchpoint UI to
present and/or handle the relative limitations of the current platform.


# 7483c98d 05-Aug-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Debugger (and some friends): 64 bit fixes


# 26334a8a 15-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Fix unwinding of partial stack traces.

- Architecture::CreateStackTrace() now uses the last frame's
PreviousCpuState() as the basis to continue unwinding when passed
a partial trace to continue from, rather than the (incorrect) actual
cpu state of that frame, which would have resulted in the last frame
being duplicated in the trace.

- Renamed variables to be more clear.


# 4b64cd3d 12-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Add architecture function for retrieving the stack growth direction.

Also add corresponding implementation for x86.


# c3e066cf 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Replaced uses of obsolescent BReference[able] API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39869 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 87d85ea3 11-Dec-2010 Rene Gollent <anevilyak@gmail.com>

- Refactor setting up the default register rules to happen in the Architecture
class in order to allow us to set up architecture specific default rules
for registers that aren't explicitly set by the CFI program.
- Set up default rule for EIP on x86.
- Theoretically set up a default rule for the stack pointer. Disabled for the
time being though until I determine why that rule's not yielding the expected
values for ESP in anything other than the top frame, though the other location
offset rules work as expected.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39816 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d054be0d 09-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the data location resolution methods from StackFrameDebugInfo to the
respective Type classes. StackFrameDebugInfo is pretty much out of work now,
but maybe something comes up later.
* Renamed GlobalTypeLookupContext to GlobalTypeCache and renamed its methods.
* A TeamDebugInfo does now have a GlobalTypeCache which is used for resolving
types. Formerly it was created per stack frame, so all types had to be
resolved after each single step. Single-stepping is usably fast again.
The disadvantage is that DWARF theoretically allows types properties to
depend on instruction/frame/frame base pointer and we don't support that
anymore. I can't think of a reasonable application for that feature, though.
* Refactored DwarfStackFrameDebugInfo:
- Moved the type classes into new DwarfTypes.{h,cpp}.
- Moved the creation of types into new class DwarfTypeFactory.
- Added class DwarfTypeContext which bundles all the dependencies of the type
classes.
* Made DwarfFile a BReferenceable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33495 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e82b4941 26-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* ValueLocation:
- Changed the bit{Offset,Size} semantics. It's now more or less
aligned with the semantics of the respective DWARF DIE attributes.
DwarfStackFrameDebugInfo does now correctly translate the ValueLocations
returned by the DWARF layer (the bit piece location expression semantics is
different for some reason).
- ValueLocation is now aware of the target's endianess. The SetTo() method
needs that information to correctly meddle with the pieces.
- Support normalizing the pieces.
* Fixed retrieving the values of bit fields in various places. We still don't
handle the bit offset/size attributes of types correctly, but I haven't seen
those in actual debug info yet.
* Added support for enumerations. The variable view shows the enumerator names,
when available.
* Added partial support for subrange types. C++ doesn't have those -- we only
need them for array dimensions.
* Started adding support for array types. Still work in progress.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33314 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e72ebfc 20-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* More work on retrieving local variable values. Address and compound types can
now be inspected. Still work in progress -- bit fields and arrays don't work
correctly yet nor does type lookup beyond the current compilation unit.
* Made most of the debugger output configurable via a config header. By default
it's much less noisy now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33217 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ae8f2240 21-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

GetStatement(): 0 is a valid source location line, so rather init to -1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31684 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c90f9b9e 21-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Correctly recognize the "call r/m32" opcode. There are three opcode bits in the
second byte, which we didn't check, thus incorrectly identifying some other
instructions as calls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31674 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3516af2 18-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added AddressSize(), IsBigEndian, IsHostEndian().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31634 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ade8662e 14-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added ReadValueFromMemory() version taking an "address space" + address pair as
used by DWARF. Not needed/supported for x86.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31576 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fd1f5093 13-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 614e1dc4 13-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Register:
- Added a type constant describing the format of the register value.
- Added flag "is callee-preserved" indicating whether the ABI requires the
register to be preserved by a called function.
* CpuState: Added SetRegisterValue(), made GetRegisterValue() const.
* Added RegisterMap interface for mapping register indices between different
models.
* Architecture:
- Added CreateCpuState() version to create a clean CpuState.
- Added GetDwarfRegisterMaps(), which returns to RegisterMaps, converting
from and to DWARF register indices.
- Added ReadValueFromMemory() reading a value from the target team's memory.
The value type is specified by a type constant and the value return via a
BVariant.
- CreateStackTrace: No longer decide whether to adjust the instruction pointer
of the previous CPU state depending on who created the CPU state. Instead
compare it with the return address of the next frame. If they are equal it
obviously has to be adjusted.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31539 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 18ca318a 10-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# f66bd625 07-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 1c6fd17f 25-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 43b0f7e0 25-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved breakpoint management into new class BreakpointManager and added
support for temporary breakpoints.
* TeamDebugger: No longer handle debug events in the listener thread. Instead
post a message to the looper thread. Makes the locking a bit easier.
* Architecture: Added virtual GetInstructionInfo() and GetStatement() returning
information on the instruction respectively a statement at a given address.
Implemented for x86.
* DebugInfo: Added virtual GetStatement() and implemented it for
DebuggerDebugInfo by means of using the Architecture.
* Implemented step over/into/out support. Works in principle, but has no
handling for PLTs yet, i.e. stepping into functions of other libraries
requires two steps ATM.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31244 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 823e8a80 24-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Recognize non-frameless functions and deal with situations where the instruction
pointer is before/in the prologue or after the epilogue. No solution for
frameless functions yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31232 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2460bf46 24-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 840c7653 24-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added StackFrame classification as syscall frame and added correct
identification for x86.
* For non-top stack frames adjust the instruction pointer so that it points to
the calling function instead of the return address.
* SourceView: Consider a syscall frame a non-top frame (the arrow is drawn
differently).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31228 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7367310f 21-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 470c2c49 21-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Passed incorrect instruction size to Statement constructor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31167 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0bcacd22 21-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 0b60fa86 20-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added DebuggerInterface::GetSymbolInfos() to get the symbols for an image.
* Added the beginnings of the debug info abstraction. Currently we can only load
the symbols via the debugger.
* Added a job to retrieve debug info for an image. Extended the GetStackTraceJob
to support waiting for image debug info to be loaded.
* Extended ImageInfo by text/data address and size.
* Removed StackFrameX86 and made StackFrame a simple non-polymorphic class
featuring all the needed data. The really architecture-dependent is in the
referenced CpuState already. Added Image* and FunctionDebugInfo* attributes,
referring to the image respectively debug info for the function hit by the
instruction pointer.
* Switched StrackTrace's StackFrame management from DoublyLinkedList to
BObjectList. This makes it more comfortable to use.
* Changed the code for creating stack traces:
- The creation of the StackTrace object and the main loop to collect the
frames are now located in the no longer virtual
Architecture::CreateStackTrace().
- The decision how to create a StackFrame is based on the instruction pointer.
If it hit a function for which debug info is available, the respective
DebugInfo::CreateStackFrame() is used, otherwise we fall back to the new
virtual Architecture::CreateStackFrame().
* Adjusted the stack trace view to also show function names (mangled ATM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31142 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 15f040e5 19-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Some work towards getting stack traces:
* Added a virtual Architecture::CreateStackTrace() and added a basic
implementation in ArchitectureX86. Fleshed out StackTrace/StackFrame a bit
and added StackFrameX86. This needs to be organized differently, though, so
that we can get the maximum available information for each stack frame,
depending on what info is available for the respective function.
* Added job to get the stack trace for a thread.
* Added stack trace related handling in TeamDebugger. Reorganized the thread
state/CPU state/stack trace change handling a bit -- we're using a
Team::Listener now, and do things asynchronously.
* Added a StackTraceView to display the stack trace of the current thread. No
function name available yet, otherwise working fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c42fe1eb 18-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

More work on the architecture abstraction, particularly regarding information
about what registers the architecture has and how to get them from the CpuState.
Implemented the respective x86 part.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31109 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a81bb42a 18-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Beginnings of the architecture abstraction.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31104 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6be4555f928cf3287544a0a7e0ba63de45b85fff 12-Nov-2012 Rene Gollent <anevilyak@gmail.com>

Also report back the number of bytes each register can watch.


# 22fc56ce8c63d7b52d6bf2f8e0483413e57e62cd 10-Nov-2012 Rene Gollent <anevilyak@gmail.com>

Correct an oversight. Thanks Ingo!


# 4f9eec722ccbf709057a8c8df2539772ead7199e 11-Nov-2012 Rene Gollent <anevilyak@gmail.com>

Add watchpoint capabilities hook to Architecture.

Will be used by the watchpoint manager and/or watchpoint UI to
present and/or handle the relative limitations of the current platform.


# 7483c98dece8f3606fc5d3fd746c0544f7e4b6dd 05-Aug-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

Debugger (and some friends): 64 bit fixes


# 26334a8a66a1365b8fbd135a9dacc8fe897b6d38 15-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Fix unwinding of partial stack traces.

- Architecture::CreateStackTrace() now uses the last frame's
PreviousCpuState() as the basis to continue unwinding when passed
a partial trace to continue from, rather than the (incorrect) actual
cpu state of that frame, which would have resulted in the last frame
being duplicated in the trace.

- Renamed variables to be more clear.


# 4b64cd3de3d7d34b2bf2a4d14372638615239bed 12-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Add architecture function for retrieving the stack growth direction.

Also add corresponding implementation for x86.


# c3e066cf6d35a86d29396d4e740f9811e506b66c 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Replaced uses of obsolescent BReference[able] API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39869 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 87d85ea382bac0d2c83b5944ef807d4ec31fc111 11-Dec-2010 Rene Gollent <anevilyak@gmail.com>

- Refactor setting up the default register rules to happen in the Architecture
class in order to allow us to set up architecture specific default rules
for registers that aren't explicitly set by the CFI program.
- Set up default rule for EIP on x86.
- Theoretically set up a default rule for the stack pointer. Disabled for the
time being though until I determine why that rule's not yielding the expected
values for ESP in anything other than the top frame, though the other location
offset rules work as expected.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39816 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d054be0d8c41431d611f41171232b0f75ec6f30f 09-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the data location resolution methods from StackFrameDebugInfo to the
respective Type classes. StackFrameDebugInfo is pretty much out of work now,
but maybe something comes up later.
* Renamed GlobalTypeLookupContext to GlobalTypeCache and renamed its methods.
* A TeamDebugInfo does now have a GlobalTypeCache which is used for resolving
types. Formerly it was created per stack frame, so all types had to be
resolved after each single step. Single-stepping is usably fast again.
The disadvantage is that DWARF theoretically allows types properties to
depend on instruction/frame/frame base pointer and we don't support that
anymore. I can't think of a reasonable application for that feature, though.
* Refactored DwarfStackFrameDebugInfo:
- Moved the type classes into new DwarfTypes.{h,cpp}.
- Moved the creation of types into new class DwarfTypeFactory.
- Added class DwarfTypeContext which bundles all the dependencies of the type
classes.
* Made DwarfFile a BReferenceable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33495 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e82b494112f921f214e2ff6604ddfba1e2ef63a9 26-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* ValueLocation:
- Changed the bit{Offset,Size} semantics. It's now more or less
aligned with the semantics of the respective DWARF DIE attributes.
DwarfStackFrameDebugInfo does now correctly translate the ValueLocations
returned by the DWARF layer (the bit piece location expression semantics is
different for some reason).
- ValueLocation is now aware of the target's endianess. The SetTo() method
needs that information to correctly meddle with the pieces.
- Support normalizing the pieces.
* Fixed retrieving the values of bit fields in various places. We still don't
handle the bit offset/size attributes of types correctly, but I haven't seen
those in actual debug info yet.
* Added support for enumerations. The variable view shows the enumerator names,
when available.
* Added partial support for subrange types. C++ doesn't have those -- we only
need them for array dimensions.
* Started adding support for array types. Still work in progress.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33314 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e72ebfce3cb4969f9b27b4210d7631ba16948fa 20-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* More work on retrieving local variable values. Address and compound types can
now be inspected. Still work in progress -- bit fields and arrays don't work
correctly yet nor does type lookup beyond the current compilation unit.
* Made most of the debugger output configurable via a config header. By default
it's much less noisy now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33217 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ae8f22407aa3da6e25ffbf5628a8e634611d029e 21-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

GetStatement(): 0 is a valid source location line, so rather init to -1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31684 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c90f9b9ef3ff1515d3a35041ca56c1fa12ea35da 21-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Correctly recognize the "call r/m32" opcode. There are three opcode bits in the
second byte, which we didn't check, thus incorrectly identifying some other
instructions as calls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31674 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f3516af2cadd94e25e9c9c87c2455c72c743d255 18-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added AddressSize(), IsBigEndian, IsHostEndian().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31634 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ade8662ece5b720ded2741eff2eab5a87062ed8b 14-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added ReadValueFromMemory() version taking an "address space" + address pair as
used by DWARF. Not needed/supported for x86.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31576 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fd1f5093305cee37ad817d62ccbbe434aab18405 13-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 614e1dc42fb2c04ff44bda621bea500d01d6a4c3 13-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Register:
- Added a type constant describing the format of the register value.
- Added flag "is callee-preserved" indicating whether the ABI requires the
register to be preserved by a called function.
* CpuState: Added SetRegisterValue(), made GetRegisterValue() const.
* Added RegisterMap interface for mapping register indices between different
models.
* Architecture:
- Added CreateCpuState() version to create a clean CpuState.
- Added GetDwarfRegisterMaps(), which returns to RegisterMaps, converting
from and to DWARF register indices.
- Added ReadValueFromMemory() reading a value from the target team's memory.
The value type is specified by a type constant and the value return via a
BVariant.
- CreateStackTrace: No longer decide whether to adjust the instruction pointer
of the previous CPU state depending on who created the CPU state. Instead
compare it with the return address of the next frame. If they are equal it
obviously has to be adjusted.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31539 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 18ca318a3d814fb5c61218b6097db8dd6b4fe0a4 10-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# f66bd6256a87005ccaa493859ede2ca1601b8560 07-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 1c6fd17f75bd67d7135d31ffb138e19abec4de89 25-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 43b0f7e0d78311f9c484992b9bce69916b78a031 25-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved breakpoint management into new class BreakpointManager and added
support for temporary breakpoints.
* TeamDebugger: No longer handle debug events in the listener thread. Instead
post a message to the looper thread. Makes the locking a bit easier.
* Architecture: Added virtual GetInstructionInfo() and GetStatement() returning
information on the instruction respectively a statement at a given address.
Implemented for x86.
* DebugInfo: Added virtual GetStatement() and implemented it for
DebuggerDebugInfo by means of using the Architecture.
* Implemented step over/into/out support. Works in principle, but has no
handling for PLTs yet, i.e. stepping into functions of other libraries
requires two steps ATM.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31244 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 823e8a80f7254417ab5ea44b16828b4db5ddc42d 24-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Recognize non-frameless functions and deal with situations where the instruction
pointer is before/in the prologue or after the epilogue. No solution for
frameless functions yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31232 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2460bf468bd81eb00457e5e0137c736ffa8ffda4 24-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 840c76534f7caaca52752d147778a4929e66c361 24-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added StackFrame classification as syscall frame and added correct
identification for x86.
* For non-top stack frames adjust the instruction pointer so that it points to
the calling function instead of the return address.
* SourceView: Consider a syscall frame a non-top frame (the arrow is drawn
differently).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31228 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7367310fbe0c06244a678bfaa36a60e5817659dd 21-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 470c2c49a961e62df47024d8bb95c642e7a106fb 21-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Passed incorrect instruction size to Statement constructor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31167 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0bcacd22ab6dc13aa6fb33197a6c3d14a62d1b00 21-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 0b60fa86e977411b90631a7a177c4b93c18106e1 20-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added DebuggerInterface::GetSymbolInfos() to get the symbols for an image.
* Added the beginnings of the debug info abstraction. Currently we can only load
the symbols via the debugger.
* Added a job to retrieve debug info for an image. Extended the GetStackTraceJob
to support waiting for image debug info to be loaded.
* Extended ImageInfo by text/data address and size.
* Removed StackFrameX86 and made StackFrame a simple non-polymorphic class
featuring all the needed data. The really architecture-dependent is in the
referenced CpuState already. Added Image* and FunctionDebugInfo* attributes,
referring to the image respectively debug info for the function hit by the
instruction pointer.
* Switched StrackTrace's StackFrame management from DoublyLinkedList to
BObjectList. This makes it more comfortable to use.
* Changed the code for creating stack traces:
- The creation of the StackTrace object and the main loop to collect the
frames are now located in the no longer virtual
Architecture::CreateStackTrace().
- The decision how to create a StackFrame is based on the instruction pointer.
If it hit a function for which debug info is available, the respective
DebugInfo::CreateStackFrame() is used, otherwise we fall back to the new
virtual Architecture::CreateStackFrame().
* Adjusted the stack trace view to also show function names (mangled ATM).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31142 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 15f040e596308c36903c8381112ef04280b95963 19-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Some work towards getting stack traces:
* Added a virtual Architecture::CreateStackTrace() and added a basic
implementation in ArchitectureX86. Fleshed out StackTrace/StackFrame a bit
and added StackFrameX86. This needs to be organized differently, though, so
that we can get the maximum available information for each stack frame,
depending on what info is available for the respective function.
* Added job to get the stack trace for a thread.
* Added stack trace related handling in TeamDebugger. Reorganized the thread
state/CPU state/stack trace change handling a bit -- we're using a
Team::Listener now, and do things asynchronously.
* Added a StackTraceView to display the stack trace of the current thread. No
function name available yet, otherwise working fine.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c42fe1eb572377d133cc3650e49de2ec76e965a2 18-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

More work on the architecture abstraction, particularly regarding information
about what registers the architecture has and how to get them from the CpuState.
Implemented the respective x86 part.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31109 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a81bb42a9321a3b8ccf7f92623237826ff8767f4 18-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Beginnings of the architecture abstraction.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31104 a95241bf-73f2-0310-859d-f6bbb57e9c96