[haiku-commits] haiku: hrev45441 - in src/apps/debugger: model controllers debugger_interface

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 5 Apr 2013 15:15:06 +0200 (CEST)

hrev45441 adds 3 changesets to branch 'master'
old head: 57419ce54ff39ab87cb809f1101177ec26f5bd14
new head: adf25fc437a0898a87e060876e25a32dae1debeb
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=adf25fc+%5E57419ce

----------------------------------------------------------------------------

a5e54e1: Add model classes for representing area information.

6d1e057: Extend DebuggerInterface for area information retrieval.

adf25fc: Dump area information in reports.
  
  Implements part of #9510.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

----------------------------------------------------------------------------

8 files changed, 197 insertions(+), 10 deletions(-)
src/apps/debugger/Jamfile                        |  1 +
.../controllers/DebugReportGenerator.cpp         | 47 ++++++++++++--
.../debugger/controllers/DebugReportGenerator.h  | 11 +++-
src/apps/debugger/controllers/TeamDebugger.cpp   |  3 +-
.../debugger_interface/DebuggerInterface.cpp     | 23 ++++++-
.../debugger_interface/DebuggerInterface.h       |  4 +-
src/apps/debugger/model/AreaInfo.cpp             | 67 ++++++++++++++++++++
src/apps/debugger/model/AreaInfo.h               | 51 +++++++++++++++

############################################################################

Commit:      a5e54e1bcf9e589786ef3295f1d8a87a4d4a9bd4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a5e54e1
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Thu Apr  4 19:14:02 2013 UTC

Add model classes for representing area information.

----------------------------------------------------------------------------

diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile
index 053121c..3a84c23 100644
--- a/src/apps/debugger/Jamfile
+++ b/src/apps/debugger/Jamfile
@@ -139,6 +139,7 @@ Application Debugger :
        RetrieveMemoryBlockJob.cpp
 
        # model
+       AreaInfo.cpp
        Breakpoint.cpp
        DisassembledCode.cpp
        FileSourceCode.cpp
diff --git a/src/apps/debugger/model/AreaInfo.cpp 
b/src/apps/debugger/model/AreaInfo.cpp
new file mode 100644
index 0000000..ee1a856
--- /dev/null
+++ b/src/apps/debugger/model/AreaInfo.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include "AreaInfo.h"
+
+
+AreaInfo::AreaInfo()
+       :
+       fTeam(-1),
+       fArea(-1),
+       fName(),
+       fAddress(0),
+       fSize(0),
+       fRamSize(0),
+       fLock(0),
+       fProtection(0)
+{
+}
+
+
+AreaInfo::AreaInfo(const AreaInfo &other)
+       :
+       fTeam(other.fTeam),
+       fArea(other.fArea),
+       fName(other.fName),
+       fAddress(other.fAddress),
+       fSize(other.fSize),
+       fRamSize(other.fRamSize),
+       fLock(other.fLock),
+       fProtection(other.fProtection)
+{
+}
+
+
+AreaInfo::AreaInfo(team_id team, area_id area, const BString& name,
+       target_addr_t address, target_size_t size, target_size_t ramSize,
+       uint32 lock, uint32 protection)
+       :
+       fTeam(team),
+       fArea(area),
+       fName(name),
+       fAddress(address),
+       fSize(size),
+       fRamSize(ramSize),
+       fLock(lock),
+       fProtection(protection)
+{
+}
+
+
+void
+AreaInfo::SetTo(team_id team, area_id area, const BString& name,
+       target_addr_t address, target_size_t size, target_size_t ramSize,
+       uint32 lock, uint32 protection)
+{
+       fTeam = team;
+       fArea = area;
+       fName = name;
+       fAddress = address;
+       fSize = size;
+       fRamSize = ramSize;
+       fLock = lock;
+       fProtection = protection;
+}
diff --git a/src/apps/debugger/model/AreaInfo.h 
b/src/apps/debugger/model/AreaInfo.h
new file mode 100644
index 0000000..660673e
--- /dev/null
+++ b/src/apps/debugger/model/AreaInfo.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef AREA_INFO_H
+#define AREA_INFO_H
+
+#include <OS.h>
+#include <String.h>
+
+#include "Types.h"
+
+
+class AreaInfo {
+public:
+                                                               AreaInfo();
+                                                               AreaInfo(const 
AreaInfo& other);
+                                                               
AreaInfo(team_id team, area_id area,
+                                                                       const 
BString& name, target_addr_t address,
+                                                                       
target_size_t size, target_size_t ram_size,
+                                                                       uint32 
lock, uint32 protection);
+
+                       void                            SetTo(team_id team, 
area_id area,
+                                                                       const 
BString& name, target_addr_t address,
+                                                                       
target_size_t size, target_size_t ram_size,
+                                                                       uint32 
lock, uint32 protection);
+
+                       team_id                         TeamID() const  { 
return fTeam; }
+                       area_id                         AreaID() const  { 
return fArea; }
+                       const BString&          Name() const    { return fName; 
}
+
+                       target_addr_t           BaseAddress() const     { 
return fAddress; }
+                       target_size_t           Size() const            { 
return fSize; }
+                       target_size_t           RamSize() const         { 
return fRamSize; }
+                       uint32                          Lock() const            
{ return fLock; }
+                       uint32                          Protection() const      
{ return fProtection; }
+
+
+private:
+                       team_id                         fTeam;
+                       area_id                         fArea;
+                       BString                         fName;
+                       target_addr_t           fAddress;
+                       target_size_t           fSize;
+                       target_size_t           fRamSize;
+                       uint32                          fLock;
+                       uint32                          fProtection;
+};
+
+
+#endif // AREA_INFO_H

