PureBasic Forum
https://www.purebasic.fr/english/

[Done] PB 5.71 x64 "Display Hex values" and MemoryViewer
https://www.purebasic.fr/english/viewtopic.php?f=23&t=74272
Page 1 of 2

Author:  Naheulf [ Fri Dec 27, 2019 7:25 pm ]
Post subject:  [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

Short description :
"Display Hex values" setting has no effect on MemoryViewer.

Steps to reproduce :
1 - Open Purebasic IDE
2 - Go to menu File > Preferences... > Debugger > Individual Settings
3 - In "Memory Viewer" field, check option "Display Hex Values"
4 - Click "Ok" button
5 - Run the code bellow
6 - On the bottom left of Memory Viewer window, click on "Hex View" and select any "* Table" view.

Expected result :
Values should be displayed in hexa.

Actual result :
Values are displayed in decimal.

Code to run :
Code:
EnableExplicit

CompilerIf Not #PB_Compiler_Debugger
   CompilerError "You MUST enable debugger to use memory Viewer and see the bug."
CompilerEndIf

Define myString$ = "Hello world"
ShowMemoryViewer(@myString$, StringByteLength(myString$) + SizeOf(Character))
CallDebugger

My computer :
Purebasic : 5.71 LTS (Linux - x64)
OS : Ubuntu 18.04.3 LTS (64 bits)

Author:  #NULL [ Sat Dec 28, 2019 8:27 am ]
Post subject:  Re: [PB 5.71 x64] "Display Hex values" and MemoryViewer

Confirmed. Happens here as well.

Author:  idle [ Sat Dec 28, 2019 7:59 pm ]
Post subject:  Re: [PB 5.71 x64] "Display Hex values" and MemoryViewer

I get hex view on manjero
Quote:
00000000015060C0 48 00 65 00 6C 00 6C 00 6F 00 20 00 77 00 6F 00 H.e.l.l.o. .w.o.
00000000015060D0 72 00 6C 00 64 00 00 00 r.l.d...

Author:  Naheulf [ Sat Dec 28, 2019 8:08 pm ]
Post subject:  Re: [PB 5.71 x64] "Display Hex values" and MemoryViewer

idle wrote:
I get hex view on manjero
Quote:
00000000015060C0 48 00 65 00 6C 00 6C 00 6F 00 20 00 77 00 6F 00 H.e.l.l.o. .w.o.
00000000015060D0 72 00 6C 00 64 00 00 00 r.l.d...


You forgot my step "6"
Naheulf wrote:
6 - On the bottom left of Memory Viewer window, click on "Hex View" and select any "* Table" view.


Of course the "Hex View" is always displayed as Hexadecimal... :P The issue is for other views...

Author:  idle [ Sat Dec 28, 2019 8:13 pm ]
Post subject:  Re: [PB 5.71 x64] "Display Hex values" and MemoryViewer

OK I see what you mean now, doesn't look like it's implemented the preference appears as MemoryIsHex a global in DebuggerCommon.pb
So the prototypes to fill out the table just need to be changed which could also be expanded to include options of dec,bin,oct,hex

/purebasic-master/PureBasicDebugger/MemoryViewer.pb
Code:
Prototype.s MemoryViewer_PeekVal(*Pointer)

Procedure.s MemoryViewer_PeekB(*Pointer)
  If MemoryIsHex  ;<-global defined in DebuggerCommon.pb
    ProcedureReturn Hex(PeekB(*Pointer),#PB_Byte)
  Else
    ProcedureReturn Str(PeekB(*Pointer))
  EndIf   
EndProcedure


and so on for the rest of the prototypes

Author:  idle [ Tue Dec 31, 2019 1:45 am ]
Post subject:  Re: [PB 5.71 x64] "Display Hex values" and MemoryViewer

committed a fix

Author:  Fred [ Thu Feb 27, 2020 1:49 pm ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

So it's fixed in current beta ?

Author:  Naheulf [ Thu Feb 27, 2020 8:09 pm ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

Nop.

If I check with PB 5.72 LTS Beta 1 (x64) and use step to reproducefrom my first message and choose "Word Table" I get following values :
Code:
72 101 108 108 111 32 119 111 114 108 100 0

Instead of
Code:
48 65 6C 6C 6F 20 77 6F 72 6C 64 0


So the bug is still here.

Author:  idle [ Thu Feb 27, 2020 9:38 pm ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

Add at line 711 in memory viewer and it'll fix it
MemoryViewTableData.i = MemoryIsHex

I'd set it at the start of the file rather than in the open window

Author:  Sicro [ Sun Mar 08, 2020 3:12 pm ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

Fred wrote:
Post subject: Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

So it's fixed in current beta ?
You should ask first and then mark the thread as "[Done]". :wink:
Now the thread has kept the marking, although the bug is not fixed yet.

PR on GitHub: https://github.com/fantaisie-software/purebasic/pull/73

Author:  Fred [ Sun Mar 08, 2020 3:44 pm ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

Thanks for the PR, merged !

Author:  Naheulf [ Mon Mar 09, 2020 7:06 pm ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

Year ! It works on 5.72 Beta 2 ! The combobox to choose OCT, DEC or HEX is nice.
But I don't understand the Data checkbox use. Is for another bugfix ?

Author:  idle [ Mon Mar 09, 2020 8:09 pm ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

The check box just enables you to format the output on copy to that of a datasection .

Author:  #NULL [ Tue Mar 10, 2020 7:36 am ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

Documentation needs to be updated (and translated) as well.
The Data checkbox doesn't do it when in Hex-view? Should be disabled then.

Author:  idle [ Wed Mar 11, 2020 9:31 am ]
Post subject:  Re: [Done] PB 5.71 x64 "Display Hex values" and MemoryViewer

#NULL wrote:
Documentation needs to be updated (and translated) as well.
The Data checkbox doesn't do it when in Hex-view? Should be disabled then.


Yes should probably disable it in hex view. this should do it. I've still got some issues with my system at the moment.
So if one of you can add these in MemoryViewer
[code
DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_ChkformatDataSection],1)
DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_ChkformatDataSection],0)
[/code]

Replace the 1st If block in MemoryViewer_Update
Code:
If ViewType = 0 Or ViewType >= 8 ; hex display or string display
    ClearGadgetItems(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_List])
   
    HideGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_Container], 1)
    HideGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_Editor], 0)
   
    DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_Display_DataView],1)
    DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_ChkformatDataSection],1)
  Else 
    FreeGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_List]) ; recreate this to change the number of columns
    OpenGadgetList(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_Container])
    If MemoryOneColumnOnly
      *Debugger\Gadgets[#DEBUGGER_GADGET_Memory_List] = ListViewGadget(#PB_Any, 0, 0, WindowWidth(*Debugger\Windows[#DEBUGGER_WINDOW_Memory])-20, WindowHeight(*Debugger\Windows[#DEBUGGER_WINDOW_Memory])-90)
    Else
      *Debugger\Gadgets[#DEBUGGER_GADGET_Memory_List] = ListIconGadget(#PB_Any, 0, 0, WindowWidth(*Debugger\Windows[#DEBUGGER_WINDOW_Memory])-20, WindowHeight(*Debugger\Windows[#DEBUGGER_WINDOW_Memory])-90, "", 80, #PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_MultiSelect)
    EndIf
    CloseGadgetList()
   
    HideGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_Container], 0)
    HideGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_Editor], 1)
    DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_Display_DataView],0)
    DisableGadget(*Debugger\Gadgets[#DEBUGGER_GADGET_Memory_ChkformatDataSection],0)
  EndIf 

Page 1 of 2 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/