2009-06-20 21:20:49 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
2015-01-02 01:33:32 +03:00
|
|
|
* Copyright 2013-2014, Rene Gollent, rene@gollent.com.
|
2009-06-20 21:20:49 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2009-06-28 01:09:21 +04:00
|
|
|
#ifndef SPECIFIC_IMAGE_DEBUG_INFO_H
|
|
|
|
#define SPECIFIC_IMAGE_DEBUG_INFO_H
|
2009-06-20 21:20:49 +04:00
|
|
|
|
* 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
2009-10-07 07:17:22 +04:00
|
|
|
|
2009-06-26 17:12:06 +04:00
|
|
|
#include <ObjectList.h>
|
2009-06-20 21:20:49 +04:00
|
|
|
#include <Referenceable.h>
|
|
|
|
|
2010-12-13 01:08:43 +03:00
|
|
|
#include "AddressSectionTypes.h"
|
2013-03-28 07:21:42 +04:00
|
|
|
#include "ReturnValueInfo.h"
|
2009-06-30 02:38:15 +04:00
|
|
|
#include "Types.h"
|
2009-06-20 21:20:49 +04:00
|
|
|
|
|
|
|
|
|
|
|
class Architecture;
|
* 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
2009-10-07 07:17:22 +04:00
|
|
|
class BString;
|
2009-06-20 21:20:49 +04:00
|
|
|
class CpuState;
|
2009-09-21 08:39:40 +04:00
|
|
|
class DataMember;
|
2009-06-20 21:20:49 +04:00
|
|
|
class DebuggerInterface;
|
* Since disassembled code is actually function instance specific,
FunctionInstance does now also have a (DisassembledCode) source code
attribute. Function keeps its attribute, but it explicitly is a
FileSourceCode now.
* SourceCode:
- Removed GetStatementAtLocation(). Instead DisassembledCode has a
StatementAtLocation() now. As well as a StatementAtAddress() and
StatementAddressRange(). Rather cast to the subclass (in two instances)
instead of having those methods in the base class. In most cases we already
have the subclasses now, anyway.
- Added Lock()/Unlock(), which are implemented in FileSourceCode. The
statement ranges are no longer immutable, so we have to lock.
* TeamDebugModel:
- Revived GetBreakpointsInAddressRange().
- GetBreakpointsForSourceCode(): Optimized for DisassembledCode and fixed
in the FileSourceCode case. We need to compare with the functions' source
file instead of their source code, since they might not have the source
code set yet. Fixed two instances of the same problem in SourceView. Setting
breakpoints in functions that have no associated source code yet, works now.
* Team:
- GetStatementAtAddress(): Optimized by using the DisassembledCode, if
available.
- GetStatementAtSourceLocation(): If the supplied source code is
DisassembledCode, we have to get the statement from it directly, since
we can't get that information from the image debug info.
* TeamDebugInfo: Added LoadSourceCode() and DisassembleFunction(), the new way
to get FileSourceCode respectively DisassembledCode. SpecificTeamDebugInfo
has lost LoadSourceCode() and gained service methods AddSourceCodeInfo() and
ReadCode(). This avoids unnecessary code duplication in the subclasses.
Moreover it allows for joining source location info source files from
different images (and compilation units) -- interesting for inline functions
in headers.
* Adjusted LoadSourceCodeJob and TeamDebugger::FunctionSourceCodeRequested()
accordingly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-11 04:05:26 +04:00
|
|
|
class FileSourceCode;
|
2009-06-20 21:20:49 +04:00
|
|
|
class FunctionDebugInfo;
|
2009-07-19 03:52:16 +04:00
|
|
|
class FunctionInstance;
|
2009-10-10 09:05:33 +04:00
|
|
|
class GlobalTypeCache;
|
2009-06-20 21:20:49 +04:00
|
|
|
class Image;
|
2012-12-16 19:59:12 +04:00
|
|
|
class ImageInfo;
|
* Since disassembled code is actually function instance specific,
FunctionInstance does now also have a (DisassembledCode) source code
attribute. Function keeps its attribute, but it explicitly is a
FileSourceCode now.
* SourceCode:
- Removed GetStatementAtLocation(). Instead DisassembledCode has a
StatementAtLocation() now. As well as a StatementAtAddress() and
StatementAddressRange(). Rather cast to the subclass (in two instances)
instead of having those methods in the base class. In most cases we already
have the subclasses now, anyway.
- Added Lock()/Unlock(), which are implemented in FileSourceCode. The
statement ranges are no longer immutable, so we have to lock.
* TeamDebugModel:
- Revived GetBreakpointsInAddressRange().
- GetBreakpointsForSourceCode(): Optimized for DisassembledCode and fixed
in the FileSourceCode case. We need to compare with the functions' source
file instead of their source code, since they might not have the source
code set yet. Fixed two instances of the same problem in SourceView. Setting
breakpoints in functions that have no associated source code yet, works now.
* Team:
- GetStatementAtAddress(): Optimized by using the DisassembledCode, if
available.
- GetStatementAtSourceLocation(): If the supplied source code is
DisassembledCode, we have to get the statement from it directly, since
we can't get that information from the image debug info.
* TeamDebugInfo: Added LoadSourceCode() and DisassembleFunction(), the new way
to get FileSourceCode respectively DisassembledCode. SpecificTeamDebugInfo
has lost LoadSourceCode() and gained service methods AddSourceCodeInfo() and
ReadCode(). This avoids unnecessary code duplication in the subclasses.
Moreover it allows for joining source location info source files from
different images (and compilation units) -- interesting for inline functions
in headers.
* Adjusted LoadSourceCodeJob and TeamDebugger::FunctionSourceCodeRequested()
accordingly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-11 04:05:26 +04:00
|
|
|
class LocatableFile;
|
2009-07-14 00:45:15 +04:00
|
|
|
class SourceLanguage;
|
2009-07-08 00:47:39 +04:00
|
|
|
class SourceLocation;
|
2009-06-20 21:20:49 +04:00
|
|
|
class StackFrame;
|
2009-06-26 03:51:09 +04:00
|
|
|
class Statement;
|
2012-12-16 19:59:12 +04:00
|
|
|
class SymbolInfo;
|
2009-09-21 08:39:40 +04:00
|
|
|
class Type;
|
2011-07-01 02:30:48 +04:00
|
|
|
class TypeLookupConstraints;
|
2009-09-21 08:39:40 +04:00
|
|
|
class ValueLocation;
|
2009-06-20 21:20:49 +04:00
|
|
|
|
|
|
|
|
2010-12-16 16:50:30 +03:00
|
|
|
class SpecificImageDebugInfo : public BReferenceable {
|
2009-06-20 21:20:49 +04:00
|
|
|
public:
|
2009-06-28 01:09:21 +04:00
|
|
|
virtual ~SpecificImageDebugInfo();
|
2009-06-20 21:20:49 +04:00
|
|
|
|
2009-06-26 17:12:06 +04:00
|
|
|
virtual status_t GetFunctions(
|
2013-05-01 06:42:35 +04:00
|
|
|
const BObjectList<SymbolInfo>& symbols,
|
2009-06-26 17:12:06 +04:00
|
|
|
BObjectList<FunctionDebugInfo>& functions)
|
|
|
|
= 0;
|
|
|
|
// returns references
|
2009-06-20 21:20:49 +04:00
|
|
|
|
2009-10-10 09:05:33 +04:00
|
|
|
virtual status_t GetType(GlobalTypeCache* cache,
|
2011-07-01 02:30:48 +04:00
|
|
|
const BString& name,
|
|
|
|
const TypeLookupConstraints& constraints,
|
|
|
|
Type*& _type) = 0;
|
* 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
2009-10-07 07:17:22 +04:00
|
|
|
// returns a reference
|
2015-01-02 01:33:32 +03:00
|
|
|
virtual bool HasType(const BString& name,
|
|
|
|
const TypeLookupConstraints& constraints)
|
|
|
|
const = 0;
|
|
|
|
|
2010-12-13 01:08:43 +03:00
|
|
|
virtual AddressSectionType GetAddressSectionType(target_addr_t address)
|
|
|
|
= 0;
|
* 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
2009-10-07 07:17:22 +04:00
|
|
|
|
2009-06-20 21:20:49 +04:00
|
|
|
virtual status_t CreateFrame(Image* image,
|
2009-07-19 03:52:16 +04:00
|
|
|
FunctionInstance* functionInstance,
|
2009-06-20 21:20:49 +04:00
|
|
|
CpuState* cpuState,
|
2012-12-26 09:17:09 +04:00
|
|
|
bool getFullFrameInfo,
|
2013-03-28 07:21:42 +04:00
|
|
|
ReturnValueInfoList* returnValueInfos,
|
2011-12-16 07:43:38 +04:00
|
|
|
StackFrame*& _Frame,
|
2009-06-20 21:20:49 +04:00
|
|
|
CpuState*& _previousCpuState) = 0;
|
|
|
|
// returns reference to previous frame
|
|
|
|
// and CPU state; returned CPU state
|
|
|
|
// can be NULL; can return B_UNSUPPORTED
|
2012-12-26 09:17:09 +04:00
|
|
|
// getFullFrameInfo: try to retrieve
|
|
|
|
// variables/parameters if true
|
|
|
|
// (and supported)
|
2009-06-26 03:51:09 +04:00
|
|
|
virtual status_t GetStatement(FunctionDebugInfo* function,
|
|
|
|
target_addr_t address,
|
|
|
|
Statement*& _statement) = 0;
|
|
|
|
// returns reference
|
* Finished the transformation of the SourceCode interface:
- Replaced StatementAtLine() by GetStatementLocationRange(), which doesn't
return a statement (i.e. also target addresses), but just a range in the
source code. This can also be implemented by FileSourceCode, which can
therefore be used for more than one instance of a function.
- Added GetStatementAtLocation() which kind of is also a replacement for
StatementAtLine(), but is optional and only provided by
DisassembledSourceCode.
- Added GetSourceFile(), which has to be provided when
GetStatementAtLocation() is not implemented.
- Kicked the statement stuff out of FileSourceCode. It only knows source
ranges, now.
* Team: Added GetStatementAtSourceLocation(), which is the real replacement for
SourceCode::StatementAtLine() in cases where a statement is actually
needed. It uses SourceCode::GetStatementAtLocation(), if available and
otherwise finds a function at the source location, and gets a statement for
one of its instances.
* TeamDebugInfo: Does now manage a source file -> functions map allowing to
look up functions at source file locations.
* DwarfImageDebugInfo:
- Switched the path in the source code hash table key for a LocatableFile,
which is cheaper to hash and to compare.
- Fixed bugs where the relocation delta was ignored.
- Replace a -1 in the SourceLocation column component by 0 to avoid
mismatches.
* SourceLocation: Changed component types from uint32 to int32. Otherwise -1 is
not representable.
Things mostly work as before starting the refactoring to support function
instances. All is not well yet, though. E.g. we don't merge the source code
information for common source files (like headers) provided by different
compilation units (or even images) yet. We need to do that, since the debug
info for a compilation unit only contains line number information for inline
functions (in headers) that are actually used.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31495 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-10 04:08:45 +04:00
|
|
|
virtual status_t GetStatementAtSourceLocation(
|
2009-07-08 00:47:39 +04:00
|
|
|
FunctionDebugInfo* function,
|
|
|
|
const SourceLocation& sourceLocation,
|
|
|
|
Statement*& _statement) = 0;
|
|
|
|
// returns reference
|
* Since disassembled code is actually function instance specific,
FunctionInstance does now also have a (DisassembledCode) source code
attribute. Function keeps its attribute, but it explicitly is a
FileSourceCode now.
* SourceCode:
- Removed GetStatementAtLocation(). Instead DisassembledCode has a
StatementAtLocation() now. As well as a StatementAtAddress() and
StatementAddressRange(). Rather cast to the subclass (in two instances)
instead of having those methods in the base class. In most cases we already
have the subclasses now, anyway.
- Added Lock()/Unlock(), which are implemented in FileSourceCode. The
statement ranges are no longer immutable, so we have to lock.
* TeamDebugModel:
- Revived GetBreakpointsInAddressRange().
- GetBreakpointsForSourceCode(): Optimized for DisassembledCode and fixed
in the FileSourceCode case. We need to compare with the functions' source
file instead of their source code, since they might not have the source
code set yet. Fixed two instances of the same problem in SourceView. Setting
breakpoints in functions that have no associated source code yet, works now.
* Team:
- GetStatementAtAddress(): Optimized by using the DisassembledCode, if
available.
- GetStatementAtSourceLocation(): If the supplied source code is
DisassembledCode, we have to get the statement from it directly, since
we can't get that information from the image debug info.
* TeamDebugInfo: Added LoadSourceCode() and DisassembleFunction(), the new way
to get FileSourceCode respectively DisassembledCode. SpecificTeamDebugInfo
has lost LoadSourceCode() and gained service methods AddSourceCodeInfo() and
ReadCode(). This avoids unnecessary code duplication in the subclasses.
Moreover it allows for joining source location info source files from
different images (and compilation units) -- interesting for inline functions
in headers.
* Adjusted LoadSourceCodeJob and TeamDebugger::FunctionSourceCodeRequested()
accordingly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-11 04:05:26 +04:00
|
|
|
|
2009-07-14 00:45:15 +04:00
|
|
|
virtual status_t GetSourceLanguage(FunctionDebugInfo* function,
|
|
|
|
SourceLanguage*& _language) = 0;
|
|
|
|
|
* Since disassembled code is actually function instance specific,
FunctionInstance does now also have a (DisassembledCode) source code
attribute. Function keeps its attribute, but it explicitly is a
FileSourceCode now.
* SourceCode:
- Removed GetStatementAtLocation(). Instead DisassembledCode has a
StatementAtLocation() now. As well as a StatementAtAddress() and
StatementAddressRange(). Rather cast to the subclass (in two instances)
instead of having those methods in the base class. In most cases we already
have the subclasses now, anyway.
- Added Lock()/Unlock(), which are implemented in FileSourceCode. The
statement ranges are no longer immutable, so we have to lock.
* TeamDebugModel:
- Revived GetBreakpointsInAddressRange().
- GetBreakpointsForSourceCode(): Optimized for DisassembledCode and fixed
in the FileSourceCode case. We need to compare with the functions' source
file instead of their source code, since they might not have the source
code set yet. Fixed two instances of the same problem in SourceView. Setting
breakpoints in functions that have no associated source code yet, works now.
* Team:
- GetStatementAtAddress(): Optimized by using the DisassembledCode, if
available.
- GetStatementAtSourceLocation(): If the supplied source code is
DisassembledCode, we have to get the statement from it directly, since
we can't get that information from the image debug info.
* TeamDebugInfo: Added LoadSourceCode() and DisassembleFunction(), the new way
to get FileSourceCode respectively DisassembledCode. SpecificTeamDebugInfo
has lost LoadSourceCode() and gained service methods AddSourceCodeInfo() and
ReadCode(). This avoids unnecessary code duplication in the subclasses.
Moreover it allows for joining source location info source files from
different images (and compilation units) -- interesting for inline functions
in headers.
* Adjusted LoadSourceCodeJob and TeamDebugger::FunctionSourceCodeRequested()
accordingly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31514 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-11 04:05:26 +04:00
|
|
|
virtual ssize_t ReadCode(target_addr_t address, void* buffer,
|
|
|
|
size_t size) = 0;
|
|
|
|
|
|
|
|
virtual status_t AddSourceCodeInfo(LocatableFile* file,
|
|
|
|
FileSourceCode* sourceCode) = 0;
|
2012-12-16 19:59:12 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static status_t GetFunctionsFromSymbols(
|
2013-05-01 06:42:35 +04:00
|
|
|
const BObjectList<SymbolInfo>& symbols,
|
2012-12-16 19:59:12 +04:00
|
|
|
BObjectList<FunctionDebugInfo>& functions,
|
|
|
|
DebuggerInterface* interface,
|
|
|
|
const ImageInfo& imageInfo,
|
|
|
|
SpecificImageDebugInfo* info);
|
|
|
|
|
2009-06-20 21:20:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-06-28 01:09:21 +04:00
|
|
|
#endif // SPECIFIC_IMAGE_DEBUG_INFO_H
|