public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [GSOC] getting "gdb: unrecognized option '-dumpdir'' while trying to debug gcc using gdb
@ 2023-03-20 17:06 Rishi Raj
  2023-03-20 19:08 ` David Malcolm
  0 siblings, 1 reply; 3+ messages in thread
From: Rishi Raj @ 2023-03-20 17:06 UTC (permalink / raw)
  To: gcc, dmalcolm, mjambor

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

I am sorry for the previous messed-up reply :(. I was trying to reply back
to my previous mail thread but mistakenly replied to the entire digest::((.
Thanks, David and Martin, for the heads up, and I am sorry for the late
reply due to health issues. Anyways I could emit the warning "hello world,
I am function foo.".  After that, I tried debugging using the` ../gcc
-wrapper gdb test.c`(gcc binary is in parent folder) but I am getting this
error "gdb: unrecognized option '-dumpdir'
Use `gdb --help' for a complete list of options.". I googled it and got
this on Bugzilla (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53195), but
it has already been fixed. These are the gdb configurations during the
build:
Using built-in specs.
COLLECT_GCC=../gcc
COLLECT_LTO_WRAPPER=gcc-dir/libexec/gcc/x86_64-pc-linux-gnu/12.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../project/configure --prefix=gcc-dir
--enable-languages=c,c++ --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20230302 [OG12] (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
Can anyone point out how to resolve this or if I am missing something
during build?
Thanks and regards
Rishi Raj

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GSOC] getting "gdb: unrecognized option '-dumpdir'' while trying to debug gcc using gdb
  2023-03-20 17:06 [GSOC] getting "gdb: unrecognized option '-dumpdir'' while trying to debug gcc using gdb Rishi Raj
@ 2023-03-20 19:08 ` David Malcolm
  2023-03-21 14:23   ` James K. Lowden
  0 siblings, 1 reply; 3+ messages in thread
From: David Malcolm @ 2023-03-20 19:08 UTC (permalink / raw)
  To: Rishi Raj, gcc, mjambor

On Mon, 2023-03-20 at 22:36 +0530, Rishi Raj wrote:
> I am sorry for the previous messed-up reply :(. I was trying to reply
> back
> to my previous mail thread but mistakenly replied to the entire
> digest::((.
> Thanks, David and Martin, for the heads up, and I am sorry for the
> late
> reply due to health issues. Anyways I could emit the warning "hello
> world,
> I am function foo.".  After that, I tried debugging using the` ../gcc
> -wrapper gdb test.c`(gcc binary is in parent folder) but I am getting
> this
> error "gdb: unrecognized option '-dumpdir'
> Use `gdb --help' for a complete list of options.". 

The invocation above should be:

  ../xgcc -B.. -wrapper gdb,--args test.c

in that:
- when building from source, the "driver" binary is normally called
"xgcc" rather than "gcc"
- you're missing "-B PATH_TO_GCC_DIR" so that the "xgcc" driver can
find the cc1 binary
- the wrapper argument is "gdb,--args" so that it adds the option "--
args" to gdb's invocation

Does that fix things?

That said, I normally debug from inside the BUILDDIR/gcc subdirectory,
from which I type:

  ./xgcc -B. ARGS TO GCC   -wrapper gdb,--args


Another way to invoke cc1 under the debugger is to add "-v" to the gcc
invocation to get verbose output, and then see what command-line it
uses to invoke cc1, and then run:

  gdb --args ARGS_OF_CC1_INVOCATION

but I tend to use the former approach.

Hope this is helpful
Dave




> I googled it and got
> this on Bugzilla
> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53195), but
> it has already been fixed. These are the gdb configurations during
> the
> build:
> Using built-in specs.
> COLLECT_GCC=../gcc
> COLLECT_LTO_WRAPPER=gcc-dir/libexec/gcc/x86_64-pc-linux-
> gnu/12.2.1/lto-wrapper
> Target: x86_64-pc-linux-gnu
> Configured with: ../project/configure --prefix=gcc-dir
> --enable-languages=c,c++ --disable-bootstrap
> Thread model: posix
> Supported LTO compression algorithms: zlib zstd
> gcc version 12.2.1 20230302 [OG12] (GCC)
> COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64' '-dumpdir'
> 'a-'
> Can anyone point out how to resolve this or if I am missing something
> during build?
> Thanks and regards
> Rishi Raj


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [GSOC] getting "gdb: unrecognized option '-dumpdir'' while trying to debug gcc using gdb
  2023-03-20 19:08 ` David Malcolm
@ 2023-03-21 14:23   ` James K. Lowden
  0 siblings, 0 replies; 3+ messages in thread
From: James K. Lowden @ 2023-03-21 14:23 UTC (permalink / raw)
  To: gcc

On Mon, 20 Mar 2023 15:08:41 -0400
David Malcolm via Gcc <gcc@gcc.gnu.org> wrote:

> Another way to invoke cc1 under the debugger is to add "-v" to the gcc
> invocation to get verbose output, and then see what command-line it
> uses to invoke cc1, and then run:
> 
>   gdb --args ARGS_OF_CC1_INVOCATION

I find it easiest just to invoke the compiler proper.  

	$ echo $cobol1
	[...]/build/gcc/cobol1

	$ gdb --args $cobol1 -oo  foo.cbl

That sets the compiler driver aside, and lets me work directly on the
compiler.  

Of course, I'm concerned with just one language, and just one
compiler.  If your concern crosses languages, I'd imagine the -wrapper
technique would be easier.  

--jkl


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-21 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 17:06 [GSOC] getting "gdb: unrecognized option '-dumpdir'' while trying to debug gcc using gdb Rishi Raj
2023-03-20 19:08 ` David Malcolm
2023-03-21 14:23   ` James K. Lowden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).