diff mbox series

[v4,3/4] pdbg/gdbserver: Make gdbserver optional

Message ID 20181102004644.23047-4-rashmica.g@gmail.com
State Accepted
Headers show
Series Basic gdbserver for POWER8 | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Rashmica Gupta Nov. 2, 2018, 12:46 a.m. UTC
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
---
 Makefile.am     | 21 +++++++++++----------
 configure.ac    |  6 ++++++
 src/pdbgproxy.c |  9 +++++++++
 3 files changed, 26 insertions(+), 10 deletions(-)

Comments

Amitay Isaacs Nov. 5, 2018, 12:43 a.m. UTC | #1
On Fri, 2018-11-02 at 11:46 +1100, Rashmica Gupta wrote:
> Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
> ---
>  Makefile.am     | 21 +++++++++++----------
>  configure.ac    |  6 ++++++
>  src/pdbgproxy.c |  9 +++++++++
>  3 files changed, 26 insertions(+), 10 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 5a9d239..e83f21f 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -84,14 +84,17 @@ pdbg_SOURCES = \
>  	src/parsers.c \
>  	src/optcmd.c \
>  	src/options_@ARCH@.c \
> -	src/htm.h \
> -	src/main.h \
> -	src/optcmd.h \
> -	src/options.h \
> -	src/parsers.h \
> -	src/progress.h \
> -	src/pdbgproxy.c \
> -	src/gdb_parser.c
> +	src/pdbgproxy.c
> +
> +pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror
> -DGIT_SHA1=\"${GIT_SHA1}\" \
> +	      $(ARCH_FLAGS)
> +
> +if GDBSERVER
> +pdbg_SOURCES += \
> +	$(extra_sources)
> +else
> +pdbg_CFLAGS += -DDISABLE_GDBSERVER
> +endif
>  

Did you remove the header files from pdbg_SOURCES intentionally?

They are required for "make dist" to package all the files correctly. 
If we don't care about "make dist", then we can ignore the header
files. 


>  src/main.c: $(DT_headers)
>  
> @@ -99,8 +102,6 @@ pdbg_LDADD = $(DT_objects) libpdbg.la libccan.a \
>  	-L.libs -lrt
>  
>  pdbg_LDFLAGS = -Wl,--whole-archive,-lpdbg,--no-whole-archive
> -pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror
> -DGIT_SHA1=\"${GIT_SHA1}\" \
> -	      $(ARCH_FLAGS)
>  
>  lib_LTLIBRARIES = libpdbg.la libfdt.la
>  
> diff --git a/configure.ac b/configure.ac
> index 0fbf8ae..a52e1ed 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -36,4 +36,10 @@ AC_SUBST([ARCH])
>  AM_CONDITIONAL([TARGET_ARM], [test x"$ARCH" = "xarm"])
>  AM_CONDITIONAL([TARGET_PPC], [test x"$ARCH" = "xppc"])
>  
> +AC_ARG_ENABLE(gdbserver,
> +AC_HELP_STRING([--disable-gdbserver], [disables building the
> gdbserver]),
> +want_gdbserver=false,
> +want_gdbserver=true)
> +AM_CONDITIONAL([GDBSERVER], [test x$want_gdbserver = xtrue])
> +
>  AC_OUTPUT
> diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
> index 5ccadfc..8415fea 100644
> --- a/src/pdbgproxy.c
> +++ b/src/pdbgproxy.c
> @@ -25,6 +25,8 @@
>  #include "debug.h"
>  #include "chip.h"
>  
> +#ifndef DISABLE_GDBSERVER
> +
>  /* Maximum packet size */
>  #define BUFFER_SIZE    	8192
>  
> @@ -544,4 +546,11 @@ static int gdbserver(uint16_t port)
>  	gdbserver_start(target, port);
>  	return 0;
>  }
> +#else
> +
> +static int gdbserver(uint16_t port)
> +{
> +	return 0;
> +}
> +#endif
>  OPTCMD_DEFINE_CMD_WITH_ARGS(gdbserver, gdbserver, (DATA16));
> -- 
> 2.17.2
> 

Amitay.
Alistair Popple Nov. 6, 2018, 2:23 a.m. UTC | #2
On Monday, 5 November 2018 11:43:07 AM AEDT Amitay Isaacs wrote:
> On Fri, 2018-11-02 at 11:46 +1100, Rashmica Gupta wrote:
> > Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
> > ---
> > 
> >  Makefile.am     | 21 +++++++++++----------
> >  configure.ac    |  6 ++++++
> >  src/pdbgproxy.c |  9 +++++++++
> >  3 files changed, 26 insertions(+), 10 deletions(-)
> > 
> > diff --git a/Makefile.am b/Makefile.am
> > index 5a9d239..e83f21f 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -84,14 +84,17 @@ pdbg_SOURCES = \
> > 
> >  	src/parsers.c \
> >  	src/optcmd.c \
> >  	src/options_@ARCH@.c \
> > 
> > -	src/htm.h \
> > -	src/main.h \
> > -	src/optcmd.h \
> > -	src/options.h \
> > -	src/parsers.h \
> > -	src/progress.h \
> > -	src/pdbgproxy.c \
> > -	src/gdb_parser.c
> > +	src/pdbgproxy.c
> > +
> > +pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror
> > -DGIT_SHA1=\"${GIT_SHA1}\" \
> > +	      $(ARCH_FLAGS)
> > +
> > +if GDBSERVER
> > +pdbg_SOURCES += \
> > +	$(extra_sources)
> > +else
> > +pdbg_CFLAGS += -DDISABLE_GDBSERVER
> > +endif
> 
> Did you remove the header files from pdbg_SOURCES intentionally?

