This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OpenBSD, implement target_pid_to_exec_file


> From: Pedro Alves <pedro@codesourcery.com>
> Date: Wed, 13 Aug 2008 03:12:02 +0100
> 
> I was testing a couple of things in OpenBSD, and noticed that
> when attaching to a running process, I have to specify the
> exec file manually.  In some/most native ports, if we don't specify
> an exec file, when attaching, GDB will try to find it by
> pid.  This matching is implemented by the target_pid_to_exec_file
> target op, but, the OpenBSD port doesn't currently implement it.
> 
> The attached patch fixes it.  Using kvm_openfiles with KVM_NO_FILES,
> still gives you access to kvm_getargv, so you don't need special
> privileges to access /dev/mem.  kvm_getargv gives you a full path
> to the program.

Unfortunately that doesn't really work; there is no guarantee that
argv[0] is the full path to the program.  It can be a relative
pathname for example.  And it can be changed by the program itself to
something completely arbitrary.

There currently is no interface on OpenBSD to implement this feature
reliably enough to add it to GDB I'm afraid.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]