This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
[PATCH] gdb.base/pointers.c commit
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH] gdb.base/pointers.c commit
- From: Kevin Buettner <kevinb at cygnus dot com>
- Date: Tue, 21 Mar 2000 16:07:18 -0700
I've just committed the change below. (This change was for AIX 4.3.)
* gdb.base/pointers.c (usevar): New function.
(main): Make sure that global variables v_int_pointer2, rptr,
and y are all referenced someplace in the program by calling
usevar() on them. [Some linkers delete symbols which are
never referenced. The space remains, but there's no way to
get a (symbolic) handle on the variable from the debugger.]
Index: gdb.base/pointers.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/pointers.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 pointers.c
--- pointers.c 1999/08/02 23:46:51 1.1.1.3
+++ pointers.c 2000/03/21 22:59:17
@@ -71,35 +71,28 @@ float ** ptr_to_ptr_to_float;
int y;
+/* Do nothing function used for forcing some of the above variables to
+ be referenced by the program source. If the variables are not
+ referenced, some linkers will remove the symbol from the symbol
+ table making it impossible to refer to the variable in gdb. */
+void usevar (void *var) {}
+
int main ()
{
- void dummy();
- int more_code();
-
- /* Ensure that malloc is a pointer type; avoid use of "void" and any include files. */
- /* extern char *malloc();*/
-
- /* void *malloc(size_t);*/
-
-
-
+ void dummy();
+ int more_code();
+
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
dummy();
-/* v_int_pointer2 = &v_int_pointer;
- v_unsigned_int_pointer = &v_int;
-
- y = (v_unsigned_int_pointer == v_double_pointer);
-
- x = v_unsigned_int_pointer * v_double_pointer;
-
- v_unsigned_int_pointer = v_double_pointer;
-
- v_unsigned_int_pointer = v_unsigned_int;*/
more_code ();
+
+ usevar (&v_int_pointer2);
+ usevar (&rptr);
+ usevar (&y);
return 0;