This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/21222] A function with VEX encoded SSE instructions and a particular number of arguments corrupts a value calculated on the stack when stepping through the function


https://sourceware.org/bugzilla/show_bug.cgi?id=21222

--- Comment #19 from Adam Stylinski <kungfujesus06 at gmail dot com> ---
(In reply to Adam Stylinski from comment #18)
> (In reply to Adam Stylinski from comment #17)
> > (In reply to Pedro Alves from comment #16)
> > > (In reply to Adam Stylinski from comment #15)
> > > 
> > > > Sure, can you send me a link to the repo?
> > > 
> > > https://sourceware.org/gdb/current/
> > > 
> > > > Your workaround seems to be correct, so there's a good chance your fix will
> > > > work:
> > > 
> > > Awesome, that's a very good indication indeed.
> > 
> > Hmm, getting a build error:
> > 
> > target-descriptions.c: In member function ‘virtual void
> > print_c_tdesc::visit_pre(const target_desc*)’:
> > target-descriptions.c:1836:16: error: types may not be defined in a
> > for-range-declaration [-Werror]
> >      for (const struct bfd_arch_info *compatible : e->compatible)
> >                 ^~~~~~
> 
> I think I may have fixed this build error, modified the type to be something
> that was already declared as a type (const bfd_arch_info_type*).  My guess
> is at some point this struct was typedef'd to this and meant to be used this
> way.  I'll let you know if this version fixes it.

adam@eggsbenedict ~/scratch/binutils-gdb/gdb $ ./gdb ~/test.out 
Exception caught while booting Guile.
Error in function "open-file":
No such file or directory: "/usr/share/gdb/guile/gdb/boot.scm"
./gdb: warning: Could not complete Guile gdb module initialization from:
/usr/share/gdb/guile/gdb/boot.scm.
Limited Guile support is available.
Suggest passing --data-directory=/path/to/gdb/data-directory.

GNU gdb (GDB) 8.0.50.20171207-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/adam/test.out...done.
(gdb) break testFunc
Breakpoint 1 at 0x400530: file test.cpp, line 12.
(gdb) r
Starting program: /home/adam/test.out 

Breakpoint 1, testFunc (a=0x0, n=0, sx=0x0, sy=0x0, rc=0x0, nr=0, b=4,
f=9.50000026e+09, c=0x0, d=0x0, e=0x0, gx=0x0, gy=0x0, gz=0x0) at test.cpp:12
12          float lambda = C_LIGHT / f;
(gdb) n
13          printf("lambda = %f\n", lambda);
(gdb) 
lambda = 0.031557
14      }
(gdb) n
main () at test.cpp:21
21          return 0;
(gdb) c
Continuing.
[Inferior 1 (process 1119) exited normally]
(gdb) set displaced-stepping on
(gdb) r
Starting program: /home/adam/test.out 

Breakpoint 1, testFunc (a=0x0, n=0, sx=0x0, sy=0x0, rc=0x0, nr=0, b=4,
f=9.50000026e+09, c=0x0, d=0x0, e=0x0, gx=0x0, gy=0x0, gz=0x0) at test.cpp:12
12          float lambda = C_LIGHT / f;
(gdb) n
13          printf("lambda = %f\n", lambda);
(gdb) 
lambda = 0.031557
14      }
(gdb) 
main () at test.cpp:21
21          return 0;
(gdb) c
Continuing.
[Inferior 1 (process 1186) exited normally]

Looks good.

Here's a patch for that build error, though I assume someone will eventually
catch this:

diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 5a6f61945d..363ddf5ac6 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1832,8 +1832,7 @@ public:
           gdbarch_osabi_name (tdesc_osabi (e)));
        printf_unfiltered ("\n");
       }
-
-    for (const struct bfd_arch_info *compatible : e->compatible)
+    for (const bfd_arch_info_type *compatible : e->compatible)
       printf_unfiltered
        ("  tdesc_add_compatible (result, bfd_scan_arch (\"%s\"));\n",
         compatible->printable_name);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]