Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Svante Signell <svante.signell@gmail.com>
To: Simon Marchi <simark@simark.ca>, Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Please define thread_info as struct thread_info (and other stuff)
Date: Sun, 16 Dec 2018 05:14:00 -0000	[thread overview]
Message-ID: <07b12fd403ec2442d90ec3f73bb9a0b99a8899e3.camel@gmail.com> (raw)
In-Reply-To: <e88220e4-143b-264b-93f4-f79994a82cf6@simark.ca>

On Sat, 2018-12-15 at 23:31 -0500, Simon Marchi wrote:
> On 2018-12-15 6:01 p.m., Svante Signell wrote:
> > A typical error output:
> > CXX    target.o
> > /home/srs/DEBs/gdb/gdb-8.2/gdb/target.c: In function ‘int
> > dispose_inferior(inferior*, void*)’:
> > /home/srs/DEBs/gdb/gdb-8.2/gdb/target.c:2028:16: error: ‘thread’ was not
> > declared 
> > in this scope
> >    thread_info *thread = any_thread_of_inferior (inf);
> >                 ^~~~~~
> > /home/srs/DEBs/gdb/gdb-8.2/gdb/target.c:2028:16: note: suggested
> > alternative:
> > ‘myread’
> >    thread_info *thread = any_thread_of_inferior (inf);
> >                 ^~~~~~
> >                 myread
> > 
> > Sorry, but the compiler directive is hidden from the output (by libtool??).
> 
> You can do "make V=1" to show the compiler invocation (same as if we would use
> automake).

Here is an example output with make make V=1 -C build/objdir/gdb/ elfread.o

i686-gnu-g++ -x c++  -g -O2 -fdebug-prefix-map=/home/srs/DEBs/gdb/gdb-8.2=.
-fstack-protector-strong -Wformat -Werror=format-security -D_GNU_SOURCE  -I.
-I/home/srs/DEBs/gdb/gdb-8.2/gdb -I/home/srs/DEBs/gdb/gdb-8.2/gdb/common
-I/home/srs/DEBs/gdb/gdb-8.2/gdb/config -DLOCALEDIR="\"/usr/share/locale\""
-DHAVE_CONFIG_H -I/home/srs/DEBs/gdb/gdb-8.2/gdb/../include/opcode
-I/home/srs/DEBs/gdb/gdb-8.2/gdb/../opcodes/..   -I../bfd
-I/home/srs/DEBs/gdb/gdb-8.2/gdb/../bfd -I/home/srs/DEBs/gdb/gdb-
8.2/gdb/../include -I../libdecnumber -I/home/srs/DEBs/gdb/gdb-
8.2/gdb/../libdecnumber  -I/home/srs/DEBs/gdb/gdb-8.2/gdb/gnulib/import -Ibuild-
gnulib/import   -DTUI=1  -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC  -
I/usr/include/python3.7m -I/usr/include/python3.7m -Wall -Wpointer-arith -Wno-
unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-
compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wsuggest-override
-Wimplicit-fallthrough=3 -Wduplicated-cond -Wformat-nonliteral  -c -o elfread.o
-MT elfread.o -MMD -MP -MF ./.deps/elfread.Tpo /home/srs/DEBs/gdb/gdb-
8.2/gdb/elfread.c
In file included from ./nm.h:25,
                 from /home/srs/DEBs/gdb/gdb-8.2/gdb/defs.h:420,
                 from /home/srs/DEBs/gdb/gdb-8.2/gdb/elfread.c:22:
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:35:46: warning: ‘get_thread_regcache’
initialized and declared ‘extern’
 extern struct regcache *get_thread_regcache (thread_info *thread);
                                              ^~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:35:46: error: ‘regcache*
get_thread_regcache’ redeclared as different kind of symbol
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:32:25: note: previous declaration
‘regcache* get_thread_regcache(ptid_t)’
 extern struct regcache *get_thread_regcache (ptid_t ptid);
                         ^~~~~~~~~~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:35:59: error: ‘thread’ was not
declared in this scope
 extern struct regcache *get_thread_regcache (thread_info *thread);
                                                           ^~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:35:59: note: suggested alternative:
‘thread_t’
 extern struct regcache *get_thread_regcache (thread_info *thread);
                                                           ^~~~~~
                                                           thread_t
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:144:14: error: ‘function_view’ in
namespace ‘gdb’ does not name a template type
 typedef gdb::function_view<register_status (int regnum, gdb_byte *buf)>
              ^~~~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:228:14: error: ‘register_read_ftype’
has not been declared
   void save (register_read_ftype cooked_read);
              ^~~~~~~~~~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:422:49: error: ‘register_read_ftype’
has not been declared
   readonly_detached_regcache (gdbarch *gdbarch, register_read_ftype
cooked_read)
                                                 ^~~~~~~~~~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:439:39: error: variable or field
‘registers_changed_thread’ declared void
 extern void registers_changed_thread (thread_info *thread);
                                       ^~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:439:52: error: ‘thread’ was not
declared in this scope
 extern void registers_changed_thread (thread_info *thread);
                                                    ^~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/regcache.h:439:52: note: suggested alternative:
‘thread_t’
 extern void registers_changed_thread (thread_info *thread);
                                                    ^~~~~~
                                                    thread_t
In file included from /home/srs/DEBs/gdb/gdb-8.2/gdb/target.h:44,
                 from /home/srs/DEBs/gdb/gdb-8.2/gdb/progspace.h:24,
                 from /home/srs/DEBs/gdb/gdb-8.2/gdb/objfiles.h:27,
                 from /home/srs/DEBs/gdb/gdb-8.2/gdb/elfread.c:30:
