Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH v1.1 1/3] Introduce gdb::function_view
Date: Wed, 22 Feb 2017 22:23:00 -0000	[thread overview]
Message-ID: <20170222222316.xaeqa67lmil52c7j@localhost> (raw)
In-Reply-To: <20baebcd-0f6a-89ca-ef34-503795171d43@redhat.com>

On 17-02-22 17:49:22, Pedro Alves wrote:
> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index 43253d3..a4cac36 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -523,6 +523,12 @@ SUBDIR_PYTHON_DEPS =
>  SUBDIR_PYTHON_LDFLAGS =
>  SUBDIR_PYTHON_CFLAGS =
>  
> +SUBDIR_UNITTESTS_SRCS = \
> +	unittests/function-view-selftests.c
> +
> +SUBDIR_UNITTESTS_OBS = \
> +	function-view-selftests.o
> +
>  # Opcodes currently live in one of two places.  Either they are in the
>  # opcode library, typically ../opcodes, or they are in a header file
>  # in INCLUDE_DIR.
> @@ -1216,7 +1222,8 @@ SFILES = \
>  	common/xml-utils.c \
>  	mi/mi-common.c \
>  	target/waitstatus.c \
> -	$(SUBDIR_GCC_COMPILE_SRCS)
> +	$(SUBDIR_GCC_COMPILE_SRCS) \
> +	$(SUBDIR_UNITTEST_SRCS)
>  
>  LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c
>  
> @@ -1800,7 +1807,8 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
>  	xml-syscall.o \
>  	xml-tdesc.o \
>  	xml-utils.o \
> -	$(SUBDIR_GCC_COMPILE_OBS)
> +	$(SUBDIR_GCC_COMPILE_OBS) \
> +	$(SUBDIR_UNITTESTS_OBS)
>

Can we add SUBDIR_UNITESTS_OBS to CONFIG_OBS (in configure.ac) if
GDB_SELF_TEST is defined?

>  TSOBS = inflow.o
>  
> @@ -1909,6 +1917,10 @@ all: gdb$(EXEEXT) $(CONFIG_ALL)
>  	$(COMPILE) $<
>  	$(POSTCOMPILE)
>  
> +%.o: ${srcdir}/unittests/%.c
> +	$(COMPILE) $<
> +	$(POSTCOMPILE)
> +
>  # Specify an explicit rule for gdb/common/agent.c, to avoid a clash with the
>  # object file generate by gdb/agent.c.
>  common-agent.o: $(srcdir)/common/agent.c
> @@ -2124,7 +2136,13 @@ test-cp-name-parser$(EXEEXT): test-cp-name-parser.o $(LIBIBERTY)
>  # duplicates.  Files in the gdb/ directory can end up appearing in
>  # COMMON_OBS (as a .o file) and CONFIG_SRCS (as a .c file).
>  
> -INIT_FILES = $(COMMON_OBS) $(TSOBS) $(CONFIG_SRCS) $(SUBDIR_GCC_COMPILE_SRCS)
> +INIT_FILES = \
> +	$(COMMON_OBS) \
> +	$(TSOBS) \
> +	$(CONFIG_SRCS) \
> +	$(SUBDIR_GCC_COMPILE_SRCS) \
> +	$(SUBDIR_UNITTESTS_SRCS)
> +

If so, SUBDIR_UNITESTS_SRCS is added to CONFIG_SRCS, we don't need this
change.

> diff --git a/gdb/unittests/function-view-selftests.c b/gdb/unittests/function-view-selftests.c
> new file mode 100644
> index 0000000..3e5369b
> --- /dev/null
> +++ b/gdb/unittests/function-view-selftests.c
> @@ -0,0 +1,184 @@
> +/* Self tests for function_view for GDB, the GNU debugger.
> +
> +   Copyright (C) 2017 Free Software Foundation, Inc.
> +
> +   This file is part of GDB.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   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 "selftest.h"
> +#include "common/function-view.h"
> +
> +#if GDB_SELF_TEST

If gdb/unittests/*.c are compiled when GDB_SELF_TEST is defined, we
don't need to check GDB_SELF_TEST here.

> +
> +namespace selftests {
> +namespace function_view {
> +

> +
> +} /* namespace function_view */
> +} /* namespace selftests */
> +
> +#endif
> +
> +void
> +_initialize_function_view_selftests ()
> +{
> +#if GDB_SELF_TEST

This is not needed as well.

> +  register_self_test (selftests::function_view::run_tests);
> +#endif
> +}
> -- 
> 2.5.5
> 
> 

-- 
Yao


  parent reply	other threads:[~2017-02-22 22:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 14:50 [PATCH 0/3] Introduce gdb::function_view & fix completion bug Pedro Alves
2017-02-22 14:50 ` [PATCH 1/3] Introduce gdb::function_view Pedro Alves
2017-02-22 15:15   ` Simon Marchi
2017-02-22 17:40     ` Pedro Alves
2017-02-22 17:49       ` [PATCH v1.1 " Pedro Alves
2017-02-22 22:12         ` Yao Qi
2017-02-23 14:49           ` Pedro Alves
2017-02-23 15:11             ` Yao Qi
2017-02-23 15:20               ` Pedro Alves
2017-02-23 15:34                 ` Yao Qi
2017-02-22 22:23         ` Yao Qi [this message]
2017-02-23 14:50           ` [PATCH v1.2 " Pedro Alves
2017-02-23 14:58             ` Yao Qi
2017-02-23 14:59               ` Pedro Alves
2017-02-22 18:02       ` [PATCH " Simon Marchi
2017-02-22 14:50 ` [PATCH 3/3] Fix gdb.base/completion.exp with --target_board=dwarf4-gdb-index Pedro Alves
2017-02-23 16:02   ` Yao Qi
2017-02-23 17:12     ` Pedro Alves
2017-02-23 17:24     ` [PATCH v2 0/2] " Pedro Alves
2017-02-23 17:24       ` [PATCH v2 2/2] " Pedro Alves
2017-02-24 15:34         ` Yao Qi
2017-02-24 17:15           ` Pedro Alves
2017-02-23 17:24       ` [PATCH v2 1/2] symtab.c: Small refactor Pedro Alves
2017-02-23 21:45         ` Yao Qi
2017-02-24 17:45           ` Pedro Alves
2017-02-22 14:50 ` [PATCH 2/3] Use gdb::function_view in iterate_over_symtabs & co Pedro Alves
2017-02-22 22:40   ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170222222316.xaeqa67lmil52c7j@localhost \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox