[v3,1/6] Share gdb/environ.[ch] with gdbserver
Commit Message
We will need access to the environment functions when we share
fork_inferior between GDB and gdbserver, therefore we simply make the
API on gdb/environ.[ch] available on common/. No extra adjustments
are needed to make it compile on gdbserver.
gdb/ChangeLog:
yyyy-mm-dd Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (SFILES): Replace "environ.c" with
"common/environ.c".
(HFILES_NO_SRCDIR): Likewise, for "environ.h".
* environ.c: Include "common-defs.h" instead of "defs.h. Moved
to...
* common/environ.c: ... here.
* environ.h: Moved to...
* common/environ.h: ... here.
gdb/gdbserver/ChangeLog:
yyyy-mm-dd Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile.in (SFILES): Add "common/environ.c".
(OBJS): Add "common/environ.h".
---
gdb/Makefile.in | 4 ++--
gdb/{ => common}/environ.c | 2 +-
gdb/{ => common}/environ.h | 0
gdb/gdbserver/Makefile.in | 5 +++++
4 files changed, 8 insertions(+), 3 deletions(-)
rename gdb/{ => common}/environ.c (99%)
rename gdb/{ => common}/environ.h (100%)
Comments
On 02/08/2017 03:22 AM, Sergio Durigan Junior wrote:
> We will need access to the environment functions when we share
> fork_inferior between GDB and gdbserver, therefore we simply make the
> API on gdb/environ.[ch] available on common/. No extra adjustments
> are needed to make it compile on gdbserver.
>
> gdb/ChangeLog:
> yyyy-mm-dd Sergio Durigan Junior <sergiodj@redhat.com>
>
> * Makefile.in (SFILES): Replace "environ.c" with
> "common/environ.c".
> (HFILES_NO_SRCDIR): Likewise, for "environ.h".
> * environ.c: Include "common-defs.h" instead of "defs.h. Moved
> to...
> * common/environ.c: ... here.
> * environ.h: Moved to...
> * common/environ.h: ... here.
>
> gdb/gdbserver/ChangeLog:
> yyyy-mm-dd Sergio Durigan Junior <sergiodj@redhat.com>
>
> * Makefile.in (SFILES): Add "common/environ.c".
> (OBJS): Add "common/environ.h".
OK.
Thanks,
Pedro Alves
On Wednesday, February 15 2017, Pedro Alves wrote:
> On 02/08/2017 03:22 AM, Sergio Durigan Junior wrote:
>> We will need access to the environment functions when we share
>> fork_inferior between GDB and gdbserver, therefore we simply make the
>> API on gdb/environ.[ch] available on common/. No extra adjustments
>> are needed to make it compile on gdbserver.
>>
>> gdb/ChangeLog:
>> yyyy-mm-dd Sergio Durigan Junior <sergiodj@redhat.com>
>>
>> * Makefile.in (SFILES): Replace "environ.c" with
>> "common/environ.c".
>> (HFILES_NO_SRCDIR): Likewise, for "environ.h".
>> * environ.c: Include "common-defs.h" instead of "defs.h. Moved
>> to...
>> * common/environ.c: ... here.
>> * environ.h: Moved to...
>> * common/environ.h: ... here.
>>
>> gdb/gdbserver/ChangeLog:
>> yyyy-mm-dd Sergio Durigan Junior <sergiodj@redhat.com>
>>
>> * Makefile.in (SFILES): Add "common/environ.c".
>> (OBJS): Add "common/environ.h".
>
> OK.
Thanks, checked in:
1672e0d98d88d11b5c7d5793bd2cf29cbb56696f
@@ -1049,7 +1049,6 @@ SFILES = \
dwarf2loc.c \
dwarf2read.c \
elfread.c \
- environ.c \
eval.c \
event-loop.c \
event-top.c \
@@ -1195,6 +1194,7 @@ SFILES = \
common/common-regcache.c \
common/common-utils.c \
common/errors.c \
+ common/environ.c \
common/fileio.c \
common/filestuff.c \
common/format.c \
@@ -1273,7 +1273,6 @@ HFILES_NO_SRCDIR = \
dwarf2-frame-tailcall.h \
dwarf2expr.h \
dwarf2loc.h \
- environ.h \
event-loop.h \
event-top.h \
exceptions.h \
@@ -1474,6 +1473,7 @@ HFILES_NO_SRCDIR = \
common/common-types.h \
common/common-utils.h \
common/errors.h \
+ common/environ.h \
common/fileio.h \
common/format.h \
common/gdb_assert.h \
similarity index 99%
rename from gdb/environ.c
rename to gdb/common/environ.c
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "defs.h"
+#include "common-defs.h"
#include "environ.h"
#include <algorithm>
similarity index 100%
rename from gdb/environ.h
rename to gdb/common/environ.h
@@ -201,6 +201,7 @@ SFILES = \
$(srcdir)/common/common-regcache.c \
$(srcdir)/common/common-utils.c \
$(srcdir)/common/errors.c \
+ $(srcdir)/common/environ.c \
$(srcdir)/common/fileio.c \
$(srcdir)/common/filestuff.c \
$(srcdir)/common/gdb_vecs.c \
@@ -238,6 +239,7 @@ OBS = \
debug.o \
dll.o \
errors.o \
+ environ.o \
event-loop.o \
fileio.o \
filestuff.o \
@@ -774,6 +776,9 @@ agent.o: ../common/agent.c
errors.o: ../common/errors.c
$(COMPILE) $<
$(POSTCOMPILE)
+environ.o: ../common/environ.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
common-debug.o: ../common/common-debug.c
$(COMPILE) $<
$(POSTCOMPILE)