emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug Database?


From: Frank Schmitt
Subject: Re: Bug Database?
Date: Thu, 19 Oct 2006 13:46:35 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Nick Roberts <address@hidden> writes:

>  > So most C++ developers I know have switched to the "free as in free beer
>  > but not free as in free software" debugger from Sun Studio which in
>  > contrast to gdb works really well.
>
> People can choose not to fix GDB, it's a voluntary project.

First for those who have no idea about what we are talking about: In C++
you can write something like

-----------------------------------------------------------------------------
template <typename imgtype1, typename imgtype2>
void doSomething(imgtype1* img1, imgtype2* img2){
  //do something with image img1 and image img2 which can both be either
  //8 or 16 bits per pixel
}

int main(){
  unsigned char* image1 = getRawImageData1();
  int bpp1 = getBitsPerPixel1();
  unsigned char* image2 = getRawImageData2():
  int bpp2 = getBitsPerPixel2();
  if (bpp1==8 && bpp2==8)
     doSomething<unsigned char, unsigned char>(image1, image2);
  if (bpp1==8 && bpp2==16)
     doSomething<unsigned char, unsigned short>(image1, (unsigned 
short*)image2);
  if (bpp1==16 && bpp2==8)
     doSomething<unsigned short, unsigned char>((unsigned short*)image1, 
image2);
  if (bpp1==16 && bpp2==16)
     doSomething<unsigned short, unsigned short>((unsigned short*)image1, 
(unsigned short*)image2);
}
-----------------------------------------------------------------------------

If you compile this, four instances of the function doSomething are
generated, in each imgtype1 and imgtype2 is substituted with a real data
type. If you now start the program in gdb and say "break doSomething",
the breakpoint will always be set at the first instance of the function
which gdb finds. If this isn't the instance your program is just using,
you can't debug the function. (Ok, there are some tricks, but even if
you managed to set the breakpoint correctly there's still reakage in
e.g. "until".)

So basically what had to be done is: If you make the lookup between line
in source code and offset in object code, look if you are in a templated
function, if yes search for all matching offsets in object code instead
of only the first one. I looked at the code and while I wasn't able to
do the fix myself, I think for someone who knows gdb's internal, the fix
wouldn't be much work.

If gdb had a leader who said "we don't ship broken code", gdb developers
would be at annoyed because their favorite new feature of which they are
proud and fond isn't released to the public and would eventually sit
down and fix it, just as it happens in Emacs.

-- 
Did you ever realize how much text fits in eighty columns? If you now consider
that a signature usually consists of up to four lines, this gives you enough
space to spread a tremendous amount of information with your messages. So seize
this opportunity and don't waste your signature with bullshit nobody will read.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]