Problem calling functions within gdb (version 7.5)

Saurabh T saurabh@hotmail.com
Wed Apr 24 21:30:00 GMT 2013


Here's a simple C++ example:
 
#include <stdio.h>
 
void fn(int n, const double (*x)[3])
{
  for (int i=0; i < n; i++)
    printf("%g %g %g\n", x[i][0], x[i][1], x[i][2]);
}
 
void fn2(int *k)
{ printf("%d\n", *k); }
 
int main()
{
  int n = 3;
  const double x[3][3] = {{1, 2, 3}, {3, 4, 5}, {5, 6, 7}};
  fn(3, x);
  int *k = &n;
  fn2(k);
  return 0;
}
 
In gdb, if you put a breakpoint at the return 0 line, run until there, and say:
 
1. call fn(3, x)
gdb says: Cannot resolve function fn to any overloaded instance
This used to work with gdb 7.2. The function signature completely matches the arguments so I dont know what it's complaining about.
 
2. print k
Let's say this prints 0x7ffb24
call fn2(0x7ffb24)
gdb again says: Cannot resolve function fn2 to any overloaded instance
This also used to work with gdb 7.2. Here I can understand if promoting ints to arbitrary pointers is no longer supported.
 
Any thoughts as to whether these are bugs, or how I can get the behaviour I want at least wrt case 1?
 
Thanks. 		 	   		  


More information about the Gdb mailing list