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

Reply via email to