############################################################################

Commit:      6d1e057cac861b242bae4b26d48473b166a2f15b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6d1e057
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Fri Apr  5 12:50:41 2013 UTC

Extend DebuggerInterface for area information retrieval.

----------------------------------------------------------------------------

diff --git a/src/apps/debugger/debugger_interface/DebuggerInterface.cpp 
b/src/apps/debugger/debugger_interface/DebuggerInterface.cpp
index 585327d..0bcb36b 100644
--- a/src/apps/debugger/debugger_interface/DebuggerInterface.cpp
+++ b/src/apps/debugger/debugger_interface/DebuggerInterface.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@xxxxxx.
- * Copyright 2010-2012, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2010-2013, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 
@@ -23,6 +23,7 @@
 
 #include "ArchitectureX86.h"
 #include "ArchitectureX8664.h"
+#include "AreaInfo.h"
 #include "CpuState.h"
 #include "DebugEvent.h"
 #include "ImageInfo.h"
@@ -519,6 +520,26 @@ DebuggerInterface::GetImageInfos(BObjectList<ImageInfo>& 
infos)
 
 
 status_t
+DebuggerInterface::GetAreaInfos(BObjectList<AreaInfo>& infos)
+{
+       // get the team's areas
+       area_info areaInfo;
+       int32 cookie = 0;
+       while (get_next_area_info(fTeamID, &cookie, &areaInfo) == B_OK) {
+               AreaInfo* info = new(std::nothrow) AreaInfo(fTeamID, 
areaInfo.area,
+                       areaInfo.name, (addr_t)areaInfo.address, areaInfo.size,
+                       areaInfo.ram_size, areaInfo.lock, areaInfo.protection);
+               if (info == NULL || !infos.AddItem(info)) {
+                       delete info;
+                       return B_NO_MEMORY;
+               }
+       }
+
+       return B_OK;
+}
+
+
+status_t
 DebuggerInterface::GetSymbolInfos(team_id team, image_id image,
        BObjectList<SymbolInfo>& infos)
 {
diff --git a/src/apps/debugger/debugger_interface/DebuggerInterface.h 
b/src/apps/debugger/debugger_interface/DebuggerInterface.h
index bdf9b2c..3f8d2a0 100644
--- a/src/apps/debugger/debugger_interface/DebuggerInterface.h
+++ b/src/apps/debugger/debugger_interface/DebuggerInterface.h
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxx.
- * Copyright 2010-2012, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2010-2013, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 #ifndef DEBUGGER_INTERFACE_H
@@ -17,6 +17,7 @@
 class Architecture;
 class CpuState;
 class DebugEvent;
+class AreaInfo;
 class ImageInfo;
 class SymbolInfo;
 class ThreadInfo;
@@ -54,6 +55,7 @@ public:
 
        virtual status_t                        
GetThreadInfos(BObjectList<ThreadInfo>& infos);
        virtual status_t                        
GetImageInfos(BObjectList<ImageInfo>& infos);
+       virtual status_t                        
GetAreaInfos(BObjectList<AreaInfo>& infos);
        virtual status_t                        GetSymbolInfos(team_id team, 
image_id image,
                                                                        
BObjectList<SymbolInfo>& infos);
        virtual status_t                        GetSymbolInfo(team_id team, 
image_id image,

############################################################################

Revision:    hrev45441
Commit:      adf25fc437a0898a87e060876e25a32dae1debeb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=adf25fc
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Fri Apr  5 13:04:49 2013 UTC

Ticket:      https://dev.haiku-os.org/ticket/9510

Dump area information in reports.

Implements part of #9510.

----------------------------------------------------------------------------

diff --git a/src/apps/debugger/controllers/DebugReportGenerator.cpp 
b/src/apps/debugger/controllers/DebugReportGenerator.cpp
index e5aa62d..49c3799 100644
--- a/src/apps/debugger/controllers/DebugReportGenerator.cpp
+++ b/src/apps/debugger/controllers/DebugReportGenerator.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2012-2013, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 
@@ -17,7 +17,9 @@
 #include <StringForSize.h>
 
 #include "Architecture.h"
+#include "AreaInfo.h"
 #include "CpuState.h"
+#include "DebuggerInterface.h"
 #include "Image.h"
 #include "MessageCodes.h"
 #include "Register.h"
@@ -37,11 +39,12 @@
 
 
 DebugReportGenerator::DebugReportGenerator(::Team* team,
-       UserInterfaceListener* listener)
+       UserInterfaceListener* listener, DebuggerInterface* interface)
        :
        BLooper("DebugReportGenerator"),
        fTeam(team),
        fArchitecture(team->GetArchitecture()),
+       fDebuggerInterface(interface),
        fTeamDataSem(-1),
        fNodeManager(NULL),
        fListener(listener),
@@ -88,9 +91,11 @@ DebugReportGenerator::Init()
 
 
 DebugReportGenerator*
-DebugReportGenerator::Create(::Team* team, UserInterfaceListener* listener)
+DebugReportGenerator::Create(::Team* team, UserInterfaceListener* listener,
+       DebuggerInterface* interface)
 {
-       DebugReportGenerator* self = new DebugReportGenerator(team, listener);
+       DebugReportGenerator* self = new DebugReportGenerator(team, listener,
+               interface);
 
        try {
                self->Init();
@@ -120,6 +125,10 @@ DebugReportGenerator::_GenerateReport(const entry_ref& 
outputPath)
        if (result != B_OK)
                return result;
 
+       result = _DumpAreas(output);
+       if (result != B_OK)
+               return result;
+
        result = _DumpRunningThreads(output);
        if (result != B_OK)
                return result;
@@ -260,6 +269,36 @@ DebugReportGenerator::_DumpLoadedImages(BString& _output)
 
 
 status_t
+DebugReportGenerator::_DumpAreas(BString& _output)
+{
+       BObjectList<AreaInfo> areas(20, true);
+       status_t result = fDebuggerInterface->GetAreaInfos(areas);
+       if (result != B_OK)
+               return result;
+
+       _output << "\nAreas:\n";
+       BString data;
+       AreaInfo* info;
+       for (int32 i = 0; (info = areas.ItemAt(i)) != NULL; i++) {
+               try {
+                       data.SetToFormat("\t%s (%" B_PRId32 ") "
+                               "Base: %#08" B_PRIx64 ", Size: %" B_PRId64
+                               ", RAM Size: %" B_PRId64 ", Locking: %#04" 
B_PRIx32
+                               ", Protection: %#04" B_PRIx32 "\n", 
info->Name().String(),
+                               info->AreaID(), info->BaseAddress(), 
info->Size(),
+                               info->RamSize(), info->Lock(), 
info->Protection());
+
+                       _output << data;
+               } catch (...) {
+                       return B_NO_MEMORY;
+               }
+       }
+
+       return B_OK;
+}
+
+
+status_t
 DebugReportGenerator::_DumpRunningThreads(BString& _output)
 {
        AutoLocker< ::Team> locker(fTeam);
diff --git a/src/apps/debugger/controllers/DebugReportGenerator.h 
b/src/apps/debugger/controllers/DebugReportGenerator.h
index 5ff78b4..457bc9c 100644
--- a/src/apps/debugger/controllers/DebugReportGenerator.h
+++ b/src/apps/debugger/controllers/DebugReportGenerator.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2012-2013, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 #ifndef DEBUG_REPORT_GENERATOR_H
@@ -16,6 +16,7 @@
 class entry_ref;
 class Architecture;
 class BString;
+class DebuggerInterface;
 class StackFrame;
 class Team;
 class Thread;
@@ -30,13 +31,15 @@ class DebugReportGenerator : public BLooper, private 
Team::Listener,
        private TeamMemoryBlock::Listener, private ValueNodeContainer::Listener 
{
 public:
                                                                
DebugReportGenerator(::Team* team,
-                                                                       
UserInterfaceListener* listener);
+                                                                       
UserInterfaceListener* listener,
+                                                                       
DebuggerInterface* interface);
                                                                
~DebugReportGenerator();
 
                        status_t                        Init();
 
        static  DebugReportGenerator* Create(::Team* team,
-                                                                       
UserInterfaceListener* listener);
+                                                                       
UserInterfaceListener* listener,
+                                                                       
DebuggerInterface* interface);
 
        virtual void                            MessageReceived(BMessage* 
message);
 
@@ -56,6 +59,7 @@ private:
                        status_t                        _GenerateReport(const 
entry_ref& outputPath);
                        status_t                        
_GenerateReportHeader(BString& _output);
                        status_t                        
_DumpLoadedImages(BString& _output);
+                       status_t                        _DumpAreas(BString& 
_output);
                        status_t                        
_DumpRunningThreads(BString& _output);
                        status_t                        
_DumpDebuggedThreadInfo(BString& _output,
                                                                        
::Thread* thread);
@@ -70,6 +74,7 @@ private:
 private:
                        ::Team*                         fTeam;
                        Architecture*           fArchitecture;
+                       DebuggerInterface*      fDebuggerInterface;
                        sem_id                          fTeamDataSem;
                        ValueNodeManager*       fNodeManager;
                        UserInterfaceListener* fListener;
diff --git a/src/apps/debugger/controllers/TeamDebugger.cpp 
b/src/apps/debugger/controllers/TeamDebugger.cpp
index 634eba0..433e8ef 100644
--- a/src/apps/debugger/controllers/TeamDebugger.cpp
+++ b/src/apps/debugger/controllers/TeamDebugger.cpp
@@ -416,7 +416,8 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, bool 
stopInMain)
                return error;
 
        // create the debug report generator
-       fReportGenerator = new(std::nothrow) DebugReportGenerator(fTeam, this);
+       fReportGenerator = new(std::nothrow) DebugReportGenerator(fTeam, this,
+               fDebuggerInterface);
        if (fReportGenerator == NULL)
                return B_NO_MEMORY;
 


Other related posts:

  • » [haiku-commits] haiku: hrev45441 - in src/apps/debugger: model controllers debugger_interface - anevilyak