History log of /haiku-fatelf/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp
Revision Date Author Comments
# ec269755 01-Jan-2013 Rene Gollent <anevilyak@gmail.com>

Disable populating return values onto the variable list.

- Still needs some work with respect to false positives in the most
recent code, as well as the missing bits for PIC.


# 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.


# cf2e209b 29-Dec-2012 Rene Gollent <anevilyak@gmail.com>

More improvements to return value handling.

- Thread now has a data member indicating if a subroutine was
executed during the last set of steps.
- ThreadHandler now sets the aforementioned state appropriate during
Step Over/Step Out.
- Architecture::CreateStackTrace() now takes a parameter indicating
whether return value retrieval is desired (based on aforementioned
thread value). Adjust callers accordingly.
- DwarfImageDebugInfo: If return value retrieval is requested, loop
backwards from the current IP to find the call instruction.


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

Initial implementation of _GetReturnValue().

- Look at the destination of the subroutine instruction and try to
resolve it to a function. Currently only handles functions whose
destination are within the same image.

- If found, look up debug info for the target function. If available,
determine if it returns a value. If so, construct an appropriate
placeholder variable and add it to the frame's variable list.


# bc1ec2ec 25-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Initial work towards retrieving function return values.

- When creating a stack frame, we now look at the current function's
state to determine if the last executed statement was a function call.
Still need to determine the call destination in order to look up
the latter function, retrieve its return type, and then request
retrieval of the actual return value if applicable.


# 1167ae52 25-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Some optimizations for ThreadHandler.

- CreateStackTrace() now takes a parameter indicating whether or not
to try and retrieve full frame information. This in turn is passed
on to SpecificImageDebugInfo, where e.g. DwarfImageDebugInfo can
use it to avoid constructing variables and parameters. This is
used by ThreadHandler since, when it requests the top frame for
its stepping calculations, this additional data/work is completely
unnecessary.


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

A few x86_64 debugger fixes + style fixes.


# 5bda396e 16-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Refactor Dwarf*DebugInfo to be able to work with limited info.

- DwarfImageDebugInfo and DwarfFile will now allow us to construct
DWARF debug info objects even if the only section available for
use is .eh_frame. This essentially allows us to use CFI-based
unwinding even for release executables (assuming C++ is involved),
which means we can properly unwind the stack even for binaries
compiled with fomit-frame-pointer. This becomes more important
for x86-64, since omit is the ABI default there.

- Pull a GetFunctionsFromSymbols() out of DebuggerImageDebugInfo. This
is shared between DebuggerImageDebugInfo and DwarfImageDebugInfo for
creating debug information entries in the absence of debugging
information.


# 6d3ea79f 04-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Fix memory corruption issue.

- Since BasicTargetInterface is a BReferenceable, we must not create it
on the stack, else it will be destroyed while others still have
references to it. Fixes various random crashes, though most frequently
observable when typecasting with more complex types.


# 5ad3b800 02-Dec-2012 Rene Gollent <anevilyak@gmail.com>

Fix incorrect matching logic.

- Would lead to the wrong type potentially being matched since name
comparison would be skipped.


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

Debugger (and some friends): 64 bit fixes


# d826a252 13-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Cleanup, no functional change.


# c4120026 11-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Refactor previous commit.

- Keep knowledge of the existence and need to search the different
frame sections contained within DwarfFile.


# dfa21dfe 11-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Fix #8508.

- When attempting to unwind the call frame, we now search for the appropriate
FDE in both .debug_frame and .eh_frame. This mirrors gdb's behavior and
works around the ever-changing whims of the gcc developers as to which
section the requisite FDE/CIE resides in.


# 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.


# e5519ef5 04-Jul-2011 Rene Gollent <anevilyak@gmail.com>

Add a constraint field which allows one to specify a particular base type name.
This is necessary for looking up pointer and array types.



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


# 185d2cdc 30-Jun-2011 Rene Gollent <anevilyak@gmail.com>

* Add model class TypeLookupConstraints.
* Create and pass constraints to type lookup requests to ensure
that the type we get back is in fact the one we wanted, and not
a different one that happened to have a similar name.

Resolves ticket #5495.



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


# 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


# d4556a4f 13-Dec-2010 Rene Gollent <anevilyak@gmail.com>

- More style cleanups.
- Add FindSection() and IsLoaded() calls to ElfFile.
- On init, cache the section start/end for the .text and .plt
sections in DwarfImageDebugInfo. Use them to make the check
for classifying addresses significantly cheaper.



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


# 958cc95d 12-Dec-2010 Rene Gollent <anevilyak@gmail.com>

Implement support for detecting if a given target address is in a Procedure
Linkage Table section. Use that additional information to skip PLT entries
while stepping. Fixes #6974.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39823 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


# 558028c0 06-Dec-2010 Rene Gollent <anevilyak@gmail.com>

Also dump the name of the function to which the current call frame belongs.



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


# 495e073b 15-Nov-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Don't skip subprogram DIEs with prototyped attribute, which make loading functions from
plain C program actually works.


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


# 3a1ce93b 11-Nov-2010 Rene Gollent <anevilyak@gmail.com>

