debug/1621: Debugging with complex numbers

Joseph S. Myers jsm28@cam.ac.uk
Thu Dec 5 15:24:00 GMT 2002


On 5 Dec 2002 bangerth@dealii.org wrote:

>     Joseph, this report is now almost 2 years old, and versions
>     3.0 and 3.1/2 have happened in between. Unfortunately, there
>     are no testcases in the report, so I can't check the claims
>     myself, but do you know whether the situation has or has
>     not improved in the meantime?

The testcase is at the URL given in the report 
<http://gcc.gnu.org/ml/gcc/2000-12/msg00536.html>:

        static __complex__ double x = 2.0 + 3.0i;
        int main(void)
        {
          return 0;
        }

(gdb) p x
$1 = Invalid C/C++ type code 20 in symbol table.
(gdb) p x$real
No symbol "x$real" in current context.
(gdb) p x$imag
No symbol "x$imag" in current context.
(gdb) quit

You'll also want to try a testcase with automatic variables:

	int main(void)
	{
	  __complex__double x = 2.0 + 3.0i;
	  return 0;
	}

Both testcases should be tried with both stabs and DWARF2 debugging.  The 
key part is that accessing the variable as a whole from GDB ought to work; 
if that works in all four cases, then the manual need no longer refer to 
"A future version of GDB", just say that GDB can handle debugging complex 
numbers (possibly keeping the description of what's done with stabs as 
information about the internals rather than the user interface).

Some of the problem, if still there, may be a GDB problem, some may be a
GCC problem.  But as long as the manual is making claims about what GDB
will do in future, the presence of such claims in the manual is a GCC
problem unless there's some reason to suppose them to be accurate.

(DWARF3 has support for complex floating point numbers, but not complex
integers which aren't in C99.  I don't really care about debugging for
complex integers in any case, which have other known problems (division of
complex integers doesn't work sensibly in GCC).)

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-bugs mailing list