mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-10-20 10:38:27 +02:00
Additional fixes following r862.
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@864 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
305061cac0
commit
6e91e4a8fb
@ -45,8 +45,8 @@
|
|||||||
|
|
||||||
namespace dwarf2reader {
|
namespace dwarf2reader {
|
||||||
|
|
||||||
CULineInfoHandler::CULineInfoHandler(vector<SourceFileInfo>* files,
|
CULineInfoHandler::CULineInfoHandler(std::vector<SourceFileInfo>* files,
|
||||||
vector<string>* dirs,
|
std::vector<std::string>* dirs,
|
||||||
LineMap* linemap):linemap_(linemap),
|
LineMap* linemap):linemap_(linemap),
|
||||||
files_(files),
|
files_(files),
|
||||||
dirs_(dirs) {
|
dirs_(dirs) {
|
||||||
@ -61,13 +61,13 @@ CULineInfoHandler::CULineInfoHandler(vector<SourceFileInfo>* files,
|
|||||||
files->push_back(s);
|
files->push_back(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CULineInfoHandler::DefineDir(const string& name, uint32 dir_num) {
|
void CULineInfoHandler::DefineDir(const std::string& name, uint32 dir_num) {
|
||||||
// These should never come out of order, actually
|
// These should never come out of order, actually
|
||||||
assert(dir_num == dirs_->size());
|
assert(dir_num == dirs_->size());
|
||||||
dirs_->push_back(name);
|
dirs_->push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CULineInfoHandler::DefineFile(const string& name,
|
void CULineInfoHandler::DefineFile(const std::string& name,
|
||||||
int32 file_num, uint32 dir_num,
|
int32 file_num, uint32 dir_num,
|
||||||
uint64 mod_time, uint64 length) {
|
uint64 mod_time, uint64 length) {
|
||||||
assert(dir_num >= 0);
|
assert(dir_num >= 0);
|
||||||
@ -75,7 +75,7 @@ void CULineInfoHandler::DefineFile(const string& name,
|
|||||||
|
|
||||||
// These should never come out of order, actually.
|
// These should never come out of order, actually.
|
||||||
if (file_num == (int32)files_->size() || file_num == -1) {
|
if (file_num == (int32)files_->size() || file_num == -1) {
|
||||||
string dir = dirs_->at(dir_num);
|
std::string dir = dirs_->at(dir_num);
|
||||||
|
|
||||||
SourceFileInfo s;
|
SourceFileInfo s;
|
||||||
s.lowpc = ULLONG_MAX;
|
s.lowpc = ULLONG_MAX;
|
||||||
@ -95,8 +95,10 @@ void CULineInfoHandler::DefineFile(const string& name,
|
|||||||
void CULineInfoHandler::AddLine(uint64 address, uint64 length, uint32 file_num,
|
void CULineInfoHandler::AddLine(uint64 address, uint64 length, uint32 file_num,
|
||||||
uint32 line_num, uint32 column_num) {
|
uint32 line_num, uint32 column_num) {
|
||||||
if (file_num < files_->size()) {
|
if (file_num < files_->size()) {
|
||||||
linemap_->insert(make_pair(address, make_pair(files_->at(file_num).name.c_str(),
|
linemap_->insert(
|
||||||
line_num)));
|
std::make_pair(address,
|
||||||
|
std::make_pair(files_->at(file_num).name.c_str(),
|
||||||
|
line_num)));
|
||||||
|
|
||||||
if(address < files_->at(file_num).lowpc) {
|
if(address < files_->at(file_num).lowpc) {
|
||||||
files_->at(file_num).lowpc = address;
|
files_->at(file_num).lowpc = address;
|
||||||
@ -130,7 +132,8 @@ bool CUFunctionInfoHandler::StartDIE(uint64 offset, enum DwarfTag tag,
|
|||||||
current_function_info_->name = "";
|
current_function_info_->name = "";
|
||||||
current_function_info_->line = 0;
|
current_function_info_->line = 0;
|
||||||
current_function_info_->file = "";
|
current_function_info_->file = "";
|
||||||
offset_to_funcinfo_->insert(make_pair(offset, current_function_info_));
|
offset_to_funcinfo_->insert(std::make_pair(offset,
|
||||||
|
current_function_info_));
|
||||||
};
|
};
|
||||||
// FALLTHROUGH
|
// FALLTHROUGH
|
||||||
case DW_TAG_compile_unit:
|
case DW_TAG_compile_unit:
|
||||||
@ -146,7 +149,7 @@ bool CUFunctionInfoHandler::StartDIE(uint64 offset, enum DwarfTag tag,
|
|||||||
void CUFunctionInfoHandler::ProcessAttributeString(uint64 offset,
|
void CUFunctionInfoHandler::ProcessAttributeString(uint64 offset,
|
||||||
enum DwarfAttribute attr,
|
enum DwarfAttribute attr,
|
||||||
enum DwarfForm form,
|
enum DwarfForm form,
|
||||||
const string &data) {
|
const std::string &data) {
|
||||||
if (current_function_info_) {
|
if (current_function_info_) {
|
||||||
if (attr == DW_AT_name)
|
if (attr == DW_AT_name)
|
||||||
current_function_info_->name = data;
|
current_function_info_->name = data;
|
||||||
@ -164,9 +167,9 @@ void CUFunctionInfoHandler::ProcessAttributeUnsigned(uint64 offset,
|
|||||||
assert(iter != sections_.end());
|
assert(iter != sections_.end());
|
||||||
|
|
||||||
// this should be a scoped_ptr but we dont' use boost :-(
|
// this should be a scoped_ptr but we dont' use boost :-(
|
||||||
auto_ptr<LineInfo> lireader(new LineInfo(iter->second.first + data,
|
std::auto_ptr<LineInfo> lireader(new LineInfo(iter->second.first + data,
|
||||||
iter->second.second - data,
|
iter->second.second - data,
|
||||||
reader_, linehandler_));
|
reader_, linehandler_));
|
||||||
lireader->Start();
|
lireader->Start();
|
||||||
} else if (current_function_info_) {
|
} else if (current_function_info_) {
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
@ -219,8 +222,8 @@ void CUFunctionInfoHandler::ProcessAttributeReference(uint64 offset,
|
|||||||
|
|
||||||
void CUFunctionInfoHandler::EndDIE(uint64 offset) {
|
void CUFunctionInfoHandler::EndDIE(uint64 offset) {
|
||||||
if (current_function_info_ && current_function_info_->lowpc)
|
if (current_function_info_ && current_function_info_->lowpc)
|
||||||
address_to_funcinfo_->insert(make_pair(current_function_info_->lowpc,
|
address_to_funcinfo_->insert(std::make_pair(current_function_info_->lowpc,
|
||||||
current_function_info_));
|
current_function_info_));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dwarf2reader
|
} // namespace dwarf2reader
|
||||||
|
@ -46,11 +46,11 @@ namespace dwarf2reader {
|
|||||||
|
|
||||||
struct FunctionInfo {
|
struct FunctionInfo {
|
||||||
// Name of the function
|
// Name of the function
|
||||||
string name;
|
std::string name;
|
||||||
// Mangled name of the function
|
// Mangled name of the function
|
||||||
string mangled_name;
|
std::string mangled_name;
|
||||||
// File containing this function
|
// File containing this function
|
||||||
string file;
|
std::string file;
|
||||||
// Line number for start of function.
|
// Line number for start of function.
|
||||||
uint32 line;
|
uint32 line;
|
||||||
// Beginning address for this function
|
// Beginning address for this function
|
||||||
@ -61,13 +61,13 @@ struct FunctionInfo {
|
|||||||
|
|
||||||
struct SourceFileInfo {
|
struct SourceFileInfo {
|
||||||
// Name of the source file name
|
// Name of the source file name
|
||||||
string name;
|
std::string name;
|
||||||
// Low address of source file name
|
// Low address of source file name
|
||||||
uint64 lowpc;
|
uint64 lowpc;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef map<uint64, FunctionInfo*> FunctionMap;
|
typedef std::map<uint64, FunctionInfo*> FunctionMap;
|
||||||
typedef map<uint64, pair<string, uint32> > LineMap;
|
typedef std::map<uint64, std::pair<std::string, uint32> > LineMap;
|
||||||
|
|
||||||
// This class is a basic line info handler that fills in the dirs,
|
// This class is a basic line info handler that fills in the dirs,
|
||||||
// file, and linemap passed into it with the data produced from the
|
// file, and linemap passed into it with the data produced from the
|
||||||
@ -76,18 +76,18 @@ class CULineInfoHandler: public LineInfoHandler {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//
|
//
|
||||||
CULineInfoHandler(vector<SourceFileInfo>* files,
|
CULineInfoHandler(std::vector<SourceFileInfo>* files,
|
||||||
vector<string>* dirs,
|
std::vector<std::string>* dirs,
|
||||||
LineMap* linemap);
|
LineMap* linemap);
|
||||||
virtual ~CULineInfoHandler() { }
|
virtual ~CULineInfoHandler() { }
|
||||||
|
|
||||||
// Called when we define a directory. We just place NAME into dirs_
|
// Called when we define a directory. We just place NAME into dirs_
|
||||||
// at position DIR_NUM.
|
// at position DIR_NUM.
|
||||||
virtual void DefineDir(const string& name, uint32 dir_num);
|
virtual void DefineDir(const std::string& name, uint32 dir_num);
|
||||||
|
|
||||||
// Called when we define a filename. We just place
|
// Called when we define a filename. We just place
|
||||||
// concat(dirs_[DIR_NUM], NAME) into files_ at position FILE_NUM.
|
// concat(dirs_[DIR_NUM], NAME) into files_ at position FILE_NUM.
|
||||||
virtual void DefineFile(const string& name, int32 file_num,
|
virtual void DefineFile(const std::string& name, int32 file_num,
|
||||||
uint32 dir_num, uint64 mod_time, uint64 length);
|
uint32 dir_num, uint64 mod_time, uint64 length);
|
||||||
|
|
||||||
|
|
||||||
@ -102,14 +102,14 @@ class CULineInfoHandler: public LineInfoHandler {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
LineMap* linemap_;
|
LineMap* linemap_;
|
||||||
vector<SourceFileInfo>* files_;
|
std::vector<SourceFileInfo>* files_;
|
||||||
vector<string>* dirs_;
|
std::vector<std::string>* dirs_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CUFunctionInfoHandler: public Dwarf2Handler {
|
class CUFunctionInfoHandler: public Dwarf2Handler {
|
||||||
public:
|
public:
|
||||||
CUFunctionInfoHandler(vector<SourceFileInfo>* files,
|
CUFunctionInfoHandler(std::vector<SourceFileInfo>* files,
|
||||||
vector<string>* dirs,
|
std::vector<std::string>* dirs,
|
||||||
LineMap* linemap,
|
LineMap* linemap,
|
||||||
FunctionMap* offset_to_funcinfo,
|
FunctionMap* offset_to_funcinfo,
|
||||||
FunctionMap* address_to_funcinfo,
|
FunctionMap* address_to_funcinfo,
|
||||||
@ -163,7 +163,7 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
|
|||||||
virtual void ProcessAttributeString(uint64 offset,
|
virtual void ProcessAttributeString(uint64 offset,
|
||||||
enum DwarfAttribute attr,
|
enum DwarfAttribute attr,
|
||||||
enum DwarfForm form,
|
enum DwarfForm form,
|
||||||
const string& data);
|
const std::string& data);
|
||||||
|
|
||||||
// Called when finished processing the DIE at OFFSET.
|
// Called when finished processing the DIE at OFFSET.
|
||||||
// Because DWARF2/3 specifies a tree of DIEs, you may get starts
|
// Because DWARF2/3 specifies a tree of DIEs, you may get starts
|
||||||
@ -172,8 +172,8 @@ class CUFunctionInfoHandler: public Dwarf2Handler {
|
|||||||
virtual void EndDIE(uint64 offset);
|
virtual void EndDIE(uint64 offset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
vector<SourceFileInfo>* files_;
|
std::vector<SourceFileInfo>* files_;
|
||||||
vector<string>* dirs_;
|
std::vector<std::string>* dirs_;
|
||||||
LineMap* linemap_;
|
LineMap* linemap_;
|
||||||
FunctionMap* offset_to_funcinfo_;
|
FunctionMap* offset_to_funcinfo_;
|
||||||
FunctionMap* address_to_funcinfo_;
|
FunctionMap* address_to_funcinfo_;
|
||||||
|
Loading…
Reference in New Issue
Block a user