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/SymbolResolver.cpp
12 #include "monitor/SymbolResolver.h"
13 #include "storage/RTree.h"
14 #include "monitor/ElfParser.h"
15 #include "monitor/Coordinator.h"
19 SymbolResolver::SymbolResolver() {
20 m_rtree
= new RTree();
23 SymbolResolver::~SymbolResolver() {
27 void SymbolResolver::parse(const std::string
&filename
, uint64_t offset
) {
28 class Processor
: public ElfParser::Processor
{
32 Storage::Mempool
*m_mempool
;
34 Processor(RTree
*rtree
, uint64_t offset
) : m_rtree(rtree
), m_offset(offset
),
35 m_mempool(Coordinator::instance()->mempool()) {}
36 virtual ~Processor() {}
38 virtual void process(const char *symbolName
, uint64_t symbolAddress
, uint64_t symbolSize
) {
39 symbolAddress
+= m_offset
;
41 b
.setRange(RTree::Range(symbolAddress
, symbolAddress
+ symbolSize
), 0);
43 char *name
= static_cast<char *>(m_mempool
->request(std::strlen(symbolName
)));
44 strcpy(name
, symbolName
);
45 m_rtree
->insert(b
, name
);
49 Processor
p(m_rtree
, offset
);
52 ep
.parse(filename
, &p
);
55 } // namespace Monitor