代码拉取完成,页面将自动刷新
// Copyright 2011 Google Inc. All Rights Reserved.
// Author: dehao@google.com (Dehao Chen)
// Class to build a map from instruction address to its information.
#ifndef AUTOFDO_INSTRUCTION_MAP_H_
#define AUTOFDO_INSTRUCTION_MAP_H_
#include <cstdint>
#include <map>
#include <string>
#include <utility>
#include "base/integral_types.h"
#include "base/logging.h"
#include "base/macros.h"
#include "symbol_map.h"
namespace devtools_crosstool_autofdo {
class SampleReader;
class Addr2line;
// InstructionMap stores all the disassembled instructions in
// the binary, and maps it to its information.
class InstructionMap {
public:
// Arguments:
// addr2line: addr2line class, used to get the source stack.
// symbol: the symbol map. This object is not const because
// we will update the file name of each symbol
// according to the debug info of each instruction.
InstructionMap(Addr2line *addr2line,
SymbolMap *symbol)
: symbol_map_(symbol), addr2line_(addr2line) {
}
// Deletes all the InstInfo, which was allocated in BuildInstMap.
~InstructionMap();
// Returns the size of the instruction map.
uint64_t size() const { return inst_map_.size(); }
// Builds instruction map for a function.
void BuildPerFunctionInstructionMap(const std::string &name,
uint64_t start_addr, uint64_t end_addr);
// Contains information about each instruction.
struct InstInfo {
const SourceInfo &source(int i) const {
DCHECK(i >= 0 && source_stack.size() > i);
return source_stack[i];
}
SourceStack source_stack;
};
typedef std::map<uint64_t, InstInfo *> InstMap;
const InstMap &inst_map() const {
return inst_map_;
}
private:
// A map from instruction address to its information.
InstMap inst_map_;
// A map from symbol name to symbol data.
SymbolMap *symbol_map_;
// Addr2line driver which is used to derive source stack.
Addr2line *addr2line_;
DISALLOW_COPY_AND_ASSIGN(InstructionMap);
};
} // namespace devtools_crosstool_autofdo
#endif // AUTOFDO_INSTRUCTION_MAP_H_
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。