1. 程式人生 > >【Error】gdb.attach錯誤 Failed to read a valid object file image from memory.

【Error】gdb.attach錯誤 Failed to read a valid object file image from memory.

python指令碼中pwntools gdb.attach遇到錯誤:Failed to read a valid object file image from memory.

******
Your encoding (ANSI_X3.4-1968) is different than UTF-8. pwndbg might not work properly.
You might try launching gdb with:
    LC_ALL=en_US.UTF-8 PYTHONIOENCODING=UTF-8 gdb
Make sure that en_US.UTF-8 is activated in /etc/locale.gen and you called locale-gen
******
pwndbg: loaded 173 commands. Type pwndbg [filter] for a list.
pwndbg: created $rebase, $ida gdb functions (can be used with print/break)
Reading symbols from ./RNote4...(no debugging symbols found)...done.
Attaching to program: /root/Pwn/RNote4/RNote4, process 1105
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.23.so...done.
done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.23.so...done.
done.
Cannot access memory at address 0x7ffff7ffe148

warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Failed to read a valid object file image from memory.
0x00007ffff7b04260 in __read_nocancel () at ../sysdeps/unix/syscall-template.S:84
84      ../sysdeps/unix/syscall-template.S: No such file or directory.
ERROR: Could not find ELF base!
ERROR: Could not find ELF base!
ERROR: Could not find ELF base!
ERROR: Could not find ELF base!
ERROR: Could not find ELF base!
ERROR: Could not find ELF base!
ERROR: Could not find ELF base!
Couldn't get registers: No such process.
/tmp/pwnS5x0nn.gdb:2: Error in sourced command file:
Couldn't get registers: No such process.
Exception occured: Error: Couldn't get registers: No such process. (<class 'gdb.error'>)
For more info invoke `set exception-verbose on` and rerun the command
or debug it by yourself with `set exception-debugger on`
Python Exception <class 'gdb.error'> Couldn't get registers: No such process.:

一陣搜尋之後沒搞定。後來問了同學發現問題是python腳本里面忘加interactive了, 導致程式退出了。所以gdb attach不上。