Nope. I must have stuffed up the tweaking I was doing here. Will post a patch 
to fix it up.

- Alistair

> They are required for "make dist" to package all the files correctly.
> If we don't care about "make dist", then we can ignore the header
> files.
> 
> >  src/main.c: $(DT_headers)
> > 
> > @@ -99,8 +102,6 @@ pdbg_LDADD = $(DT_objects) libpdbg.la libccan.a \
> > 
> >  	-L.libs -lrt
> >  
> >  pdbg_LDFLAGS = -Wl,--whole-archive,-lpdbg,--no-whole-archive
> > 
> > -pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror
> > -DGIT_SHA1=\"${GIT_SHA1}\" \
> > -	      $(ARCH_FLAGS)
> > 
> >  lib_LTLIBRARIES = libpdbg.la libfdt.la
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 0fbf8ae..a52e1ed 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -36,4 +36,10 @@ AC_SUBST([ARCH])
> > 
> >  AM_CONDITIONAL([TARGET_ARM], [test x"$ARCH" = "xarm"])
> >  AM_CONDITIONAL([TARGET_PPC], [test x"$ARCH" = "xppc"])
> > 
> > +AC_ARG_ENABLE(gdbserver,
> > +AC_HELP_STRING([--disable-gdbserver], [disables building the
> > gdbserver]),
> > +want_gdbserver=false,
> > +want_gdbserver=true)
> > +AM_CONDITIONAL([GDBSERVER], [test x$want_gdbserver = xtrue])
> > +
> > 
> >  AC_OUTPUT
> > 
> > diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
> > index 5ccadfc..8415fea 100644
> > --- a/src/pdbgproxy.c
> > +++ b/src/pdbgproxy.c
> > @@ -25,6 +25,8 @@
> > 
> >  #include "debug.h"
> >  #include "chip.h"
> > 
> > +#ifndef DISABLE_GDBSERVER
> > +
> > 
> >  /* Maximum packet size */
> >  #define BUFFER_SIZE    	8192
> > 
> > @@ -544,4 +546,11 @@ static int gdbserver(uint16_t port)
> > 
> >  	gdbserver_start(target, port);
> >  	return 0;
> >  
> >  }
> > 
> > +#else
> > +
> > +static int gdbserver(uint16_t port)
> > +{
> > +	return 0;
> > +}
> > +#endif
> > 
> >  OPTCMD_DEFINE_CMD_WITH_ARGS(gdbserver, gdbserver, (DATA16));
> 
> Amitay.
diff mbox series

Patch

diff --git a/Makefile.am b/Makefile.am
index 5a9d239..e83f21f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,14 +84,17 @@  pdbg_SOURCES = \
 	src/parsers.c \
 	src/optcmd.c \
 	src/options_@ARCH@.c \
-	src/htm.h \
-	src/main.h \
-	src/optcmd.h \
-	src/options.h \
-	src/parsers.h \
-	src/progress.h \
-	src/pdbgproxy.c \
-	src/gdb_parser.c
+	src/pdbgproxy.c
+
+pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror -DGIT_SHA1=\"${GIT_SHA1}\" \
+	      $(ARCH_FLAGS)
+
+if GDBSERVER
+pdbg_SOURCES += \
+	$(extra_sources)
+else
+pdbg_CFLAGS += -DDISABLE_GDBSERVER
+endif
 
 src/main.c: $(DT_headers)
 
@@ -99,8 +102,6 @@  pdbg_LDADD = $(DT_objects) libpdbg.la libccan.a \
 	-L.libs -lrt
 
 pdbg_LDFLAGS = -Wl,--whole-archive,-lpdbg,--no-whole-archive
-pdbg_CFLAGS = -I$(top_srcdir)/libpdbg -Wall -Werror -DGIT_SHA1=\"${GIT_SHA1}\" \
-	      $(ARCH_FLAGS)
 
 lib_LTLIBRARIES = libpdbg.la libfdt.la
 
diff --git a/configure.ac b/configure.ac
index 0fbf8ae..a52e1ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,4 +36,10 @@  AC_SUBST([ARCH])
 AM_CONDITIONAL([TARGET_ARM], [test x"$ARCH" = "xarm"])
 AM_CONDITIONAL([TARGET_PPC], [test x"$ARCH" = "xppc"])
 
+AC_ARG_ENABLE(gdbserver,
+AC_HELP_STRING([--disable-gdbserver], [disables building the gdbserver]),
+want_gdbserver=false,
+want_gdbserver=true)
+AM_CONDITIONAL([GDBSERVER], [test x$want_gdbserver = xtrue])
+
 AC_OUTPUT
diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index 5ccadfc..8415fea 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -25,6 +25,8 @@ 
 #include "debug.h"
 #include "chip.h"
 
+#ifndef DISABLE_GDBSERVER
+
 /* Maximum packet size */
 #define BUFFER_SIZE    	8192
 
@@ -544,4 +546,11 @@  static int gdbserver(uint16_t port)
 	gdbserver_start(target, port);
 	return 0;
 }
+#else
+
+static int gdbserver(uint16_t port)
+{
+	return 0;
+}
+#endif
 OPTCMD_DEFINE_CMD_WITH_ARGS(gdbserver, gdbserver, (DATA16));