2009-06-20 21:20:49 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
2010-12-13 01:08:43 +03:00
|
|
|
* Copyright 2010, Rene Gollent, rene@gollent.com.
|
2009-06-20 21:20:49 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef IMAGE_DEBUG_INFO_H
|
|
|
|
#define IMAGE_DEBUG_INFO_H
|
|
|
|
|
* 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
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
#include <ObjectList.h>
|
|
|
|
#include <Referenceable.h>
|
|
|
|
|
2010-12-13 01:08:43 +03:00
|
|
|
#include "AddressSectionTypes.h"
|
2009-06-20 21:20:49 +04:00
|
|
|
#include "ImageInfo.h"
|
2009-06-30 02:38:15 +04:00
|
|
|
#include "Types.h"
|
2009-06-20 21:20:49 +04:00
|
|
|
|
|
|
|
|
|
|
|
class Architecture;
|
|
|
|
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-08 00:47:39 +04:00
|
|
|
class FunctionInstance;
|
2009-10-10 09:05:33 +04:00
|
|
|
class GlobalTypeCache;
|
* 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-06-28 01:09:21 +04:00
|
|
|
class SpecificImageDebugInfo;
|
* 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 Type;
|
2009-06-20 21:20:49 +04:00
|
|
|
|
|
|
|
|
|
|
|
class ImageDebugInfo : public Referenceable {
|
|
|
|
public:
|
2009-06-28 06:10:43 +04:00
|
|
|
ImageDebugInfo(const ImageInfo& imageInfo);
|
2009-06-20 21:20:49 +04:00
|
|
|
~ImageDebugInfo();
|
|
|
|
|
2009-07-19 03:52:16 +04:00
|
|
|
const ImageInfo& GetImageInfo() const { return fImageInfo; }
|
|
|
|
|
2009-06-28 01:09:21 +04:00
|
|
|
bool AddSpecificInfo(SpecificImageDebugInfo* info);
|
|
|
|
status_t FinishInit();
|
2009-06-20 21:20:49 +04:00
|
|
|
|
2009-10-10 09:05:33 +04:00
|
|
|
status_t GetType(GlobalTypeCache* cache,
|
* 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
|
|
|
const BString& name, Type*& _type);
|
|
|
|
// returns a reference
|
2010-12-13 01:08:43 +03:00
|
|
|
AddressSectionType GetAddressSectionType(target_addr_t address)
|
|
|
|
const;
|
* 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
|
|
|
int32 CountFunctions() const;
|
2009-07-08 00:47:39 +04:00
|
|
|
FunctionInstance* FunctionAt(int32 index) const;
|
|
|
|
FunctionInstance* FunctionAtAddress(target_addr_t address) const;
|
2009-07-24 06:35:30 +04:00
|
|
|
FunctionInstance* FunctionByName(const char* name) const;
|
2009-06-20 21:20:49 +04:00
|
|
|
|
* 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
|
|
|
status_t AddSourceCodeInfo(LocatableFile* file,
|
|
|
|
FileSourceCode* sourceCode) const;
|
|
|
|
|
2009-06-20 21:20:49 +04:00
|
|
|
private:
|
2009-06-28 01:09:21 +04:00
|
|
|
typedef BObjectList<SpecificImageDebugInfo> SpecificInfoList;
|
2009-07-08 00:47:39 +04:00
|
|
|
typedef BObjectList<FunctionInstance> FunctionList;
|
2009-06-26 17:12:06 +04:00
|
|
|
|
|
|
|
private:
|
2009-07-08 00:47:39 +04:00
|
|
|
static int _CompareFunctions(const FunctionInstance* a,
|
|
|
|
const FunctionInstance* b);
|
2009-06-26 17:12:06 +04:00
|
|
|
static int _CompareAddressFunction(
|
|
|
|
const target_addr_t* address,
|
2009-07-08 00:47:39 +04:00
|
|
|
const FunctionInstance* function);
|
2009-06-20 21:20:49 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
ImageInfo fImageInfo;
|
2009-06-28 01:09:21 +04:00
|
|
|
SpecificInfoList fSpecificInfos;
|
2009-06-26 17:12:06 +04:00
|
|
|
FunctionList fFunctions;
|
2009-06-20 21:20:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // IMAGE_DEBUG_INFO_H
|