I wrote a bash script to reproduce this bug - please find it attached.
I snipped the i_chunk_stream classes from my SourceForge project http://sourceforge.net/projects/v3c.
For some reason gdb insists on a final <ENTER> from the keyboard before it quits even though it's run
from a script. To get around this and to compare your output to mine, run the script as ./dbgtest.sh </dev/null > dbgtest-cmp.txt Here's my output from this test.You will see source file and line numbers from dbgtest.cpp in the stack trace but not from the standard library.
### Listing installed packages matching libstdc++6* ii libstdc++6 4.3.2-1.1 The GNU Standard C++ Library v3 ii libstdc++6-4.3-dbg 4.3.2-1.1 The GNU Standard C++ Library v3 (debugging f ii libstdc++6-4.3-dev 4.3.2-1.1 The GNU Standard C++ Library v3 (development ii libstdc++6-4.3-doc 4.3.2-1.1 The GNU Standard C++ Library v3 (documentati ### Writing dbgtest.cpp ### Compiling/linking dbgtest.cpp with debugging information ### Listing libraries dbgtest links with. linux-vdso.so.1 => (0x00007fff63bff000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f115b501000) libm.so.6 => /lib/libm.so.6 (0x00007f115b27e000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f115b067000) libc.so.6 => /lib/libc.so.6 (0x00007f115ad14000) /lib64/ld-linux-x86-64.so.2 (0x00007f115b80d000) ### Running dbgtest with gdb - press <ENTER> to finish... ~"GNU gdb 6.8-debian\n" ~"Copyright (C) 2008 Free Software Foundation, Inc.\n"~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"~"There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\n"
~"and \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-linux-gnu\"...\n" (gdb) &"break i_chunk_streambuf::underflow()\n" ~"Breakpoint 1 at 0x401b82: file dbgtest.cpp, line 23.\n" ^done (gdb) &"run\n" ~"Starting program: /v3c/dev/bugs/Debian/dbgtest \n" ~"\n"~"Breakpoint 1, i_chunk_streambuf::underflow (this=0x7fff8dfba270) at dbgtest.cpp:23\n"
~"23\t\t\tcout << \"underflow() called.\" << endl;\n" ^done (gdb) &"bt\n"~"#0 i_chunk_streambuf::underflow (this=0x7fff8dfba270) at dbgtest.cpp:23\n" ~"#1 0x00007f6185b1f02c in std::num_get<char, std::istreambuf_iterator<char, std::char_traits<char> > >::_M_extract_int<long> () from /usr/lib/libstdc++.so.6\n" ~"#2 0x00007f6185b1f270 in std::num_get<char, std::istreambuf_iterator<char, std::char_traits<char> > >::do_get () from /usr/lib/libstdc++.so.6\n" ~"#3 0x00007f6185b0ded1 in std::istream::_M_extract<long> () from /usr/lib/libstdc++.so.6\n" ~"#4 0x00007f6185b0dfae in std::istream::operator>> () from /usr/lib/libstdc++.so.6\n"
~"#5 0x00000000004018e9 in test2 () at dbgtest.cpp:64\n"~"#6 0x0000000000401a57 in main (argc=1, argv=0x7fff8dfba4e8) at dbgtest.cpp:82\n"
^done (gdb) &"c\n" ~"Continuing.\n" underflow() called. Success! ~"\n" ~"Program exited normally.\n" ^done (gdb) ^exit ### Done.
dbgtest.sh
Description: Bourne shell script