This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

debugging info for inlines



Hi,

I think that the debugging information for inline functions should be less
clever that it is, and should refer to the caller rather than the callee.

This is because the callee is often a short, well understood function,
(e.g. operator[])
while the caller is big and complex.  For example, if "operator[]"
segfaults in this code:
      
      void complex_function()
      {
      	...  stuff ...
      	x[1] = 1; // Call to inlined operator[]
      	...  stuff ...
      }
      
Then gdb stops with

     0x1761c in complex_function () at /tmp/t.cc:8
     8         *p = 1;  // This is a line in inlined operator[]

and we have no idea which call to this operator[] in complex_function 
caused the segv.   IMHO, it would be more useful if it said:

     0x1761c in complex_function () at /tmp/t.cc:8
     12        x[1] = 1;

A.

Real code that illustrates the problem:

egcs -g -finline-functions -O /tmp/t.cc
gdb a.out
run

#include <iostream.h>
#include <stdlib.h>

inline void inlined_function()
{
  volatile int* p = 0;
  *p = 1;
}

void complex_function();

main()
{
  complex_function();
}

void complex_function()
{
  cerr << "blah";
  inlined_function();
  sqrt(9);
}


-- 
Andrew Fitzgibbon, 			                  awf@robots.ox.ac.uk
Robotics Research Group, University of Oxford                +44 01865 273127
	    <a href=http://www.robots.ox.ac.uk/~awf> Home Page </a>
			 "Never say there is no way"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]