Advertisement

sending and receiving struct using eNet and boost.serialization

Started by April 30, 2016 07:19 AM
11 comments, last by brightening-eyes 8 years, 6 months ago

hi again,
thanks for helps
again, i've fixed the error and another exception that i don't know where this occurs:

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: F:\projects\cpp\missiontime\
Adding source dir: F:\projects\cpp\missiontime\
Adding file: F:\projects\cpp\missiontime\bin\Debug\missiontime.exe
Changing directory to: F:/projects/cpp/missiontime/bin/Debug
Set variable: PATH=.;C:\Dev-Cpp\bin;C:\Dev-Cpp;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Skype\Phone;C:\Program Files\CMake\bin;C:\Program Files\Heroku\bin;C:\Program Files\Git\cmd;C:\php;C:\ProgramData\ComposerSetup\bin;C:\Users\brightening-eyes\AppData\Roaming\Composer\vendor\bin

[debug]Command-line: C:\Dev-Cpp\bin\gdb.exe -fullname -quiet  -args F:/projects/cpp/missiontime/bin/Debug/missiontime.exe
[debug]Working dir : F:\projects\cpp\missiontime\bin\Debug

Starting debugger: C:\Dev-Cpp\bin\gdb.exe -fullname -quiet  -args F:/projects/cpp/missiontime/bin/Debug/missiontime.exe
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Reading symbols from F:/projects/cpp/missiontime/bin/Debug/missiontime.exe...
[debug]done.
[debug](gdb)
[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.10.1
[debug]Copyright (C) 2015 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "i686-w64-mingw32".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) 7.10.1

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Program Files\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory F:/projects/cpp/missiontime/
[debug]Source directories searched: F:/projects/cpp/missiontime;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: F:\projects\cpp\missiontime\bin\Debug\missiontime.exe

Child process PID: 25368

[debug][New Thread 25368.0x61dc]
[debug][New Thread 25368.0x642c]
[debug][New Thread 25368.0x65f4]
[debug][New Thread 25368.0x64e4]
[debug][New Thread 25368.0x66a8]
[debug][New Thread 25368.0x6354]
[debug][New Thread 25368.0x67ec]
[debug][New Thread 25368.0x63dc]
[debug][New Thread 25368.0x6680]
[debug][New Thread 25368.0x6428]
[debug][New Thread 25368.0x60c8]
[debug][New Thread 25368.0x6008]
[debug][New Thread 25368.0x6660]
[debug][Thread 25368.0x6660 exited with code 0]
[debug][Thread 25368.0x6008 exited with code 0]
[debug][New Thread 25368.0x6388]
[debug][New Thread 25368.0x628c]
[debug][Thread 25368.0x6388 exited with code 0]
[debug][Thread 25368.0x628c exited with code 0]
[debug][New Thread 25368.0x67dc]
[debug]Catchpoint 1 (exception thrown), 0x006069a0 in __cxa_throw ()
[debug]>>>>>>cb_gdb:

In __cxa_throw () ()