When computing absolute addresses, take the image relocation
delta into account. Fixes retrieving the addresses and
consequently values of static variables.



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


# c9b58a73 06-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

More debug output.


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


# d75e3d6c 11-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Ignore unnamed function parameters in the stack frame.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33542 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


# 71f75cdc 06-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* WIP regarding non comilation unit local types:
- Introduced GlobalTypeLookup interface and GlobalTypeLookupContext to look
up types by name and cache them.
- TeamDebugInfo implementes GlobalTypeLookup iterating through all
ImageDebugInfos, which in turn iterate through all SpecificImageDebugInfos.
- DwarfImageDebugInfo iterates through all compilation units, using
a temporary DwarfStackFrameDebugInfo to create the type.
- DwarfStackFrameDebugInfo no longer caches the types itself, but uses
GlobalTypeLookupContext. It uses GlobalTypeLookup to look up types not
defined in the compilation unit.
- DwarfFile: Made expression evaluation more robust, so that it also works,
when no subroutine entry, frame pointer, and instruction pointer are
available (and not used by the expression).
Basically works already, although the wrong compilation unit might be used
when resolving values for global types. It's also horribly slow, when there
are many types in the stack frame.
* DwarfStackFrameDebugInfo::ResolveArrayElementLocation(): The element location
piece size was set incorrectly (multiplied by 8, although bytes were
expected).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33477 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


# 8fad39df 19-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Also get the local variables for a stack frame. Apparently gcc doesn't add a
DW_AT_start_scope attribute to any variable entries, so the variables already
appear at the beginning of the block. I suppose we'll have to guess from the
source location when the variables become active.


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


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

* 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


# d315bfd5 16-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


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

Rather resolve range lists lazily. We need them for all functions, but there
are a lot more DIEs that have range lists.


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


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

Added DwarfTargetInterface::ReadValueFromMemory() version with address
space + address pair.


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


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

* Got rid of dwarf_{addr,off,size}_t. Consequently use 64 bit types instead.
* Made the DWARF code fully 64 bit aware (hopefully).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31546 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


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

* DWARF: Implemented parsing the DWARF frame info and evaluating it (save for
DWARF expressions). Several related new classes: CfaRule[Set], CfaContext,
DwarfTargetInterface (for accessing target registers and memory).
* Implemented DwarfImageDebugInfo::CreateFrame(), so the DWARF frame info is
used for unwinding the stack.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31540 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


# a4b0c192 09-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 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


# cc13762f 03-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Don't skip subprogram entries that have an abstract origin. Only do so, when
the function is actually inlined, which we already checked for anyway. Now the
source location info should be retrieved correctly for all functions, even if
if we get potential duplicates for non-inlined functions. This has to be
dealt with differently, though.


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


# b619e187 03-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed the line and column parameter of DwarfUtils::GetDeclarationLocation()
to int32&. The DWARF indices are one-based with 0 as invalid/no value, but we
subtract one to get real indices and -1 as special value.


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


# 3dc97aa3 03-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed GCC2 build.


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


# 593fa677 02-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# df9cc734 29-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Retrieve the source file declaration locations for functions and attach them
to the DwarfFunctionDebugInfo objects. The functions do now appear organized
by source file in the function list view. Unfortunately the list view is too
small to look as clear as it should. Got to think of something else I'm afraid.


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


# 5b60969c 29-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# b5713f22 27-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added DwarfTeamDebugInfo and DwarfImageDebugInfo, the classes to interface with
the DWARF code. Not doing much yet.


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


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

Debugger (and some friends): 64 bit fixes


# d826a252c1014a8dc171b752290b60df904aeb17 13-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Cleanup, no functional change.


# c4120026a5c8c365a57917ea923779c07df9aea0 11-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Refactor previous commit.

- Keep knowledge of the existence and need to search the different
frame sections contained within DwarfFile.


# dfa21dfeabe22cd7df5de50e21bf1ad3678454b8 11-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Fix #8508.

- When attempting to unwind the call frame, we now search for the appropriate
FDE in both .debug_frame and .eh_frame. This mirrors gdb's behavior and
works around the ever-changing whims of the gcc developers as to which
section the requisite FDE/CIE resides in.


# 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.


# e5519ef504a4c7c19bbd477f583bf837777eaf5d 04-Jul-2011 Rene Gollent <anevilyak@gmail.com>

Add a constraint field which allows one to specify a particular base type name.
This is necessary for looking up pointer and array types.



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


# 185d2cdcb9b3af20ad0e9cce53ed7e5bafe2e962 30-Jun-2011 Rene Gollent <anevilyak@gmail.com>

* Add model class TypeLookupConstraints.
* Create and pass constraints to type lookup requests to ensure
that the type we get back is in fact the one we wanted, and not
a different one that happened to have a similar name.

Resolves ticket #5495.



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


# 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


# d4556a4f56671fddc1fc7781baadb8517970fc54 13-Dec-2010 Rene Gollent <anevilyak@gmail.com>

- More style cleanups.
- Add FindSection() and IsLoaded() calls to ElfFile.
- On init, cache the section start/end for the .text and .plt
sections in DwarfImageDebugInfo. Use them to make the check
for classifying addresses significantly cheaper.



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


