From: Simon Marchi <simark@simark.ca>
To: svante.signell@gmail.com, 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 06:02:00 -0000 [thread overview]
Message-ID: <4a6c6720-8c39-6d36-773d-2973798f134e@simark.ca> (raw)
In-Reply-To: <07b12fd403ec2442d90ec3f73bb9a0b99a8899e3.camel@gmail.com>
On 2018-12-16 12:15 a.m., Svante Signell wrote:
> 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;
>
>
Sorry, I don't have anything to add, except that it looks like a compiler
problem. I'm compiling the same code with the same compiler version (gcc 8.2),
so I'm at lost here. I'd try to reduce to a minimal reproducer to try to understand
the problem better...
Simon
next prev parent reply other threads:[~2018-12-16 6:02 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
2018-12-16 6:02 ` Simon Marchi [this message]
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=4a6c6720-8c39-6d36-773d-2973798f134e@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=svante.signell@gmail.com \
--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