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: [PATCH/RFC] Implement the ability to set the current working directory in GDBserver


On Friday, September 01, 2017 12:01:51 AM Pedro Alves wrote:
> On 08/30/2017 06:38 AM, Sergio Durigan Junior wrote:
> > I didn't want to implement a gdbserver-specific command (e.g., "set
> > remote directory"), which means that my approach has some drawbacks.
> > For example, if you want gdbserver to cd to "/abc", but "/abc" doesn't
> > exist in the host, then you still won't be able to do this, because
> > GDB obviously won't allow you to "cd" into a non-existing dir.  So you
> > will have to have the same directory structure in both host and target
> > if you want to do that.
> 
> I'm not sure this is the right approach.  I'd like to have a
> better understanding of what are the use cases "cd" is used for.
> Beyond affecting the inferior's cwd when it is started, what
> else is/can "cd" used for?  Or IOW, what else does GDB's
> current working directory affect?

I often use 'cd' to source gdb script files that themselves source
additional files.  In particular, I have a set of scripts I use for kernel
debugging on FreeBSD that live in a 'gdb6' top-level script that itself
sources machine-dependent scripts (e.g. 'gdb6.amd64').  To make this work
I do 'cd /path/to/scripts' before 'source gdb6'.  That may be a bit of an
odd ball case, but it would not be relevant to a remote target.

-- 
John Baldwin


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