# 958cc95d32c96d15a32a8994c27ed1a960b72997 12-Dec-2010 Rene Gollent <anevilyak@gmail.com>

Implement support for detecting if a given target address is in a Procedure
Linkage Table section. Use that additional information to skip PLT entries
while stepping. Fixes #6974.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39823 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


# 558028c0e6dded88d3dc85dc88b3b0257880f7f3 06-Dec-2010 Rene Gollent <anevilyak@gmail.com>

Also dump the name of the function to which the current call frame belongs.



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


# 495e073b20e05078a04f548f51564688c5303f18 15-Nov-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Don't skip subprogram DIEs with prototyped attribute, which make loading functions from
plain C program actually works.


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


# 3a1ce93bc72bfa23e0f46642c256aa735fb80426 11-Nov-2010 Rene Gollent <anevilyak@gmail.com>

When computing absolute addresses, take the image relocation
delta into account. Fixes retrieving the addresses and
consequently values of static variables.



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


# c9b58a73135b2d322a9e3949c7004cbeeb3a9e8e 06-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

More debug output.


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


# d75e3d6c23b7983e3820f35226eac22e69f0fdbb 11-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Ignore unnamed function parameters in the stack frame.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33542 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


# 71f75cdcdee748eb5e0841f8868ab8f477c0ee75 06-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* WIP regarding non comilation unit local types:
- Introduced GlobalTypeLookup interface and GlobalTypeLookupContext to look
up types by name and cache them.
- TeamDebugInfo implementes GlobalTypeLookup iterating through all
ImageDebugInfos, which in turn iterate through all SpecificImageDebugInfos.
- DwarfImageDebugInfo iterates through all compilation units, using
a temporary DwarfStackFrameDebugInfo to create the type.
- DwarfStackFrameDebugInfo no longer caches the types itself, but uses
GlobalTypeLookupContext. It uses GlobalTypeLookup to look up types not
defined in the compilation unit.
- DwarfFile: Made expression evaluation more robust, so that it also works,
when no subroutine entry, frame pointer, and instruction pointer are
available (and not used by the expression).
Basically works already, although the wrong compilation unit might be used
when resolving values for global types. It's also horribly slow, when there
are many types in the stack frame.
* DwarfStackFrameDebugInfo::ResolveArrayElementLocation(): The element location
piece size was set incorrectly (multiplied by 8, although bytes were
expected).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33477 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


# 8fad39df434cc9811fa72a029fd2c68cb080b925 19-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Also get the local variables for a stack frame. Apparently gcc doesn't add a
DW_AT_start_scope attribute to any variable entries, so the variables already
appear at the beginning of the block. I suppose we'll have to guess from the
source location when the variables become active.


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


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

* 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


# d315bfd510d1dba20fe05a39ac455fe354ca1a96 16-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


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

Rather resolve range lists lazily. We need them for all functions, but there
are a lot more DIEs that have range lists.


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


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

Added DwarfTargetInterface::ReadValueFromMemory() version with address
space + address pair.


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


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

* Got rid of dwarf_{addr,off,size}_t. Consequently use 64 bit types instead.
* Made the DWARF code fully 64 bit aware (hopefully).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31546 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


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

* DWARF: Implemented parsing the DWARF frame info and evaluating it (save for
DWARF expressions). Several related new classes: CfaRule[Set], CfaContext,
DwarfTargetInterface (for accessing target registers and memory).
* Implemented DwarfImageDebugInfo::CreateFrame(), so the DWARF frame info is
used for unwinding the stack.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31540 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


# a4b0c19209887ee3619cf3f8b2935f51d23afca3 09-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 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


# cc13762f11016e84330cc7e9f27bde90beaa503a 03-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Don't skip subprogram entries that have an abstract origin. Only do so, when
the function is actually inlined, which we already checked for anyway. Now the
source location info should be retrieved correctly for all functions, even if
if we get potential duplicates for non-inlined functions. This has to be
dealt with differently, though.


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


# b619e1873c590f340c23ae615947a26418aec6c1 03-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed the line and column parameter of DwarfUtils::GetDeclarationLocation()
to int32&. The DWARF indices are one-based with 0 as invalid/no value, but we
subtract one to get real indices and -1 as special value.


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


# 3dc97aa3fb8f274a944509a78b0abf8f317247d6 03-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed GCC2 build.


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


# 593fa6776aecf8e722941718824b08338991555d 02-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# df9cc7340c2434eefbad8589ae4b5d2e7061fdca 29-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Retrieve the source file declaration locations for functions and attach them
to the DwarfFunctionDebugInfo objects. The functions do now appear organized
by source file in the function list view. Unfortunately the list view is too
small to look as clear as it should. Got to think of something else I'm afraid.


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


# 5b60969c5cd42c27295bb89746ef6882c0559a7a 29-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# b5713f228a44503ecb89ae98d327d93b8d4ea558 27-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added DwarfTeamDebugInfo and DwarfImageDebugInfo, the classes to interface with
the DWARF code. Not doing much yet.


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