[debug]> bt 30
[debug]#0  0x006069a0 in __cxa_throw ()
[debug]#1  0x0053ef0d in boost::serialization::throw_exception<boost::archive::archive_exception> (e=...) at C:/Dev-Cpp/i686-w64-mingw32/include/boost/serialization/throw_exception.hpp:36
[debug]#2  0x00543ae5 in boost::archive::basic_text_iarchive<boost::archive::text_iarchive>::init() () at C:/Dev-Cpp/i686-w64-mingw32/include/boost/archive/text_oarchive.hpp:97
[debug]#3  0x0054171e in boost::archive::text_iarchive_impl<boost::archive::text_iarchive>::text_iarchive_impl(std::istream&, unsigned int) () at C:/Dev-Cpp/i686-w64-mingw32/include/boost/archive/text_oarchive.hpp:114
[debug]#4  0x00540b34 in boost::archive::text_iarchive::text_iarchive (this=0x22f56c, is_=..., flags=0) at C:/Dev-Cpp/i686-w64-mingw32/include/boost/archive/text_iarchive.hpp:124
[debug]#5  0x00431445 in <lambda()>::operator()(void) const (__closure=0x22fb90) at F:\projects\cpp\missiontime\src\main.cpp:237
[debug]#6  0x00433fd9 in std::_Function_handler<void(), connect_game()::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at C:/Dev-Cpp/i686-w64-mingw32/include/c++/functional:1871
[debug]#7  0x0058a95e in std::function<void ()>::operator()() const (this=0x22fb90) at C:/Dev-Cpp/i686-w64-mingw32/include/c++/functional:2271
[debug]#8  0x0054cde5 in enetpp::client::consume_events(std::function<void ()>, std::function<void ()>, std::function<void (unsigned char const*, unsigned int)>) (this=0x22fa7c, on_connected=..., on_disconnected=..., on_data_received=...) at F:/projects/cpp/missiontime/include/enetpp/client.h:115
[debug]#9  0x004321d5 in connect_game () at F:\projects\cpp\missiontime\src\main.cpp:296
[debug]#10 0x0043327f in main_menu () at F:\projects\cpp\missiontime\src\main.cpp:424
[debug]#11 0x00433b1d in SDL_main (argc=argc@entry=1, argv=argv@entry=0x270008) at F:\projects\cpp\missiontime\src\main.cpp:521
[debug]#12 0x0043a26f in main_utf8 (argv=0x270008, argc=<optimized out>) at ../src/main/windows/SDL_windows_main.c:126
[debug]#13 WinMain@16 (hInst=0x400000, hPrev=0x0, szCmdLine=0x292688 "", sw=10) at ../src/main/windows/SDL_windows_main.c:189
[debug]#14 0x006075dd in main ()
[debug]>>>>>>cb_gdb:
[debug]> frame 1
[debug]#1  0x0053ef0d in boost::serialization::throw_exception<boost::archive::archive_exception> (e=...) at C:/Dev-Cpp/i686-w64-mingw32/include/boost/serialization/throw_exception.hpp:36
[debug]C:\Dev-Cpp\i686-w64-mingw32\include\boost\serialization\throw_exception.hpp:36:810:beg:0x53ef0d
[debug]>>>>>>cb_gdb:

#1  0x0053ef0d in boost::serialization::throw_exception<boost::archive::archive_exception> (e=...) at C:/Dev-Cpp/i686-w64-mingw32/include/boost/serialization/throw_exception.hpp:36
C:\Dev-Cpp\i686-w64-mingw32\include\boost\serialization\throw_exception.hpp:36:810:beg:0x53ef0d
At C:\Dev-Cpp\i686-w64-mingw32\include\boost\serialization\throw_exception.hpp:36
where should i catch this? or what i'm doing wrong?

the line 232 to 239 is as follows:
auto onconnected=[&](){
is_connected=true;
Tolk_Speak(L"success", reader_interrupt);
stringstream sd;
sd<<g;
text_iarchive ia(sd);
c.send_packet(0, sd.str().c_str(), sd.str().size(), ENET_PACKET_FLAG_RELIABLE);
};
what is wrong with boost.serialization that doesn't serialize that?
thanks

when you can't see well like me, you can't test your applications and you can't read something

Github

I think you really need to step up your debugging here and dive in.
First: What is the text/message of the exception?
Second: Set a breakpoint at the beginning of your closure. Figure out what it's doing when it's serializing, and why it decides to throw.
Third: I have no idea what "g" is because you're not showing that. Is it a reference to some local variable in the outer scope? If so, has that outer function already returned?
enum Bool { True, False, FileNotFound };
Advertisement

hello,

this problem has been fixed

thanks for your helps

the problem was that, i wanted to serialize an empty stream to my g (a gamedata* local variable(better to say pointer))

and that exception occured

thanks in advance for your helps

when you can't see well like me, you can't test your applications and you can't read something

Github

This topic is closed to new replies.

Advertisement