Author Topic: BxbAsm  (Read 178851 times)

jcfuller

  • Guest
Re: BxbAsm
« Reply #270 on: May 10, 2012, 01:09:15 PM »
Steve,
  I noticed the lea's and something is nagging in the back of my brain with problems using lea's.??????

James

jcfuller

  • Guest
Re: BxbAsm
« Reply #271 on: May 10, 2012, 01:34:52 PM »
Steve,
  By commenting out just CLEAR compiles and executes fine. BUT CLEAR worked fine in test47??

James

SteveA

  • Guest
Re: BxbAsm
« Reply #272 on: May 10, 2012, 01:58:37 PM »
I noticed the lea's and something is nagging in the back of my brain with problems using lea's.??????
Quote
By commenting out just CLEAR compiles and executes fine. BUT CLEAR worked fine in test47??

I'm going to have to run it thru the debugger and see just what's happening.
This is very odd.

SteveA

  • Guest
Re: BxbAsm
« Reply #273 on: May 10, 2012, 02:01:05 PM »
Clear is introduced in test12 and hasn't failed up to now.
But, something about it is causing the problem.

SteveA

  • Guest
Re: BxbAsm
« Reply #274 on: May 10, 2012, 05:47:31 PM »
I've single stepped it thru the debugger and CLEAR appears to be doing exactly what I expected it to do.
The only thing that I can think of that it could possibly be is, in the clear process, it call "free" to free malloc'ed memory for strings.
It doesn't fail on my end, but, possibly it does on win7/64.
Let me see if I can rig some kind of a test for that.

In the mean time, I guess we should avoid using CLEAR.

Thanks for all your patience and help with this James.
Steve

jcfuller

  • Guest
Re: BxbAsm
« Reply #275 on: May 11, 2012, 07:36:22 AM »
I'm going to try debugging here although I have not done any single step debugging since 16bit days.
I downloaded ollydbg and pelles also has a debugger built it.
Now I need to reorganize the source so I can compile all the library modules with debugging info.

James

SteveA

  • Guest
Re: BxbAsm
« Reply #276 on: May 11, 2012, 09:59:32 AM »
James,
I've snipped the 'clear-strings' portion form the CLEAR function and added it to the '.asm' listing:
Code: [Select]
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;  call clear_allvars
;
  mov  esi, _var_start
  mov  edi, _int_start        ; clear strings
  mov  ecx, 0
  add  esi, 4
@@:
  .if esi < edi
    mov  eax, [esi]
    .if eax != 0
      pushad
      invoke free, eax
      popad
      mov  [esi], ecx
    .endif
    add  esi, 4
    jmp  @B
  .endif
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


I've zipped the EXE and the .asm file.

So, rather than calling the 'clear' function, it's inserted into the code.
I'm of the feeling that the "free" might be the issue.
CLEAR first clears strings, then integers, then floats.
Only clearing strings calls "free".

I've tested it here, but, of course it works fine.
If you could run the EXE and see if it crashes, that might point in the right direction.
Thanks,
Steve

jcfuller

  • Guest
Re: BxbAsm
« Reply #277 on: May 11, 2012, 10:35:39 AM »
Steve,
  It spits an exception here just as before.
I was able to create a debug version of  bxblib and in turn created a debug version of both your most recent test48a.asm and the parred down test48  with debug info. Pelles loads and debugs it fine it's just I have no idea what I'm doing with it or what I'm looking for :)

James

SteveA

  • Guest
Re: BxbAsm
« Reply #278 on: May 11, 2012, 11:44:33 AM »
Hey James,
Okay, the fact that it crashes with only the clear-string portion tells me a lot.
That means that "free" could really be the culprit.
Try this, in Test48A.asm, comment-out "invoke free", like this:

Code: [Select]
 .if esi < edi
    mov  eax, [esi]
    .if eax != 0
      pushad
;;      invoke free, eax
      popad
      mov  [esi], ecx
    .endif
    add  esi, 4
    jmp  @B
  .endif


See if it still crashes.
Steve
« Last Edit: May 11, 2012, 11:46:22 AM by SteveA »

SteveA

  • Guest
Re: BxbAsm
« Reply #279 on: May 11, 2012, 11:52:36 AM »
Pelles loads and debugs it fine it's just I have no idea what I'm doing with it or what I'm looking for :)

Well, the idea would be to step it into the 'clear string' section, then continue single stepping it while noting which instruction causes the crash.


EDIT:

In Olly, here is a screen shot of where the 'clear string' section is:
F7 single steps.
In the event of a CALL, Ctrl-F9 will "advance thru" any CALLs and bring you to the next RET, where you will F7 again.

Steve
« Last Edit: May 11, 2012, 12:11:59 PM by SteveA »

jcfuller

  • Guest
Re: BxbAsm
« Reply #280 on: May 11, 2012, 12:14:47 PM »
No crash with free commented.

What I need is a simpler piece of code that crashes.

James


SteveA

  • Guest
Re: BxbAsm
« Reply #281 on: May 11, 2012, 12:28:23 PM »
No crash with free commented.
What I need is a simpler piece of code that crashes.


Here is a quote from the Lcc-Win32 Standard Library docs:
Quote
The free function causes the space pointed to by ptr to be deallocated, that is, made available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if the argument does not match a pointer earlier returned by the calloc, malloc,or realloc function, or if the space has been deallocated by a call to free or realloc, the behavior is undefined.


jcfuller

  • Guest
Re: BxbAsm
« Reply #282 on: May 11, 2012, 12:52:28 PM »
Well I think you are getting undefined as I think it is crashing in RtlInitUnicodeString called from RtlfreeHeap called from free.

James

jcfuller

  • Guest
Re: BxbAsm
« Reply #283 on: May 11, 2012, 12:57:57 PM »
Here is olly screen at exception.

SteveA

  • Guest
Re: BxbAsm
« Reply #284 on: May 11, 2012, 01:00:16 PM »
Well I think you are getting undefined as I think it is crashing in RtlInitUnicodeString called from RtlfreeHeap called from free.

Okay.
I wonder if it has something to do with it being associated with the open file...?
You know, the LSET...

Steve