flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
You probably need ccall instead of cinvoke. Invoke is for the Windows API, and ccall is for the C library functions.
|
|||
![]() |
|
Constantine
Thanks, but it is still the same. Also documentation says that
cinvoke printf, ... and ccall [printf], ... are equivalents. |
|||
![]() |
|
revolution
Drop the brackets.
ccall printf,... |
|||
![]() |
|
Constantine
I tried. It still crashes.
|
|||
![]() |
|
revolution
What does the disassembler/debugger show?
Are you sure it crashes on the code you show above? |
|||
![]() |
|
Constantine
I do not use disassembler/debugger.
Yes, if I comment the printf line program runs correctly. |
|||
![]() |
|
revolution
Constantine wrote: I do not use disassembler/debugger. Ollydbg |
|||
![]() |
|
Constantine
And how do I find my asm code in the debug?
|
|||
![]() |
|
revolution
When it crashes you will see where it stops.
Or, you can insert int3 just before the call and the debugger will stop there for you to single step onwards. |
|||
![]() |
|
system error
I don't know about other codes you're linking to but from the source above;
1. Your test string "test" is not null-terminated. 2. Try to get rid of decorated names first. Just use extrn printf, public cutOutTags. |
|||
![]() |
|
system error
If you are to test on cutOutTags alone as a single source, try something like this below and see what more clues you can get from it. I use GoLink to produce the .exe.
Code: format MS COFF include 'win32axp.inc' extrn printf extrn exit public cutOutTags ; void cutOutTags(const char * html, char ** tags, int tagsCount, char * res); proc cutOutTags c uses ECX EDX ESI EDI EBP, html:DWORD, tagsToDelete:DWORD, tagsCount:DWORD, res:DWORD push 0 ;C-string null push "test" push esp call printf add esp,12 push 0 call exit ;ret endp |
|||
![]() |
|
revolution
system error wrote: 1. Your test string "test" is not null-terminated. A debugger/disassembler will show you such things. No need to assume here. ![]() |
|||
![]() |
|
system error
revo. I don't know much about macros but no, I don't think so or at least doesn't appear that way to me.
|
|||
![]() |
|
revolution
system error wrote: ... no, I don't think so or at least doesn't appear that way to me. |
|||
![]() |
|
system error
you're right. The string works fine without explicit terminator.
|
|||
![]() |
|
Constantine
The problem was in outer code. cutOutTags() function was called from C++ code as
std::cout << cutOutTags(input.c_str(), argv + 1, argc - 1, out); Simple call (without std::cout) solves the problem. Thank you guys for helping! P. S. Still I could not get any debugger to work. I tried Ollydbg & x32dbg. Either of them just stops in some obscure place not giving any crash message or even any reason why it have stopped and didn't want to continue tracing. And also I couldn't find any of my fasm instructions in exe file. Is there some good manual on debugging? |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.