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 v5] Implement the ability to set/unset environment variables to GDBserver when starting the inferior


Hi Sergio,

I noticed that the share-env-with-gdbserver.exp test you added is skipped if using a gdb stub. However the comment says the test is meaningless for native-gdbserver. Shouldn't the check also look whether this is a cross debugger?

Best regards,

Thomas

On 31/08/17 22:26, Sergio Durigan Junior wrote:
On Thursday, August 31 2017, Simon Marchi wrote:

On 2017-08-31 22:49, Sergio Durigan Junior wrote:
Changes from v4:

- Applied Simon's patch to refactor the unittest.  Thanks, Simon!


This patch implements the ability to set/unset environment variables
on the remote target, mimicking what GDB already offers to the user.
There are two features present here: user-set and user-unset
environment variables.

User-set environment variables are only the variables that are
explicitly set by the user, using the 'set environment' command.  This
means that variables that were already present in the environment when
starting GDB/GDBserver are not transmitted/considered by this feature.

User-unset environment variables are variables that are explicitly
unset by the user, using the 'unset environment' command.

The idea behind this patch is to store user-set and user-unset
environment variables in two separate sets, both part of gdb_environ.
Then, when extended_remote_create_inferior is preparing to start the
inferior, it will iterate over the two sets and set/unset variables
accordingly.  Three new packets are introduced:

- QEnvironmentHexEncoded, which is used to set environment variables,
   and contains an hex-encoded string in the format "VAR=VALUE" (VALUE
   can be empty if the user set a variable with a null value, by doing
   'set environment VAR=').

- QEnvironmentUnset, which is used to unset environment variables, and
   contains an hex-encoded string in the format "VAR".

- QEnvironmentReset, which is always the first packet to be
   transmitted, and is used to reset the environment, i.e., discard any
   changes made by the user on previous runs.

The QEnvironmentHexEncoded packet is inspired on LLDB's extensions to
the RSP.  Details about it can be seen here:


<https://raw.githubusercontent.com/llvm-mirror/lldb/master/docs/lldb-gdb-remote.txt>

I decided not to implement the QEnvironment packet because it is
considered deprecated by LLDB.  This packet, on LLDB, serves the same
purpose of QEnvironmentHexEncoded, but sends the information using a
plain text, non-hex-encoded string.

The other two packets are new.

This patch also includes updates to the documentation, testsuite, and
unit tests, without introducing regressions.

That version LGTM.

Thanks for all the reviews.

Pushed:
   0a2dde4a321d2f7bd2ded9a558b9ae92892de0e2



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