|
From: sfeam <sf...@us...> - 2015-03-04 03:36:09
|
On Wednesday, 04 March 2015 09:54:08 AM Tatsuro MATSUOKA wrote: > > ----- Original Message ----- > >From: Ethan A Merritt > >To: gnuplot-beta@ Tatsuro MATSUOKA > >Date: 2015/3/4, Wed 05:29 > >Subject: Re: Some observations building gnuplot for win by gcc-4.9.2 (MinGW64) > > > > > > > >On Tuesday, 03 March, 2015 16:16:01 Tatsuro MATSUOKA wrote: > >> Hello > >> > >> I have tried to update gcc for windows build of gnuplot from ver. 4.9.0 to 4.9.2. > >> Some observations happened for both 64 bit and 32 bit build. > >> > >> > >> Complier gcc-4.9.2-2 from MinGW-64 project > >> 64 bit : exception:seh, thread:win32 > >> 32 bit : exception:dwarf2, thread:win32 > >> > >> Good point > >> > >> I can built gd-2.1.1 flawlessly for both 64 bit and 32 bit platform. > >> > >> > >> Troubles ? > >> ********** > >> 64 bit > >> ********** > >[snip] > > > >> 32 bit > >> ****** > >> gnuplot crashes by segmentation fault when one use cairo based terminals. > >> > >> Segmentation fault : g_utf8_validate gutf8.c:1634 on MinGW-64 32 bit gcc-4.9.2 > >> > >> I have met a Segmentation fault at using gnuplot-5.1 built by myself on windows. > >> The Segmentation fault seems to be related with the cairo based terminals. > >> (The cairo based terminals use libglib.) > >> > >> Compiler gcc-4.9.2 (MinGW-w64 32bit. dwarf, win32 thread). > >> Glib version : 2.42.1. Build from source. > >> > >> gdb message: > >> > >> Program received signal SIGSEGV, Segmentation fault. > >> 0x6862318f in g_utf8_validate (str=0x2888a68 "-1", max_len=-1, end=0xffffffff) > >> at ../../glib-2.42.1/glib/gutf8.c:1634 > >> 1634 *end = p; > >> > >> Program received signal SIGSEGV, Segmentation fault. > >> 0x6862318f in g_utf8_validate (str=0xb28a68 "-1", max_len=-1, end=0xffffffff) > >> at ../../glib-2.42.1/glib/gutf8.c:1634 > >> 1634 *end = p; > >> > >> > >> Perhaps this is a bug of glib (2.42.1 and 2.33.14). > >> > >> I have filed the issue to the bug tracker of Gnome. > >> > >> https://bugzilla.gnome.org/show_bug.cgi?id=745485 > >> > >> At this moment, I abandon the complier update. However, is the trouble 2 for 64 bit case not a issue of gnuplot code? > > > >That is possible. > >Can you provide a more complete trace of the segfault that > >shows where in the gnuplot code this failure happened? > > > >Ethan > > > > > Thank you for your response: > > I copy the back trace. > For wxt terminal, > (gdb) bt > #0 0x6862318f in g_utf8_validate (str=0x2a97fc8 "-1", max_len=-1, > end=0xffffffff) at ../../glib-2.42.1/glib/gutf8.c:1634 > #1 0x00529d21 in gp_cairo_convert (plot=0x2a0e0f0, string=0x2a97fc8 "-1") > at ../../src/wxterminal/gp_cairo.c:737 [snip] I think this indicates a bug in glib. Gnuplot is prepared for an error return from the call to g_utf8_validate, but apparently glib faults instead of cleanly returning an error. The gnuplot code is: if (g_utf8_validate(string, -1, NULL)) { string_utf8 = g_strdup(string); } else { charset = gp_cairo_get_encoding(plot); string_utf8 = g_convert(string, -1, "UTF-8", charset, &bytes_read, NULL, &error); } The strange thing is that the string being converted seems totally harmless: "-1". I could more easily understand if the failure occurred for a string in, for example, SHIFT_JIS encoding since I imagine the glib people have not tested that extensively. The only thing I can think of to try in the gnuplot code is to invert the order of the tests. Something like charset = gp_cairo_get_encoding(plot); if (<some test on charset != UTF8>) { string_utf8 = g_convert(string, -1, "UTF-8", charset, &bytes_read, NULL, &error); } else if (g_utf8_validate(string, -1, NULL)) { string_utf8 = g_strdup(string); } else { more serious error code or failure } I am not sure what are the proper test in the pseudo-code above when run on Windows. Ethan > #2 0x0052b6bc in gp_cairo_enhanced_flush (plot=0x2a0e0f0) > at ../../src/wxterminal/gp_cairo.c:1311 > #3 0x00525eb9 in wxtPanel::wxt_cairo_exec_command (this=0x2a0df40, > command=...) at ../../src/wxterminal/wxt_gui.cpp:2964 > #4 0x005257a9 in wxtPanel::wxt_cairo_refresh (this=0x2a0df40) > at ../../src/wxterminal/wxt_gui.cpp:2850 > #5 0x00523e67 in wxt_text () at ../../src/wxterminal/wxt_gui.cpp:2047 > #6 0x0045d368 in wxt_text_wrapper () at ../../term/wxt.trm:460 > #7 0x0040e560 in term_end_plot () at ../../src/term.c:544 > #8 0x004f2f8f in do_plot (plots=0x29f8520, pcount=1) > at ../../src/graphics.c:912 > #9 0x004c324e in eval_plots () at ../../src/plot2d.c:3333 > #10 0x004b4ac5 in plotrequest () at ../../src/plot2d.c:271 > #11 0x004acb3d in plot_command () at ../../src/command.c:1535 > #12 0x004aacb8 in command () at ../../src/command.c:621 > #13 0x004aa58d in do_line () at ../../src/command.c:418 > #14 0x004aa2cd in com_line () at ../../src/command.c:322 > #15 0x004b1518 in gnu_main (argc=0, argv=0x29e5818) at ../../src/plot.c:660 > #16 0x0053545b in WinMain@16 (hInstance=0x400000, hPrevInstance=0x0, > lpszCmdLine=0xa959c9 "", nCmdShow=10) at ../../src/win/winmain.c:593 > #17 0x0057a31d in main () > > > For pngcairo terminal > (gdb) bt > #0 0x6862318f in g_utf8_validate (str=0x28f596 "-1", max_len=-1, > end=0xffffffff) at ../../glib-2.42.1/glib/gutf8.c:1634 > #1 0x00529d21 in gp_cairo_convert (plot=0x6088c0 <plot>, > string=0x28f596 "-1") at ../../src/wxterminal/gp_cairo.c:737 > #2 0x00529fbd in gp_cairo_draw_text (plot=0x6088c0 <plot>, x1=1100, y1=8842, > string=0x28f596 "-1", width=0x0, height=0x0) > at ../../src/wxterminal/gp_cairo.c:850 > #3 0x0045f1ab in cairotrm_put_text (x=1100, y=758, string=0x28f596 "-1") > at ../../term/cairo.trm:989 > #4 0x0040e9fc in write_multiline (x=1100, y=758, text=0x28f596 "-1", > hor=RIGHT, vert=JUST_CENTRE, angle=0, font=0x0) at ../../src/term.c:781 > #5 0x004fd5d5 in ytick2d_callback (axis=FIRST_Y_AXIS, place=-1, > text=0x28f596 "-1", ticlevel=0, grid=..., userlabels=0x0) > at ../../src/graphics.c:3446 > #6 0x0047fb09 in gen_tics (axis=FIRST_Y_AXIS, > callback=0x4fcff4 <ytick2d_callback>) at ../../src/axis.c:1274 > #7 0x00480603 in axis_output_tics (axis=FIRST_Y_AXIS, > ticlabel_position=0x60bbac <ytic_x>, zeroaxis_basis=FIRST_X_AXIS, > callback=0x4fcff4 <ytick2d_callback>) at ../../src/axis.c:1484 > #8 0x004f11c4 in place_grid () at ../../src/graphics.c:217 > #9 0x004f21a1 in do_plot (plots=0xde86f0, pcount=1) > at ../../src/graphics.c:551 > #10 0x004c324e in eval_plots () at ../../src/plot2d.c:3333 > #11 0x004b4ac5 in plotrequest () at ../../src/plot2d.c:271 > #12 0x004acb3d in plot_command () at ../../src/command.c:1535 > #13 0x004aacb8 in command () at ../../src/command.c:621 > #14 0x004aa58d in do_line () at ../../src/command.c:418 > #15 0x004aa2cd in com_line () at ../../src/command.c:322 > #16 0x004b1518 in gnu_main (argc=0, argv=0xdd5818) at ../../src/plot.c:660 > #17 0x0053545b in WinMain@16 (hInstance=0x400000, hPrevInstance=0x0, > lpszCmdLine=0x8a59c9 "", nCmdShow=10) at ../../src/win/winmain.c:593 > #18 0x0057a31d in main () > (gdb) > |