More debugger work.
Posix only right now.
This commit is contained in:
@@ -18,17 +18,22 @@ namespace xe {
|
||||
namespace dbg {
|
||||
|
||||
|
||||
class Debugger;
|
||||
|
||||
|
||||
class Client {
|
||||
public:
|
||||
Client();
|
||||
Client(Debugger* debugger);
|
||||
virtual ~Client();
|
||||
|
||||
virtual int Setup() = 0;
|
||||
|
||||
void OnMessage(const uint8_t* data, size_t length);
|
||||
void Write(uint8_t* buffer, size_t length);
|
||||
virtual void Write(uint8_t** buffers, size_t* lengths, size_t count) = 0;
|
||||
|
||||
protected:
|
||||
Debugger* debugger_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -22,20 +22,17 @@ namespace dbg {
|
||||
|
||||
class ContentSource {
|
||||
public:
|
||||
enum Type {
|
||||
kTypeIndexed,
|
||||
};
|
||||
|
||||
ContentSource(Type type);
|
||||
ContentSource(Debugger* debugger, uint32_t source_id);
|
||||
virtual ~ContentSource();
|
||||
|
||||
Type type();
|
||||
uint32_t source_id();
|
||||
|
||||
virtual int DispatchRequest(Client* client,
|
||||
const uint8_t* data, size_t length) = 0;
|
||||
virtual int Dispatch(Client* client, uint8_t type, uint32_t request_id,
|
||||
const uint8_t* data, size_t length) = 0;
|
||||
|
||||
protected:
|
||||
Type type_;
|
||||
Debugger* debugger_;
|
||||
uint32_t source_id_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace xe {
|
||||
@@ -30,20 +31,24 @@ public:
|
||||
Debugger(xe_pal_ref pal);
|
||||
virtual ~Debugger();
|
||||
|
||||
void RegisterContentSource(std::string& name, ContentSource* content_source);
|
||||
void RegisterContentSource(ContentSource* content_source);
|
||||
|
||||
int Startup();
|
||||
|
||||
void Broadcast(uint32_t source_id, const uint8_t* data, size_t length);
|
||||
|
||||
private:
|
||||
int DispatchRequest(Client* client, const char* source_name,
|
||||
const uint8_t* data, size_t length);
|
||||
void AddClient(Client* client);
|
||||
void RemoveClient(Client* client);
|
||||
int Dispatch(Client* client, const uint8_t* data, size_t length);
|
||||
|
||||
friend class Client;
|
||||
|
||||
private:
|
||||
xe_pal_ref pal_;
|
||||
auto_ptr<Listener> listener_;
|
||||
std::map<char*, ContentSource*> content_sources_;
|
||||
std::vector<Client*> clients_;
|
||||
std::map<uint32_t, ContentSource*> content_sources_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* Xenia : Xbox 360 Emulator Research Project *
|
||||
******************************************************************************
|
||||
* Copyright 2013 Ben Vanik. All rights reserved. *
|
||||
* Released under the BSD license - see LICENSE in the root for more details. *
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef XENIA_KERNEL_DBG_INDEXED_CONTENT_SOURCE_H_
|
||||
#define XENIA_KERNEL_DBG_INDEXED_CONTENT_SOURCE_H_
|
||||
|
||||
#include <xenia/common.h>
|
||||
#include <xenia/core.h>
|
||||
|
||||
#include <xenia/dbg/content_source.h>
|
||||
|
||||
|
||||
namespace xe {
|
||||
namespace dbg {
|
||||
|
||||
|
||||
class Client;
|
||||
|
||||
|
||||
class IndexedContentSource : public ContentSource {
|
||||
public:
|
||||
IndexedContentSource();
|
||||
virtual ~IndexedContentSource();
|
||||
|
||||
int DispatchRequest(Client* client, const uint8_t* data, size_t length);
|
||||
|
||||
protected:
|
||||
virtual int RequestIndex(Client* client, uint64_t req_id) = 0;
|
||||
virtual int RequestRange(Client* client, uint64_t req_id,
|
||||
uint64_t start_index, uint64_t end_index) = 0;
|
||||
virtual int RequestEntry(Client* client, uint64_t req_id, uint64_t index) = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace dbg
|
||||
} // namespace xe
|
||||
|
||||
|
||||
#endif // XENIA_KERNEL_DBG_INDEXED_CONTENT_SOURCE_H_
|
||||
Reference in New Issue
Block a user