Add simple report header.

Minor cleanups.
This commit is contained in:
Rene Gollent
2012-11-18 13:10:30 -05:00
parent 5e520ef399
commit 8e0e0918b6
2 changed files with 17 additions and 21 deletions
@@ -21,12 +21,11 @@
#include "UiUtils.h" #include "UiUtils.h"
DebugReportGenerator::DebugReportGenerator(::Team* team, DebugReportGenerator::DebugReportGenerator(::Team* team)
Architecture* architecture)
: :
BReferenceable(), BReferenceable(),
fTeam(team), fTeam(team),
fArchitecture(architecture) fArchitecture(team->GetArchitecture())
{ {
fArchitecture->AcquireReference(); fArchitecture->AcquireReference();
} }
@@ -38,19 +37,21 @@ DebugReportGenerator::~DebugReportGenerator()
} }
void status_t
DebugReportGenerator::Init() DebugReportGenerator::Init()
{ {
// TODO: anything needed here?
return B_OK;
} }
DebugReportGenerator* DebugReportGenerator*
DebugReportGenerator::Create(::Team* team, Architecture* architecture) DebugReportGenerator::Create(::Team* team)
{ {
DebugReportGenerator* self = new DebugReportGenerator(team, architecture); DebugReportGenerator* self = new DebugReportGenerator(team);
try { try {
self->_Init(); self->Init();
} catch (...) { } catch (...) {
delete self; delete self;
throw; throw;
@@ -89,16 +90,15 @@ DebugReportGenerator::GenerateReport(const entry_ref& outputPath)
} }
void
DebugReportGenerator::_Init()
{
}
status_t status_t
DebugReportGenerator::_GenerateReportHeader(BString& _output) DebugReportGenerator::_GenerateReportHeader(BString& _output)
{ {
AutoLocker<Team> locker(fTeam);
BString data;
data.SetToFormat("Debug information for team %s (%" B_PRId32 "):\n\n");
_output << data;
return B_OK; return B_OK;
} }
@@ -18,20 +18,16 @@ class Thread;
class DebugReportGenerator : public BReferenceable class DebugReportGenerator : public BReferenceable
{ {
public: public:
DebugReportGenerator(::Team* team, DebugReportGenerator(::Team* team);
Architecture* architecture);
~DebugReportGenerator(); ~DebugReportGenerator();
void Init(); status_t Init();
static DebugReportGenerator* Create(::Team* team, static DebugReportGenerator* Create(::Team* team);
Architecture* architecture);
status_t GenerateReport(const entry_ref& outputPath); status_t GenerateReport(const entry_ref& outputPath);
private: private:
void _Init();
status_t _GenerateReportHeader(BString& output); status_t _GenerateReportHeader(BString& output);
status_t _DumpLoadedImages(BString& output); status_t _DumpLoadedImages(BString& output);
status_t _DumpRunningThreads(BString& output); status_t _DumpRunningThreads(BString& output);