public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32
@ 2021-03-18 15:57 filip.bascarevic at siemens dot com
  2021-03-18 16:04 ` [Bug c/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: filip.bascarevic at siemens dot com @ 2021-03-18 15:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99649

            Bug ID: 99649
           Summary: GDB has issue to show backtrace if the breakpoint is
                    in a function with more then 8 parameters only in
                    target aarch64-elf ILP32
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filip.bascarevic at siemens dot com
  Target Milestone: ---
              Host: x86_64-w64-mingw32
            Target: aarch64-elf ilp32

Created attachment 50422
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50422&action=edit
This is a small example that demonstrates the bug. Content is just start.c
start.S and start.lk and also scripts which will help you build the example.
This example doesn't contain any include.

Dear GCC team,

the Siemens developers noticed one issue in a GCC 10.2 and we don't know how to
deal with it. It occurs only for an aarch64 ilp32 target. Generally when we put
a breakpoint into function with more the 8 arguments then GDB has a problem
showing backtrace. To be exact, the last function is shown in an endless loop
unless GDB is forced to quit or the backtrace limit is set.  

I’ve created a small example to reproduce this problem with Qemu (4.1) and GCC
10.2 toolchain. Inside the package, there is a ‘readme.txt’ file with
instructions on how to build, start Qemu and GDB (with GDB commands) to
demonstrate the problem. The interesting fact is that if you use LP64 ABI than
this problem does not occur. Because it is working on LP64, I don't think the
issue is in the GDB.

NOTES:
1. This example is compiled on Windows 10 using aarch64_elf compiler for
Windows. It contains only one simple .c and one .S file. To successfully
compile it please change a PATH of the toolchain and QEMU directory at the
beginning of the script build_and_run_qemu.cmd.
2. Also update a path of the GDB at the beginning of the run_gdb.cmd script.
3. As I mentioned above, we compiled that example with aarch64_elf compiler on
Windows 10. Because this ILP32 target is really specific, we built our
toolchain with MinGW using this command: 

$SRCDIR/configure --host=x86_64-w64-mingw32  --build=x86_64-w64-mingw32 
--prefix=$prefix --target=aarch64-elf --disable-nls --enable-multilib
--with-multilib-list=lp64,ilp32 --enable-languages=c,c++
--disable-decimal-float --with-sysroot=$prefix --without-headers
--disable-shared --disable-threads --disable-lto --disable-libmudflap
--disable-libssp --disable-libgomp --disable-libffi --disable-libstdcxx-pch
--disable-win32-registry '--with-host-libstdcxx=-static-libgcc
-Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-newlib --with-gcc --with-gnu-as
--with-gnu-ld --with-gmp=$prefixlocal --with-mpfr=$prefixlocal
--with-mpc=$prefixlocal --with-isl=$prefixlocal --with-zstd=$prefixlocal ||
return $ECONFIGURE

Please let me know if I can assist any further. I am so sorry because I didn't
upload the preprocessed file (*.i*) because this is not a common bug and for my
understanding test example is more useful in this case.

With best regards,
MSc. Filip Bascarevic

Siemens, s.r.o.
ADV D EU CZ AE AC 4
Anglicke nabrezi 2434/1
301 00 Plzen, Czech Republic 
filip.bascarevic@siemens.com

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

* [Bug c/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for target aarch64-elf ILP32
  2021-03-18 15:57 [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32 filip.bascarevic at siemens dot com
@ 2021-03-18 16:04 ` pinskia at gcc dot gnu.org
  2021-03-18 16:23 ` filip.bascarevic at siemens dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-03-18 16:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99649

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Gdb support for ilp32 has never been committed so I dont see how you are using
it.

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

* [Bug c/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for target aarch64-elf ILP32
  2021-03-18 15:57 [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32 filip.bascarevic at siemens dot com
  2021-03-18 16:04 ` [Bug c/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for " pinskia at gcc dot gnu.org
@ 2021-03-18 16:23 ` filip.bascarevic at siemens dot com
  2021-03-19  7:41 ` [Bug target/99649] " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: filip.bascarevic at siemens dot com @ 2021-03-18 16:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99649

--- Comment #2 from Filip Bascarevic <filip.bascarevic at siemens dot com> ---
Hello Andre,
thank you so much for your quick reply. I also noticed that but somehow with
GCC 8.1 and GDB 8.1 this example works, no GDB endless loop with showing us
backtrace.

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

* [Bug target/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for target aarch64-elf ILP32
  2021-03-18 15:57 [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32 filip.bascarevic at siemens dot com
  2021-03-18 16:04 ` [Bug c/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for " pinskia at gcc dot gnu.org
  2021-03-18 16:23 ` filip.bascarevic at siemens dot com
@ 2021-03-19  7:41 ` rguenth at gcc dot gnu.org
  2021-03-22 13:40 ` filip.bascarevic at siemens dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-19  7:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99649

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It sounds like this should be a bug for gdb.

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

* [Bug target/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for target aarch64-elf ILP32
  2021-03-18 15:57 [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32 filip.bascarevic at siemens dot com
                   ` (2 preceding siblings ...)
  2021-03-19  7:41 ` [Bug target/99649] " rguenth at gcc dot gnu.org
@ 2021-03-22 13:40 ` filip.bascarevic at siemens dot com
  2021-05-07  7:28 ` stanislav.simek at siemens dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: filip.bascarevic at siemens dot com @ 2021-03-22 13:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99649

--- Comment #4 from Filip Bascarevic <filip.bascarevic at siemens dot com> ---
Thank you so much for your replies. I also contacted the GDB community and will
see what will they reply

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

* [Bug target/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for target aarch64-elf ILP32
  2021-03-18 15:57 [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32 filip.bascarevic at siemens dot com
                   ` (3 preceding siblings ...)
  2021-03-22 13:40 ` filip.bascarevic at siemens dot com
@ 2021-05-07  7:28 ` stanislav.simek at siemens dot com
  2021-05-07  7:43 ` stanislav.simek at siemens dot com
  2021-05-14  7:46 ` stanislav.simek at siemens dot com
  6 siblings, 0 replies; 8+ messages in thread
From: stanislav.simek at siemens dot com @ 2021-05-07  7:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99649

Stanislav Šimek <stanislav.simek at siemens dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stanislav.simek at siemens dot com

--- Comment #5 from Stanislav Šimek <stanislav.simek at siemens dot com> ---
Hi all,
I would like to add more information for this topic:

This error occurs in case that your function, call the function that has more
than 8 params.

Eq.
int sum(int x1,int x2 int x3,int x4,int x5,int x6,int x7,int x8,int x9 ); 

int test(int input1 ) 
{
  int c = 0;

  if(input1 == 2) // <- If you have breakpoint here, callstack is corrupted
  {
    c +=input1;
  }

  c =sum(1,2,3,4,5,6,7,c,input1);
  return c;
}


If you remove the call of sum function, then everything works.
If you optimize function " int test(int) " with O0,O1 and O3, it works
Only for O2 this problem occurs.

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

* [Bug target/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for target aarch64-elf ILP32
  2021-03-18 15:57 [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32 filip.bascarevic at siemens dot com
                   ` (4 preceding siblings ...)
  2021-05-07  7:28 ` stanislav.simek at siemens dot com
@ 2021-05-07  7:43 ` stanislav.simek at siemens dot com
  2021-05-14  7:46 ` stanislav.simek at siemens dot com
  6 siblings, 0 replies; 8+ messages in thread
From: stanislav.simek at siemens dot com @ 2021-05-07  7:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99649

--- Comment #6 from Stanislav Šimek <stanislav.simek at siemens dot com> ---
So isn't it gcc problem?

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

* [Bug target/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for target aarch64-elf ILP32
  2021-03-18 15:57 [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32 filip.bascarevic at siemens dot com
                   ` (5 preceding siblings ...)
  2021-05-07  7:43 ` stanislav.simek at siemens dot com
@ 2021-05-14  7:46 ` stanislav.simek at siemens dot com
  6 siblings, 0 replies; 8+ messages in thread
From: stanislav.simek at siemens dot com @ 2021-05-14  7:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99649

--- Comment #7 from Stanislav Šimek <stanislav.simek at siemens dot com> ---
(In reply to Richard Biener from comment #3)
> It sounds like this should be a bug for gdb.


Hi all,
I would like to add more information for this topic:

This error occurs in case that your function, call the function that has more
than 8 params.

Eq.
int sum(int x1,int x2 int x3,int x4,int x5,int x6,int x7,int x8,int x9 ); 

int test(int input1 ) 
{
  int c = 0;

  if(input1 == 2) // <- If you have breakpoint here, callstack is corrupted
  {
    c +=input1;
  }

  c =sum(1,2,3,4,5,6,7,c,input1);
  return c;
}


If you remove the call of sum function, then everything works.
If you optimize function " int test(int) " with O0,O1 and O3, it works
Only for O2 this problem occurs.

So isn't it gcc problem?

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

end of thread, other threads:[~2021-05-14  7:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 15:57 [Bug c/99649] New: GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters only in target aarch64-elf ILP32 filip.bascarevic at siemens dot com
2021-03-18 16:04 ` [Bug c/99649] GDB has issue to show backtrace if the breakpoint is in a function with more then 8 parameters - only for " pinskia at gcc dot gnu.org
2021-03-18 16:23 ` filip.bascarevic at siemens dot com
2021-03-19  7:41 ` [Bug target/99649] " rguenth at gcc dot gnu.org
2021-03-22 13:40 ` filip.bascarevic at siemens dot com
2021-05-07  7:28 ` stanislav.simek at siemens dot com
2021-05-07  7:43 ` stanislav.simek at siemens dot com
2021-05-14  7:46 ` stanislav.simek at siemens dot com

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).