/home/srs/DEBs/gdb/gdb-8.2/gdb/breakpoint.h:950:21: error: ‘thread_info’ is not
a type
       CORE_ADDR pc, thread_info *thread,
                     ^~~~~~~~~~~
In file included from /home/srs/DEBs/gdb/gdb-8.2/gdb/progspace.h:24,
                 from /home/srs/DEBs/gdb/gdb-8.2/gdb/objfiles.h:27,
                 from /home/srs/DEBs/gdb/gdb-8.2/gdb/elfread.c:30:
/home/srs/DEBs/gdb/gdb-8.2/gdb/target.h:652:44: error: ‘extra_thread_info’
declared as a ‘virtual’ field
     virtual const char *extra_thread_info (thread_info *)
                                            ^~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/target.h:652:25: error: expected ‘;’ at end of
member declaration
     virtual const char *extra_thread_info (thread_info *)
                         ^~~~~~~~~~~~~~~~~
                                          ;
/home/srs/DEBs/gdb/gdb-8.2/gdb/target.h:652:55: error: expected ‘)’ before ‘*’
token
     virtual const char *extra_thread_info (thread_info *)
                                           ~           ^~
                                                       )
/home/srs/DEBs/gdb/gdb-8.2/gdb/target.h:654:38: error: ‘thread_name’ declared as
a ‘virtual’ field
     virtual const char *thread_name (thread_info *)
                                      ^~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/target.h:654:25: error: expected ‘;’ at end of
member declaration
     virtual const char *thread_name (thread_info *)
                         ^~~~~~~~~~~
                                    ;
/home/srs/DEBs/gdb/gdb-8.2/gdb/target.h:654:49: error: expected ‘)’ before ‘*’
token
     virtual const char *thread_name (thread_info *)
                                     ~           ^~
                                                 )
/home/srs/DEBs/gdb/gdb-8.2/gdb/target.h:656:13: error: ‘thread_info’ does not
name a type
     virtual thread_info *thread_handle_to_thread_info (const gdb_byte *,
             ^~~~~~~~~~~
In file included from /home/srs/DEBs/gdb/gdb-8.2/gdb/infcall.h:23,
                 from /home/srs/DEBs/gdb/gdb-8.2/gdb/elfread.c:42:
/home/srs/DEBs/gdb/gdb-8.2/gdb/dummy-frame.h:38:10: error: ‘thread_info’ is not
a type
          thread_info *thread);
          ^~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/dummy-frame.h:49:49: error: ‘thread_info’ is not
a type
 extern void dummy_frame_pop (frame_id dummy_id, thread_info *thread);
                                                 ^~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/dummy-frame.h:51:53: error: ‘thread_info’ is not
a type
 extern void dummy_frame_discard (frame_id dummy_id, thread_info *thread);
                                                     ^~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/dummy-frame.h:67:12: error: ‘thread_info’ is not
a type
            thread_info *thread,
            ^~~~~~~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/elfread.c: In function ‘void
elf_gnu_ifunc_resolver_return_stop(breakpoint*)’:
/home/srs/DEBs/gdb/gdb-8.2/gdb/elfread.c:975:16: error: ‘thread’ was not
declared in this scope
   thread_info *thread = inferior_thread ();
                ^~~~~~
/home/srs/DEBs/gdb/gdb-8.2/gdb/elfread.c:975:16: note: suggested alternative:
‘myread’
   thread_info *thread = inferior_thread ();
                ^~~~~~
                myread
Makefile:1651: recipe for target 'elfread.o' failed
make: *** [elfread.o] Error 1

In gdb/regcache.h we have:
extern struct regcache *get_thread_regcache (ptid_t ptid);
extern struct regcache *get_thread_regcache (struct thread_info *thread);

> What you compiler is doing is very strange, as Tom mentioned the use of the
> "struct" or "class" keyword when declaring a variable in C++ is
> optional.  What does your
> compiler say when compiling the following code (g++ -c foo.cpp)?
> 
> struct Foo
> {
> 	int a;
> };
> 
> void func()
> {
> 	Foo f2;
> }

g++ -c -Wall foo.cpp 
foo.cpp: In function ‘void func()’:
foo.cpp:8:13: warning: unused variable ‘f2’ [-Wunused-variable]
         Foo f2;



  reply	other threads:[~2018-12-16  5:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15 19:36 Svante Signell
2018-12-15 22:48 ` Tom Tromey
2018-12-15 23:01   ` Svante Signell
2018-12-16  4:31     ` Simon Marchi
2018-12-16  5:14       ` Svante Signell [this message]
2018-12-16  6:02         ` Simon Marchi
2018-12-16 16:22         ` Tom Tromey
2018-12-16  9:20 ` Andreas Schwab
2018-12-16 19:08   ` Svante Signell
2018-12-16 23:10     ` Tom Tromey
2018-12-17 20:51       ` Svante Signell
2018-12-17 21:41         ` John Baldwin
2019-02-14 15:16           ` Thomas Schwinge
2018-12-20 13:31         ` Svante Signell
2018-12-20 22:34           ` Tom Tromey
2018-12-20 23:26             ` Simon Marchi
2018-12-24 21:51             ` Tom Tromey
2019-01-12 18:37               ` Svante Signell
2019-01-12 20:50                 ` Tom Tromey

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=07b12fd403ec2442d90ec3f73bb9a0b99a8899e3.camel@gmail.com \
    --to=svante.signell@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tom@tromey.com \
    /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