This is the mail archive of the gdb@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: GDB and LD_PRELOAD library-call interception


On Thu, 31 Mar 2011 11:46:56 +0200, Kevin Pouget wrote:
> I was wondering if there could be a way to hack this exec-wrapper to
> launch for instance the executable in an xterm window?

It is not such straightforward, GDB expects the PID it has spawned will be
debugged while with xterm the process being debugged is its child.

I guess you can write a small C helper which will:
 * create new pty
 * change its fds 0/1/2 to the slave of this pty
 * fork xterm -e own-helper-part pty-unique-id
In own-helper-part interconnect the pty master part and its fds 0/1/2.

Another way is to make fork-child.c more flexible/configurable.


> but it it possible to follow easily (two) forks?

Yes, `set detach-on-fork off', so-called multi-inferior mode, it has some
issues on native GNU/Linux system.


Regards,
Jan


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