amccarth created this revision.
amccarth added a reviewer: tfiala.
amccarth added a subscriber: lldb-commits.
Herald added a subscriber: aemerson.

32-bit Windows calling conventions, by default, don't pass arguments in 
registers, but this test expects at least one of them to be.

By adding __attribute__((regparm(x))) to the functions, we can get the compiler 
to enregister some of the parameters, and the test passes.

I don't think this should have a negative impact on other platforms, but I 
haven't tried.

http://reviews.llvm.org/D19548

Files:
  packages/Python/lldbsuite/test/lang/c/register_variables/test.c

Index: packages/Python/lldbsuite/test/lang/c/register_variables/test.c
===================================================================
--- packages/Python/lldbsuite/test/lang/c/register_variables/test.c
+++ packages/Python/lldbsuite/test/lang/c/register_variables/test.c
@@ -5,20 +5,20 @@
   int m2;
 };
 
-void f1(int a, struct bar *b) __attribute__ ((noinline));
+void f1(int a, struct bar *b) __attribute__((noinline)) 
__attribute__((regparm(2)));
 void f1(int a, struct bar *b)
 {
   b->m2 = b->m1 + a; // set breakpoint here
 }
 
-void f2(struct bar *b) __attribute__ ((noinline));
+void f2(struct bar *b) __attribute__((noinline)) __attribute__((regparm(1)));
 void f2(struct bar *b)
 {
   int c = b->m2;
   printf("%d\n", c); // set breakpoint here
 }
 
-float f3() __attribute__ ((noinline));
+float f3() __attribute__((noinline));
 float f3() {
   return 3.14f;
 }


Index: packages/Python/lldbsuite/test/lang/c/register_variables/test.c
===================================================================
--- packages/Python/lldbsuite/test/lang/c/register_variables/test.c
+++ packages/Python/lldbsuite/test/lang/c/register_variables/test.c
@@ -5,20 +5,20 @@
   int m2;
 };
 
-void f1(int a, struct bar *b) __attribute__ ((noinline));
+void f1(int a, struct bar *b) __attribute__((noinline)) __attribute__((regparm(2)));
 void f1(int a, struct bar *b)
 {
   b->m2 = b->m1 + a; // set breakpoint here
 }
 
-void f2(struct bar *b) __attribute__ ((noinline));
+void f2(struct bar *b) __attribute__((noinline)) __attribute__((regparm(1)));
 void f2(struct bar *b)
 {
   int c = b->m2;
   printf("%d\n", c); // set breakpoint here
 }
 
-float f3() __attribute__ ((noinline));
+float f3() __attribute__((noinline));
 float f3() {
   return 3.14f;
 }
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to