[v3,1/8] gdb/testsuite: Add Windows replacement for aligned_alloc
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
Commit Message
_aligned_malloc has swapped arguments, and you have to use _aligned_free
to free the memory afterwards.
This is enough to make i386-sse.exp pass, and i386-avx.exp will pass at
the end of this series.
Approved-By: Tom Tromey <tom@tromey.com>
---
v2:
- Mention which test pass after the change in the commit message
v3: no changes
---
gdb/testsuite/gdb.arch/i386-avx.c | 2 +-
gdb/testsuite/gdb.arch/i386-sse.c | 2 +-
gdb/testsuite/lib/precise-aligned-alloc.c | 20 ++++++++++++++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
@@ -116,7 +116,7 @@ main (int argc, char **argv)
puts ("Bye!"); /* second breakpoint here */
- free (allocated_ptr);
+ aligned_free (allocated_ptr);
return 0;
}
@@ -134,7 +134,7 @@ main (int argc, char **argv)
puts ("Bye!"); /* second breakpoint here */
}
- free (allocated_ptr);
+ aligned_free (allocated_ptr);
return 0;
}
@@ -21,6 +21,26 @@
#include <string.h>
#include <stdint.h>
+#ifdef _WIN32
+static void *
+aligned_alloc (size_t alignment, size_t size)
+{
+ return _aligned_malloc (size, alignment);
+}
+
+static void
+aligned_free (void *ptr)
+{
+ _aligned_free (ptr);
+}
+#else
+static void
+aligned_free (void *ptr)
+{
+ free (ptr);
+}
+#endif
+
/* Return true if address P is ALIGNMENT-byte aligned. */
static int