![]() |
|
Some GDB peculiarities |
weapon_S
Member #7,859
October 2006
![]() |
Care to help me out? Thanks in advance. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
as for errno, try including errno.h or for c++, cerrno. its a libc thing. not sure about the std::list thing. but have you actually included std::list's header? -- |
weapon_S
Member #7,859
October 2006
![]() |
Ok, I tried including <cerrno>, but it still gives the same message. Thus I just dropped some johnny = &errno in. And now it appears it is becoming ERANGE inside a call to rotated_sprite. So time to install and link to a debug version of allegro, I guess... |
ReyBrujo
Moderator
January 2001
![]() |
Try to compile with -ggdb3 instead. I am not sure you can call templates themselves, since they don't exist, they just turn into compile code (it is not as if you are calling a function). As for the errno number, just check the code to see which numbers you are passing to the function -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
ReyBrujo said: Try to compile with -ggdb3 instead. I am not sure you can call templates themselves, since they don't exist, they just turn into compile code (it is not as if you are calling a function). He's calling the size method on a std::list variable he has going. It should be working, I'm not sure why it isn't. -- |
ReyBrujo
Moderator
January 2001
![]() |
As far as I know, size() is inlined, so you can't call it. (Edited: #include <list> int main() { std::list<int>i; i.push_back(1); i.push_back(2); i.push_back(3); return 0; } gives reybrujo@ansalon:~$ gdb test GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu"... (gdb) b main Breakpoint 1 at 0x8048607: file test.cc, line 4. (gdb) r Starting program: /home/reybrujo/test Breakpoint 1, main () at test.cc:4 4 std::list<int>i; (gdb) n 6 i.push_back(1); (gdb) 7 i.push_back(2); (gdb) p i.size Cannot take address of method size. (gdb) p i.size() Cannot evaluate function -- may be inlined (gdb) I remember having wondered once why I couldn't access template members) -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Oh.. Doh. I totally misread the problem. Again. Yeah, thats the reason its not working. -- |
weapon_S
Member #7,859
October 2006
![]() |
My current gcc version supports -ggdb3, but my gdb version barfs on it. ReyBrujo said: just check the code to see which numbers you are passing to the function I did |
Thomas Fjellstrom
Member #476
June 2000
![]() |
weapon_S said: Couldn't I override the inline, by defining a function pointer? You can recompile your code to not do ANY inlining. Otherwise no you can't override it in gdb as its basically copy+paste'ed into the surrounding code. There is no function once it's been inlined. -- |
|