This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/15559] Method call and calling convention
- From: "asmwarrior at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sat, 05 Oct 2013 14:32:40 +0000
- Subject: [Bug c++/15559] Method call and calling convention
- Auto-submitted: auto-generated
- References: <bug-15559-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=15559
asmwarrior <asmwarrior at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |asmwarrior at gmail dot com
--- Comment #1 from asmwarrior <asmwarrior at gmail dot com> ---
It is very simple to reproduce this bug:
Test code: (build under GCC 4.7.x or GCC 4.8.x)
#include <string>
#include <vector>
int fff()
{
return 3;
}
int main()
{
std::vector<std::string> v;
v.push_back("a");
v.push_back("b");
std::string abc = v[0];
abc.c_str();
abc.size();
int i = v.size();
i++;
i = fff();
return 0;
}
When debugging, you set a bp in the last line:
p v.size() will have such report:
GDB has restored the context to what it was before the call.
To change this behavior use "set unwindonsignal off".
Evaluation of the expression containing the function
(std::vector<std::string, std::allocator<std::string> >::size() const) will be
abandoned.
Program received signal SIGSEGV, Segmentation fault.
p fff() works OK.
This is because std::string::size() is a __thiscall call, but fff() is a
__cdecl calling convention.
--
You are receiving this mail because:
You are on the CC list for the bug.