News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

HJWASM 2.17 bugs

Started by powershadow, December 29, 2016, 03:53:22 AM

Previous topic - Next topic

mabdelouahab

Quote from: habran on January 07, 2017, 11:50:15 PM
I don't know how to setup Radasm2 for HJWasm, I am using Visual Studio Community 2013 to build my programs.
You can PM Johnsa, to give you some tips how to setup Radasm2 for HJWasm.
RadAsm2->File->New Project-> ...
then
Menu:Project->Project Options->go to Assemble ; replace ML.exe With HJWasm64.exe or HJWasm.exe

ragdog

@mabdelouahab

This is not my problems to change the compiler settings.

I have only ask fo this cryptic string but all is ok und solved Thank you all.

jj2007

Just for fun - I am playing around with downloading. This is a simple GUI executable that allows to see the GitHub sources in an edit window. Here is the full source:

include \masm32\MasmBasic\Res\MbGui.asm
  GuiControl MyRich, "richedit", x200, w800
  GuiControl MyListbox, "listbox", w200
  SetGlobals cursel, f$, ct, http$="https://raw.githubusercontent.com/Terraspace/HJWasm/master/"
  SetGlobals
  Dim t$()
  Dim url$()
  Let t$(0)="Select a file"
  StringToArray 99, gh$()  ; the table of contents is embedded as resource #99
  For_ ecx=0 To eax-1
      .if Instr_(gh$(ecx), '<td class="content">')
            mov esi, gh$(ecx+1)
            inc ct
            Let url$(ct)=http$+Extract$(esi, '/master/', '"')
            Let t$(ct)=Extract$(esi, 'title="', '"')
      .endif
  Next

  SetListbox t$()      ; fill the listbox
Event Command
  .if NotifyCode==LBN_SELCHANGE && LbSel>0      ; if user selects a file from the list...
      Let f$=FileRead$(url$(LbSel))      ; ... get its content and display it
      SetWin$ hMyRich=f$
      SetWin$ hWnd="GitHub - "+url$(LbSel)
  .endif
GuiEnd

johnsa

Hey all,

After my extended vacation ;) I am finally back and after some more testing 2.18 is up on the site and github.

Cheers
John

jj2007

Hi John,
Tested with my big sources, everything fine :t

powershadow

Bug#4 still present. /Zd parameter not generating line number debug information for unknown reason.

johnsa

Are the others sorted?

Also, is the /Zd problem you are having when assembling a 32bit application?
Also which hjwasm version do you use hjwasm32 or hjwasm64 ? (Have you tried both to see if there is a difference?)

powershadow

I just check bug1 - fixed. bug4 - not fixed. bug2 & bug3 - not checked.
I use hjwasm32 to assembling 32bit application.
I admit, that it depends on source. If i comment some parts then obj file generated with "line numbers". But i can't identify exact dependence.

johnsa

That's quite odd, I'll investigate it.

Let me know if 2 and 3 are right when you get a chance.

Cheers
John

powershadow

Hi johnsa.
I spent some time to investigate Bug#4 and found something strange to me:

linenum.c:
static void AddLinnumData( struct line_num_info *data )
...
    data->next = NULL;
    if ( q->head == NULL)
        q->head = q->tail = data;
    else {
      if (ModuleInfo.Ofssize == USE32) {
        if ((q->tail && ((uint_32)q->tail < 0x00FFFFFF))) {  // what this check do ??? why 0x00FFFFFF? (i don't understand).
          ((struct line_num_info *)q->tail)->next = data;
          q->tail = data;
          }
        }

I removed this and other similarly checks. Actually i restored linnum.c like in version 2.13 and bug4 is gone!


powershadow

Hi johnsa, some new bugs :biggrin:

Bug#5: Structures corruption while writing symbolic debug info (/Fs)

void WriteSymbols()
{
...
ld = fopen(pName, "w");

So each linefeed is replaced with a carriage-return – linefeed pair, after that all structures corrupted.

Fix:
void WriteSymbols()
{
...
ld = fopen(pName, "wb");

Also need to check all othesrs functions with fopen (name,"w").

Bug#6 Skipped first procedure while writing symbolic debug info (/Fs)
First procedure has sym->offset==0, so it skipped by this code:
void WriteSymbols()
{
...
if ((sym->state == SYM_INTERNAL && sym->offset==0) || sym->state == SYM_MACRO || sym->state == SYM_TMACRO || sym->state == SYM_GRP) continue;


Bug#4,Bug#5,Bug#6- also present in HJWASM 2.18.

johnsa

1,2,3,5 and 6 are fixed now and will be in 2.19 (along with some other encoding of mmx and avx512 fixes found by other users).

A question about 4, is this happening when you use the binary (released) packages or when you compile hjwasm from source ?

powershadow

Quote from: johnsa on January 27, 2017, 10:03:52 AM
A question about 4, is this happening when you use the binary (released) packages or when you compile hjwasm from source ?
Both.
I already found mistake.
if ((q->tail && ((uint_32)q->tail < 0x00FFFFFF)))  Why you think that allocated memory address must be less then 0x00FFFFFF ??? This is wrong.

johnsa

Habran added that to solve an issue when adding switch with line number generation.
I'll leave him to explain it :)

If he can ensure that switch works without that code in then we can make that change, as it does seem strange to me.