On 18/09/13 21:14, patspiper wrote:
On 18/09/13 21:01, Martin wrote:
On 18/09/2013 19:00, patspiper wrote:

I tried to attach to an external process (Ubuntu 11.04) and (Ooops) the debugger entered the error state; Attach failed. This happens whether the process is a Lazarus compiled app or other.

Lazarus 1.3 r42849 FPC 2.6.3 i386-linux-gtk 2

I am not sure if Graeme has the same symptoms or not.
Can you sent me a log:
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#gdb.exe_has_stopped_working
Log:

=thread-group-added,id="i1"
(gdb)
<-gdb-set confirm off>
^done
(gdb)
<-gdb-set new-console off>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<set width 50000>
&"set width 50000\n"
^done
(gdb)
<-gdb-version>
~"GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2\n"
~"Copyright (C) 2010 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\nand \"show warranty\" for details.\n" ~"This GDB was configured as \"i686-linux-gnu\".\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
^done
(gdb)
<-file-exec-and-symbols "/home/deleteme/project1">
^done
(gdb)
<-file-exec-and-symbols >
^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<attach 9149>
&"attach 9149\n"
&"Could not attach to process. If your uid matches the uid of the target\nprocess, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try\nagain as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf\n"
&"ptrace: Operation not permitted.\n"
^error,msg="ptrace: Operation not permitted."
(gdb)
<detach>
&"detach\n"
&"The program is not being run.\n"
^error,msg="The program is not being run."
(gdb)
<kill>

In 10-ptrace.conf: kernel.yama.ptrace_scope = 1

"A scope of "1" limits # PTRACE only to direct child processes (e.g. "gdb name-of-program" and # "strace -f name-of-program" work, but gdb's "attach" and "strace -fp $PID" # do not)"
which essentially explains why the debugger fails to attach to the process.

Stephano

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to