]>
git.siccegge.de Git - frida/frida.git/blob - src/core/Comment.cxx
e864ef673cb71abc182a0b51cbc1d2aa8528a667
2 #include "Function.hxx"
3 #include "InformationManager.hxx"
4 #include "events/ChangeCommentEvent.hxx"
6 Comment::Comment(uint64_t address
, InformationManager
* manager
)
11 Comment::Comment(uint64_t address
, Function
* location
, InformationManager
* manager
)
16 void Comment::setText(const std::string
& text
) {
17 ChangeCommentEvent
event(address
, location
, this);
19 manager
->dispatch(&event
);
22 uint64_t Comment::getAddress() {
26 Function
* Comment::getLocation() {
30 void Comment::serialize(QXmlStreamWriter
& stream
) {
31 stream
.writeStartElement("comment");
33 stream
.writeTextElement("address", QString::number(address
, 16));
34 stream
.writeTextElement("text", text
.c_str());
36 stream
.writeEndElement(); // "comment"
39 Comment
* Comment::deserialize(QXmlStreamReader
& stream
, InformationManager
* manager
, Function
* function
) {
40 Q_ASSERT(stream
.name() == "comment");
46 while (QXmlStreamReader::NoToken
!= stream
.readNext()) {
47 while (QXmlStreamReader::Characters
== stream
.tokenType() &&
48 stream
.isWhitespace())
50 if (QXmlStreamReader::EndElement
== stream
.tokenType())
53 if(QXmlStreamReader::StartElement
!= stream
.tokenType())
56 if (stream
.name() == "text") {
58 if (QXmlStreamReader::Characters
!= stream
.tokenType())
61 text
= stream
.text().toString();
64 if(QXmlStreamReader::EndElement
!= stream
.tokenType())
67 if (stream
.name() == "address") {
69 if (QXmlStreamReader::Characters
!= stream
.tokenType())
72 address
= stream
.text().toULongLong(NULL
, 16);
75 if(QXmlStreamReader::EndElement
!= stream
.tokenType())
80 if (address
== 0 or text
== "")
84 comment
= manager
->newLocalComment(address
, function
);
86 comment
= manager
->newGlobalComment(address
);
88 comment
->text
= text
.toStdString();
90 assert(stream
.name() == "comment");
92 manager
->finishComment(comment
);