It is currently Sat May 18, 2013 1:43 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [1.876] Get an exeption with this code...
PostPosted: Wed May 28, 2008 1:43 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1298
Location: Germany: 49º 45' 21.96" N 10º 38' 4.04" E
Tailbite this code:
Code:
ProcedureDLL ATEST_Init()

EndProcedure

ProcedureDLL ATEST_End()

EndProcedure

ProcedureDLL ATEST()
  text.s = "Working"
  MessageRequester("Tailbite Tester", text)
EndProcedure



After tailbiing and restart of the compiler run this short example:
Code:
ATEST()

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
http://chipmunk4purebasic.freeforums.org/index.php


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 1:54 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4231
Location: Strasbourg / France
No problem here (NT4 and XP, with or without debugger).
Using latest jaPBe V3.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 7:11 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1298
Location: Germany: 49º 45' 21.96" N 10º 38' 4.04" E
Tried it on my home PC again.
I got also an error there:

Code:
Unhandled exception at 0x7c9200c8 in PureBasic_Compilation1.exe: 0xC0000005: Access violation reading location 0x00000010.


Here are the diassembly too:
Code:
7C91FFC3  mov         al,byte ptr [esi+5]
7C91FFC6  test        al,0E0h
7C91FFC8  jne         7C9207D2
7C91FFCE  cmp         byte ptr [edi+586h],1
7C91FFD5  jne         7C9212C2
7C91FFDB  mov         ecx,dword ptr [edi+580h]
7C91FFE1  test        ecx,ecx
7C91FFE3  je          7C9207D2
7C91FFE9  cmp         word ptr [edi+584h],0
7C91FFF1  jne         7C9207D2
7C91FFF7  test        al,8
7C91FFF9  jne         7C9207D2
7C91FFFF  movzx       eax,word ptr [esi]
7C920002  mov         dword ptr [ebp-1Ch],eax
7C920005  cmp         eax,80h
7C92000A  jae         7C9207D2
7C920010  push        dword ptr [ebp+10h]
7C920013  lea         eax,[eax+eax*2]
7C920016  shl         eax,4
7C920019  add         eax,ecx
7C92001B  push        eax 
7C92001C  call        7C920072
7C920021  test        al,al
7C920023  je          7C9207D2
7C920029  test        byte ptr ds:[7FFE02F0h],2
7C920030  jne         7C94B59D
7C920036  mov         al,1
7C920038  call        7C91E8E6
7C92003D  ret         0Ch 
7C920040  db          ffh 
7C920041  db          ffh 
7C920042  db          ffh 
7C920043  call        dword ptr ds:[1E7C94B7h]
7C920049  mov         bh,94h
7C92004B  jl          7C92004C
7C92004D  db          ffh 
7C92004E  db          ffh 
7C92004F  inc         dword ptr [eax]
7C920051  add         byte ptr [eax],al
7C920053  add         byte ptr [edx-4Ah],ah
7C920056  xchg        eax,esp
7C920057  jl          7C91FFE9
7C920059  nop             
7C92005A  nop             
7C92005B  nop             
7C92005C  nop             
7C92005D  mov         edi,edi
7C92005F  push        ebp 
7C920060  mov         ebp,esp
7C920062  mov         eax,dword ptr [ebp+8]
7C920065  mov         ax,word ptr [eax+4]
7C920069  pop         ebp 
7C92006A  ret         4   
7C92006D  nop             
7C92006E  nop             
7C92006F  nop             
7C920070  nop             
7C920071  nop             
7C920072  mov         edi,edi
7C920074  push        ebp 
7C920075  mov         ebp,esp
7C920077  push        esi 
7C920078  mov         esi,dword ptr [ebp+8]
7C92007B  inc         dword ptr [esi+14h]
7C92007E  push        esi 
7C92007F  call        7C92005D
7C920084  cmp         ax,word ptr [esi+8]
7C920088  jae         7C920B1C
7C92008E  mov         edx,dword ptr [ebp+0Ch]
7C920091  mov         ecx,esi
7C920093  call        7C912AB0
7C920098  mov         al,1
7C92009A  pop         esi 
7C92009B  pop         ebp 
7C92009C  ret         8   
7C92009F  nop             
7C9200A0  nop             
7C9200A1  nop             
7C9200A2  nop             
7C9200A3  nop             
7C9200A4  push        204h
7C9200A9  push        7C9201C0h
7C9200AE  call        7C91E8AB
7C9200B3  mov         ebx,dword ptr [ebp+8]
7C9200B6  mov         dword ptr [ebp-1Ch],ebx
7C9200B9  xor         edi,edi
7C9200BB  mov         dword ptr [ebp-30h],edi
7C9200BE  mov         byte ptr [ebp-1Eh],0
7C9200C2  mov         dword ptr [ebp-34h],edi
7C9200C5  mov         eax,dword ptr [ebp+0Ch]
7C9200C8  or          eax,dword ptr [ebx+10h] << EXEPTION raised here!



