projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add some missing test stuff; split server discovery off into ServerFinder.
[dcpomatic.git]
/
src
/
lib
/
stack.cpp
diff --git
a/src/lib/stack.cpp
b/src/lib/stack.cpp
index 24668dfe7a22c158e693225ba0aada3dc0de8e2f..a8183d3444c7c426f47fcbcc3d60b70548039f47 100644
(file)
--- a/
src/lib/stack.cpp
+++ b/
src/lib/stack.cpp
@@
-79,6
+79,7
@@
namespace
struct find_data
{
std::string func;
struct find_data
{
std::string func;
+ unsigned int line;
asymbol **symbol_table;
bfd_vma counter;
};
asymbol **symbol_table;
bfd_vma counter;
};
@@
-127,7
+128,7
@@
namespace
bfd_close(abfd_);
}
bfd_close(abfd_);
}
- std::
string get_function_nam
e(DWORD offset)
+ std::
pair<std::string, unsigned int> get_function_name_and_lin
e(DWORD offset)
{
find_data data;
data.symbol_table = symbol_table_;
{
find_data data;
data.symbol_table = symbol_table_;
@@
-135,7
+136,7
@@
namespace
bfd_map_over_sections(abfd_, &find_function_name_in_section, &data);
bfd_map_over_sections(abfd_, &find_function_name_in_section, &data);
- return
data.func
;
+ return
std::make_pair(data.func, data.line)
;
}
private:
}
private:
@@
-156,8
+157,10
@@
namespace
const char *file = 0;
unsigned line = 0;
const char *file = 0;
unsigned line = 0;
- if (bfd_find_nearest_line(abfd, sec, data.symbol_table, data.counter - vma, &file, &func, &line) && func)
+ if (bfd_find_nearest_line(abfd, sec, data.symbol_table, data.counter - vma, &file, &func, &line) && func)
{
data.func = demangle(func);
data.func = demangle(func);
+ data.line = line;
+ }
}
private:
}
private:
@@
-327,9
+330,9
@@
namespace
module_name = module_name_raw;
#if defined(__MINGW32__)
module_name = module_name_raw;
#if defined(__MINGW32__)
- std::
string func = bfdc.get_function_nam
e(frame.AddrPC.Offset);
+ std::
pair<std::string, unsigned int> func_and_line = bfdc.get_function_name_and_lin
e(frame.AddrPC.Offset);
- if (func.empty())
+ if (func
_and_line.first
.empty())
{
#if defined(_WIN64)
DWORD64 dummy = 0;
{
#if defined(_WIN64)
DWORD64 dummy = 0;
@@
-337,7
+340,7
@@
namespace
DWORD dummy = 0;
#endif
BOOL got_symbol = SymGetSymFromAddr(process, frame.AddrPC.Offset, &dummy, symbol);
DWORD dummy = 0;
#endif
BOOL got_symbol = SymGetSymFromAddr(process, frame.AddrPC.Offset, &dummy, symbol);
- func = got_symbol ? symbol->Name : unknown_function;
+ func
_and_line.first
= got_symbol ? symbol->Name : unknown_function;
}
#else
DWORD dummy = 0;
}
#else
DWORD dummy = 0;
@@
-345,7
+348,7
@@
namespace
std::string func = got_symbol ? symbol->Name : unknown_function;
#endif
std::string func = got_symbol ? symbol->Name : unknown_function;
#endif
- dbg::stack_frame f(reinterpret_cast<const void *>(frame.AddrPC.Offset), func, module_name);
+ dbg::stack_frame f(reinterpret_cast<const void *>(frame.AddrPC.Offset), func
_and_line.first, func_and_line.second
, module_name);
frames.push_back(f);
}
}
frames.push_back(f);
}
}
@@
-421,16
+424,17
@@
namespace
namespace dbg
{
namespace dbg
{
- stack_frame::stack_frame(const void *instruction, const std::string &function, const std::string &module) :
+ stack_frame::stack_frame(const void *instruction, const std::string &function,
unsigned int line,
const std::string &module) :
instruction(instruction),
function(function),
instruction(instruction),
function(function),
+ line(line),
module(module)
{
}
std::ostream &operator<< (std::ostream &out, const stack_frame &frame)
{
module(module)
{
}
std::ostream &operator<< (std::ostream &out, const stack_frame &frame)
{
- return out << frame.instruction << ": " << frame.function << " in " << frame.module;
+ return out << frame.instruction << ": " << frame.function << "
:" << frame.line << "
in " << frame.module;
}
stack::stack(depth_type limit)
}
stack::stack(depth_type limit)