Opened 8 years ago

Closed 8 years ago

#81 closed defect (fixed)

Saving snapshot breakes the image (win64) - build 2103

Reported by: patrik.svestka@… Owned by:
Priority: major Milestone:
Component: default Keywords:
Cc: Also affects CVS HEAD (eXept version): no

Description

Steps to reproduce:

1) delete all st.* (.chg, *.img, *.sav)
2) start stx.bat (that will start the environment)
3) click file\save image (creates new st.* files in the directory)
4) try to launch the stx.bat again -> fails

Displays only and exit:
C:\prg_sdk\smalltalkx-jv-branch-6.2.5_x86_64-win32\bin>stx.bat
IMG [info]: executable and/or shared libraries changed address(es).
IMG [info]: updating cached function pointers.

Attachments (5)

st_img.part01.rar (2.0 MB ) - added by patrik.svestka@… 8 years ago.
st_img.part02.rar (2.0 MB ) - added by patrik.svestka@… 8 years ago.
st_img.part03.rar (2.0 MB ) - added by patrik.svestka@… 8 years ago.
st_img.part04.rar (115.2 KB ) - added by patrik.svestka@… 8 years ago.
bug_81_Saving_snapshot_breakes_the_image.rb (1.5 KB ) - added by jan vrany 8 years ago.
Simple script to reproduce a buggy image

Change History (10)

by patrik.svestka@…, 8 years ago

Attachment: st_img.part01.rar added

by patrik.svestka@…, 8 years ago

Attachment: st_img.part02.rar added

by patrik.svestka@…, 8 years ago

Attachment: st_img.part03.rar added

by patrik.svestka@…, 8 years ago

Attachment: st_img.part04.rar added

comment:1 by patrik.svestka@…, 8 years ago

Uploaded image is the broken one.

Last edited 8 years ago by patrik.svestka@… (previous) (diff)

by jan vrany, 8 years ago

Simple script to reproduce a buggy image

comment:2 by jan vrany, 8 years ago

I took me a while to find out how to reproduce it for "sometimes" it works and "sometimes" it does not. Attached script creates a snapshot that fails to restart. SEGV as I suspected:

C:\Temp\smalltalkx-jv-branch-6.2.5_build2095_x86_64-win32\bin>C:\mingw64\bin\gdb.exe --args stx-bin.com -i st.img
GNU gdb (GDB) 7.8.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from stx-bin.com...done.
(gdb) r
Starting program: C:\Temp\smalltalkx-jv-branch-6.2.5_build2095_x86_64-win32\bin\stx-bin.com -i st.img
[New Thread 11528.0x1eb0]
[New Thread 11528.0x2244]
[Thread 11528.0x2244 exited with code 0]
IMG [info]: executable and/or shared libraries changed address(es).
IMG [info]: updating cached function pointers.

Program received signal SIGSEGV, Segmentation fault.
0x0000000065784187 in patchMethodAndBlockCode (o=0x7eef59cc1b0) at .\snapshot.c:2481
2481    .\snapshot.c: No such file or directory.
(gdb)

I'll have a look later, this needs a bit of time and concentration.

comment:3 by jan vrany, 8 years ago

Status: newtesting

Ouch! This one is really embarrasing :-(

Signed/unsigned arithmetic bitten me again.
The code segfaulted in patchMethodAndBlockCode() accessing
patch descriptor far, far out of range of descriptor array when
the code was not to be patched and smaller than address of first
patch descriptor. Then the code to lower lastI in binary search:

    lastI = middleI - 1;

actually underflew (0 - 1 is a large positive)
since lastI was (wrongly) declared as size_t. Declaring it as
int fxes the problem. Moreover, to speed things up a bit,
short-circuit the binary serch when code is not to be patched
(i.e., when codepointer is lower than code of first descriptor
and higher than code of last descriptor).

Fixed in aadab2b5a771/stx.librun. Will be included from build 2014 onward.

comment:4 by patrik.svestka@…, 8 years ago

I have tested it on 2105 and it works as expected.

0-1 -> max. positive is always tricky and hard to find, that can happen to anyone.

note: I wanted to check the patch aadab2b5a771/stx.librun but it is probably not public as I could not find it and hovering on it shows only "Repository not found"

in reply to:  4 comment:5 by jan vrany, 8 years ago

Resolution: fixed
Status: testingclosed

Replying to patrik.svestka@…:

0-1 -> max. positive is always tricky and hard to find, that can happen to anyone.

Can, but I should have been more careful. No excuses.

note: I wanted to check the patch aadab2b5a771/stx.librun but it is probably not public as I could not find it and hovering on it shows only "Repository not found"

The stx:librun (VM library) repository is not public. To get an access you may need a special agreement with eXept (basically a NDA sort of thing). If interested, send me a private message.

Note: See TracTickets for help on using tickets.