Hint:
This was always a fresh tailbite installation.
Tailbite settings are the default one.[/code]

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
http://chipmunk4purebasic.freeforums.org/index.php


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 28, 2008 11:06 pm 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1069
Location: Germany
No crash here either. WinXP SP3.

Are you using any subsystem or unicode mode ?

_________________
http://www.PureBasicPower.de


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 29, 2008 6:04 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1298
Location: Germany: 49º 45' 21.96" N 10º 38' 4.04" E
ABBKlaus wrote:
Are you using any subsystem or unicode mode ?

No.

More hints:
Crash is raising only in 'Release' mode.
Works correct with 'Debugger is on'.


It works iF I remove the both 'default' Procedures (Init and End):
ProcedureDLL ATEST_Init()
ProcedureDLL ATEST_End()

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
http://chipmunk4purebasic.freeforums.org/index.php


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 29, 2008 8:06 am 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1069
Location: Germany
The string manager does not get imported.

This works :
Code:
A$="" ; this includes the correct StringManager (StringManager.lib/StringManagerThread.lib/StringManagerThreadUnicode.lib/StringManagerUnicode.lib)
ATEST()


Here is the PureBasic generated asm code :
Code:
;
; PureBasic 4.20 (Windows - x86) generated code
;
; (c) 2008 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; Requester
; FileSystem
; Date
; Object
; SimpleList
; :System
; KERNEL32
; :Import
;
format MS COFF
;
extrn _ExitProcess@4
extrn _GetModuleHandleA@4
extrn _HeapCreate@12
extrn _HeapDestroy@4
;
extrn _PB_FreeSimpleLists@0
extrn _PB_InitRequester@0
extrn _PB_InitSimpleList@0
extrn _PB_MessageRequester@8
extrn _memset
extrn SYS_FastAllocateStringFree
extrn _SYS_FreeString@4
extrn _PB_StringBase
extrn PB_StringBase
extrn _SYS_InitString@0
;
extrn _PB_StringBasePosition
public _PB_Instance
public _PB_ExecutableType
public _PB_MemoryBase
public PB_Instance
public PB_MemoryBase
public _PB_EndFunctions
public _PB_DEBUGGER_LineNumber
public _PB_DEBUGGER_IncludedFiles

macro pb_public symbol
{
  public  _#symbol
  public symbol
_#symbol:
symbol:
}

macro    pb_align value { rb (value-1) - ($-_PB_DataSection + value-1) mod value }
macro pb_bssalign value { rb (value-1) - ($-_PB_BSSSection  + value-1) mod value }
public PureBasicStart
;
section '.code' code readable executable
;
;
PureBasicStart:
;
  PUSH   dword I_BSSEnd-I_BSSStart
  PUSH   dword 0
  PUSH   dword I_BSSStart
  CALL  _memset
  ADD    esp,12
  PUSH   dword 0
  CALL  _GetModuleHandleA@4
  MOV    [_PB_Instance],eax
  PUSH   dword 0
  PUSH   dword 4096
  PUSH   dword 0
  CALL  _HeapCreate@12
  MOV    [PB_MemoryBase],eax
  CALL  _SYS_InitString@0
  CALL  _PB_InitSimpleList@0
  CALL  _PB_InitRequester@0
; :
; ProcedureDLL ATEST_Init()
macro MP0{
_Procedure0:
  PS0=4                                                                                                                                                                                                                                                     
;
; EndProcedure
  XOR    eax,eax
_EndProcedure1:
  RET
}
;
; ProcedureDLL ATEST_End()
macro MP2{
_Procedure2:
  PS2=4                                                                                                                                                                                                                                                     
;
; EndProcedure
  XOR    eax,eax
_EndProcedure3:
  RET
}
;
; ProcedureDLL ATEST()
macro MP4{
_Procedure4:
  PS4=8
  XOR    eax,eax
  PUSH   eax                                                                                                                                                                                                                             
; text.s = "Working"
  MOV    edx,_S1
  LEA    ecx,[esp]
  CALL   SYS_FastAllocateStringFree
; MessageRequester("Tailbite Tester", text)
  PUSH   dword [esp]
  PUSH   dword _S2
  CALL  _PB_MessageRequester@8
; EndProcedure
  XOR    eax,eax
_EndProcedure5:
  PUSH   dword [esp]
  CALL  _SYS_FreeString@4
  ADD    esp,4
  RET
}
;
_PB_EOP_NoValue:
  PUSH   dword 0
