Closed GoogleCodeExporter closed 9 years ago
I can't reproduce this in either case. (I'm on OS X instead of Windows, so it's
possible that's the source of the difference.)
Could you be more specific about what it means to "blow up" or "break"? Does it
throw an exception? Does it segfault? If it segfaults, could you give a stack
trace?
Thanks!
Original comment by jbe...@gmail.com
on 13 Nov 2012 at 12:20
I will build up a more complete report today. Thanks for the quick response.
Original comment by JohnMich...@gmail.com
on 13 Nov 2012 at 9:43
Windows 7x64
Build VS2010-latest x64-only build, debug mode optimizations turned off
Here is how I parse
.
.
std::ifstream fin(buildFilenamePath(m_shortName).toStdString());
if( fin.fail() )
{
return false;
}
YAML::Parser parser(fin);
fin.close();
YAML::Node doc;
parser.GetNextDocument(doc);
.
.
I have attached two yaml files, one which will GetNextDocument without failing,
but then actually in my parser the call to
if(const YAML::Node *pName = doc.FindValue("myKey"))
for at least one of the keys towards the end of the file fails and says it
wasn't found. If I remove data and shrink the file to all 4-element containers
everything works perfectly.
The other file i'm attaching actually makes the parser choke and die on
GetNextDocument with the below output and stacktrace
Output:
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: YAML::ParserException at memory location 0x07f09720..
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: YAML::ParserException at memory location 0x07f09720..
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: YAML::ParserException at memory location 0x07f09720..
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: YAML::ParserException at memory location 0x07f09720..
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x000007fefdffcaed in declipse.exe: Microsoft C++
exception: YAML::ParserException at memory location 0x07f09720..
Unhandled exception at 0x000007fefdffcaed in myExe.exe: Microsoft C++
exception: YAML::ParserException at memory location 0x07f09720..
Stack Trace (not very useful even with the mdd library and symbols available)
KernelBase.dll!000007fefdffcaed()
[Frames below may be incorrect and/or missing, no symbols loaded for
KernelBase.dll]
msvcr100d.dll!__CxxCallCatchBlock() + 0x273 bytes
msvcr100d.dll!__CxxCallCatchBlock() + 0x176 bytes
ntdll.dll!RcFrameConsolidation() + 0x3 bytes
QtCored4.dll!000000005903fde9()
QtCored4.dll!0000000058e8a3f5()
myExe.exe!InputDevice::run() Line 268 + 0xe bytes C++
QtCored4.dll!0000000058e8f1a6()
msvcr100d.dll!_beginthreadex() + 0x2d5 bytes
msvcr100d.dll!_beginthreadex() + 0x294 bytes
kernel32.dll!00000000776a652d()
ntdll.dll!RtlUserThreadStart() + 0x21 bytes
In performing the test this time I got the latest from old-api hg branch (the
original bug report was filed against the 0.3.0 as packaged on the website). I
then build the library using CMake (cmake-gui) using
APPLE_UNIVERSAL_BIN 0
BUILD_SHARED_LIBS 0
CMAKE_INSTALL_PREFIX C:/Program Files/YAML_CPP
MSVC_SHARED_RT 1
MSVC_STHREADED_RT 0
YAML_CPP_BUILD_CONTRIB 1
YAML_CPP_BUILD_TOOLS 1
Then click configure and then generate using "Visual Studio 10 Win64". Open
the generated MSVC 2010 solution and Rebuild Solution in both release and debug
mode. Copy .lib's into place and update config files to link debug or release
builds accordingly. Copy yaml-cpp/include+src+etc... into my thirdparty
directory and set projects to include the yaml-cpp/include/yaml-cpp/ folder.
Original comment by JohnMich...@gmail.com
on 13 Nov 2012 at 10:15
Attachments:
To be even more explicit, the key which isn't found on the silent_death example
is the energyWindowPairs key (and its values).
Original comment by JohnMich...@gmail.com
on 13 Nov 2012 at 10:19
OK, realized I could actually catch the exception, duh. Here is what I'm
seeing, although I don't agree with its error message.
This comes from the loud_fail file
e {mark={...} msg="end of sequence flow not found" } YAML::Exception
std::runtime_error {...} std::runtime_error
std::exception {_Mywhat=0x0000000006be6cc0 "yaml-cpp: error at line 16, column 1: end of sequence flow not found" _Mydofree=true } std::exception
__vfptr 0x000000013f857be0 const YAML::Exception::`vftable' *
[0] 0x000000013f18e1d0 YAML::Exception::`scalar deleting destructor'(unsigned int) *
[1] 0x000000013f1ecef2 std::exception::what *
_Mywhat 0x0000000006be6cc0 "yaml-cpp: error at line 16, column 1: end of sequence flow not found" const char *
121 'y' const char
_Mydofree true bool
mark {pos=2048 line=15 column=0 } YAML::Mark
msg "end of sequence flow not found" std::basic_string<char,std::char_traits<char>,std::allocator<char> >
Original comment by JohnMich...@gmail.com
on 13 Nov 2012 at 10:31
It looks like you're closing the stream before you parse the document:
YAML::Parser parser(fin);
fin.close();
YAML::Node doc;
parser.GetNextDocument(doc);
The parser reads from the stream lazily, so my guess is that what's happening
is that the stream has buffered some of the input, which the parser reads, but
not all of it, so it's crashing at that point.
Try to remove the fin.close() line.
Original comment by jbe...@gmail.com
on 13 Nov 2012 at 3:08
Thanks will give that a try.
Original comment by JohnMich...@gmail.com
on 15 Nov 2012 at 6:20
If this didn't work for you, please let me know so I can reopen this issue.
Original comment by jbe...@gmail.com
on 27 Nov 2012 at 2:11
Original issue reported on code.google.com by
JohnMich...@gmail.com
on 12 Nov 2012 at 3:05