Resolve TODO.

- Added GetSystemInfo() to DebuggerInterface. Use that from
  DebugReportGenerator instead of calling get_system_info()/utsname()
  directly since otherwise we'd get the information for the wrong system
  in the eventual case when we have remote debugging support.
This commit is contained in:
Rene Gollent 2013-04-12 21:39:12 -04:00
parent 5a1b505fa1
commit 2298b5fc23
4 changed files with 32 additions and 11 deletions

View File

@ -154,6 +154,7 @@ Application Debugger :
StackTrace.cpp
Statement.cpp
SymbolInfo.cpp
SystemInfo.cpp
Team.cpp
TeamMemory.cpp
TeamMemoryBlock.cpp

View File

@ -6,8 +6,6 @@
#include "DebugReportGenerator.h"
#include <sys/utsname.h>
#include <cpu_type.h>
#include <AutoLocker.h>
@ -27,6 +25,7 @@
#include "StackFrame.h"
#include "StackTrace.h"
#include "StringUtils.h"
#include "SystemInfo.h"
#include "Team.h"
#include "Thread.h"
#include "Type.h"
@ -212,11 +211,10 @@ DebugReportGenerator::_GenerateReportHeader(BString& _output)
fTeam->Name(), fTeam->ID());
_output << data;
// TODO: this information should probably be requested via the debugger
// interface, since e.g. in the case of a remote team, the report should
// include data about the target, not the debugging host
system_info info;
if (get_system_info(&info) == B_OK) {
SystemInfo sysInfo;
if (fDebuggerInterface->GetSystemInfo(sysInfo) == B_OK) {
const system_info &info = sysInfo.GetSystemInfo();
data.SetToFormat("CPU(s): %" B_PRId32 "x %s %s\n",
info.cpu_count, get_cpu_vendor_string(info.cpu_type),
get_cpu_model_string(&info));
@ -230,11 +228,12 @@ DebugReportGenerator::_GenerateReportHeader(BString& _output)
BPrivate::string_for_size((int64)info.used_pages * B_PAGE_SIZE,
usedSize, sizeof(usedSize)));
_output << data;
const utsname& name = sysInfo.GetSystemName();
data.SetToFormat("Haiku revision: %s (%s)\n", name.version,
name.machine);
_output << data;
}
utsname name;
uname(&name);
data.SetToFormat("Haiku revision: %s (%s)\n", name.version, name.machine);
_output << data;
return B_OK;
}

View File

@ -29,6 +29,7 @@
#include "ImageInfo.h"
#include "SemaphoreInfo.h"
#include "SymbolInfo.h"
#include "SystemInfo.h"
#include "ThreadInfo.h"
@ -464,6 +465,24 @@ DebuggerInterface::UninstallWatchpoint(target_addr_t address)
}
status_t
DebuggerInterface::GetSystemInfo(SystemInfo& info)
{
system_info sysInfo;
status_t result = get_system_info(&sysInfo);
if (result != B_OK)
return result;
utsname name;
result = uname(&name);
if (result != B_OK)
return result;
info.SetTo(fTeamID, sysInfo, name);
return B_OK;
}
status_t
DebuggerInterface::GetThreadInfos(BObjectList<ThreadInfo>& infos)
{

View File

@ -21,6 +21,7 @@ class AreaInfo;
class ImageInfo;
class SemaphoreInfo;
class SymbolInfo;
class SystemInfo;
class ThreadInfo;
namespace BPrivate {
@ -54,6 +55,7 @@ public:
uint32 type, int32 length);
virtual status_t UninstallWatchpoint(target_addr_t address);
virtual status_t GetSystemInfo(SystemInfo& info);
virtual status_t GetThreadInfos(BObjectList<ThreadInfo>& infos);
virtual status_t GetImageInfos(BObjectList<ImageInfo>& infos);
virtual status_t GetAreaInfos(BObjectList<AreaInfo>& infos);