Error when debugging c++
When debugging c++, sometimes the context do not show up. (when using asm-demangle option) I found "examine_data" use this line:
v = out.split(":")[1].strip()
in my case, out can take different values:
0x804fd00 std::cin@@GLIBCXX_3.4+128: 0xf7faae20 0xffffd134: 0xf7e4e840 0xf7e4e840 <main_arena>: 0x00000000 0xffffd138: 0x08050090
the first one will fail. currently i use:
v = out.split(":")[-1].strip()
Same problem in "context_code" input can be:
0x804a0c0 <dispatch_command(std::string&, std::vector<std::string, std::allocatorstd::string >&)+1205>: sub esp,0xc
so i change
opcode = inst.split(":")[1].split()[0]
with
opcode = inst.split(":")[-1].split()[0]
There is also some error on examine_mem_value (it split on ":" but it's not the good thing to do when receiving stuff like 0x804fd80 std::cout@@GLIBCXX_3.4: 0xf7fa344c)
if "<" in out and out.index("<") <= out.index(":"): result = (to_hex(value), "data", "<" + out.split("<", 1)[1].strip()) else: result = (to_hex(value), "data", out.split(":", 1)[1].strip())
I don't know if this the the way to do, i let you handle that ;)