_PB_EOP:
  CALL  _PB_EndFunctions
  PUSH   dword [PB_MemoryBase]
  CALL  _HeapDestroy@4
  CALL  _ExitProcess@4
_PB_EndFunctions:
  CALL  _PB_FreeSimpleLists@0
  RET
;
MP4
MP2
MP0
;
section '.data' data readable writeable
;
_PB_DataSection:
_PB_DEBUGGER_LineNumber: dd -1
_PB_DEBUGGER_IncludedFiles: dd 0
_PB_ExecutableType: dd 0
public _SYS_StaticStringStart
_SYS_StaticStringStart:
_S2: db "Tailbite Tester",0
_S1: db "Working",0
pb_public PB_NullString
  db     0
public _SYS_StaticStringEnd
_SYS_StaticStringEnd:
align 4
align 4
s_s:
  dd     0
  dd     -1
align 4
;
section '.bss' readable writeable
_PB_BSSSection:
align 4
;
I_BSSStart:
_PB_MemoryBase:
PB_MemoryBase: rd 1
_PB_Instance:
PB_Instance: rd 1
;
align 4
PB_DataPointer rd 1
align 4
align 4
align 4
align 4
I_BSSEnd:
section '.data' data readable writeable
SYS_EndDataSection:

_________________
http://www.PureBasicPower.de


Last edited by ABBKlaus on Fri May 30, 2008 8:26 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu May 29, 2008 8:41 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1298
Location: Germany: 49º 45' 21.96" N 10º 38' 4.04" E
Code:
Import "StringManager.lib"
EndImport
ATEST()

Yes this is working now. Thanks.


But here the next problem:

Please add the 'static' in front of the line 'text.s = "Nativ".
The messagebox has an empty text now.
Example:
Code:
Static text.s = "Nativ"

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
http://chipmunk4purebasic.freeforums.org/index.php


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 29, 2008 9:00 am 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1069
Location: Germany
Its unsupported for now. You can use a global instead :
Code:
Global ATEST_text.s

ProcedureDLL ATEST_Init()
  ATEST_text = "Working"
EndProcedure

ProcedureDLL ATEST_End()

EndProcedure

ProcedureDLL ATEST()
  MessageRequester("Tailbite Tester", ATEST_text)
EndProcedure


The so called 'PureBasicStart:' is not evaluated by TailBite. And the variable test is not initialised.

Code:
PureBasicStart:
;
  PUSH   dword I_BSSEnd-I_BSSStart
  PUSH   dword 0
  PUSH   dword I_BSSStart
  CALL  _memset
  ADD    esp,12
  PUSH   dword 0
  CALL  _GetModuleHandleA@4
  MOV    [_PB_Instance],eax
  PUSH   dword 0
  PUSH   dword 4096
  PUSH   dword 0
  CALL  _HeapCreate@12
  MOV    [PB_MemoryBase],eax
  CALL  _SYS_InitString@0
  CALL  _PB_InitSimpleList@0
  CALL  _PB_InitRequester@0
  MOV    edx,_S1                  ; <- Static variable gets initialized here
  MOV    ecx,s_ATEST.v_text       ;
  CALL   SYS_FastAllocateString   ;
; :

...

_S1: db "Nativ",0

...


_________________
http://www.PureBasicPower.de


Last edited by ABBKlaus on Fri May 30, 2008 8:34 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu May 29, 2008 9:25 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 8:51 am
Posts: 1298
Location: Germany: 49º 45' 21.96" N 10º 38' 4.04" E
ABBKlaus wrote:
Its unsupported for now. You have to use this instead :
Code:
ProcedureDLL ATEST()
  Static text.s
  If Not text:text = "Nativ":EndIf
  MessageRequester("Tailbite Tester", text)
EndProcedure


Initializing of a static string variable is no longer supported?
Thats not acceptable. It works correct if I use it as a procedure:

Code:
Procedure ATEST1()
  Static text.s = "Value: "
  Static counter.l = 2

  text + Str(counter)
  MessageRequester("Tailbite Tester", text)
EndProcedure

ATEST1()
ATEST1()
ATEST1()
ATEST1()
ATEST1()

_________________
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
http://chipmunk4purebasic.freeforums.org/index.php


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 29, 2008 11:33 am 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1069
Location: Germany
Its a TailBite issue, you never have problems in a PureBasic program (Except PB4.02) !

_________________
http://www.PureBasicPower.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye