1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file src/monitor/InformerMarshal.cpp
10 #include "monitor/InformerMarshal.h"
11 #include "util/MessageSystem.h"
12 #include "informer/PacketFormat.h"
13 #include "monitor/MarshalList.h"
14 #include "monitor/Coordinator.h"
15 #include "config/GlobalVault.h"
16 #include "util/StringTo.h"
20 InformerMarshal::InformerMarshal() {
24 InformerMarshal::~InformerMarshal() {
28 Comm::Packet
*InformerMarshal::marshal(Comm::Packet
*packet
) {
29 Informer::PacketType type
= static_cast<Informer::PacketType
>(packet
->data()[0]);
31 Message(Debug
, "type: " << type
);
34 case Informer::ModuleLoaded
: {
38 case Informer::FileLoaded
: {
43 case Informer::NewProcess
: {
44 Message(Fatal
, "Informer::NewProcess handling NYI.");
47 case Informer::NewThread
: {
48 Message(Fatal
, "Informer::NewThread handling NYI.");
51 case Informer::ThreadExiting
: {
52 Message(Fatal
, "Informer::ThreadExiting handling NYI.");
55 case Informer::ProcessExiting
: {
56 Message(Fatal
, "Informer::ProcessExiting handling NYI.");
64 void InformerMarshal::moduleLoaded(Comm::Packet
*packet
) {
65 /* NOTE: the +3 is +1 for the type byte, +2 for the module ID#. (unused in the monitor) */
66 std::string name
= reinterpret_cast<char *>(packet
->data() + 3);
67 MarshalList
*list
= Coordinator::instance()->marshalList();
69 Message(Debug
, "Marshal name: \"" << name
<< "\"");
71 list
->loadMarshal(name
);
74 void InformerMarshal::fileLoaded(Comm::Packet
*packet
) {
75 uint64_t baseAddress
= *reinterpret_cast<uint64_t *>(packet
->data() + 1);
76 uint64_t fileOffset
= *reinterpret_cast<uint64_t *>(packet
->data() + 9);
77 std::string name
= reinterpret_cast<char *>(packet
->data() + 17);
79 Coordinator::instance()->resolver()->parse(name
, baseAddress
);
82 } // namespace Monitor