Author Topic: 64-bit register values and SIMD  (Read 11434 times)

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
64-bit register values and SIMD
« on: February 21, 2012, 05:17:38 am »
I'm writing and debugging 64-bit applications in both C and assembly language with the codeblocks IDE on ubuntu, but the registers only display 32-bits.  The IDE is smart enough to realize it is a 64-bit mode program, since it calls the registers "rax, rbx, rcx, rdx, rsi, rdi, rbp, rsp, r8, r9, r10, r11, r12, r13, r14, r15, rip...", BUT it only displays a 32-bit value for the contents of the registers.  The strange part is, the integer values seem to display values beyond the limit of 32-bit numbers, but the hexadecimal values never exceed 32-bit values... so I can't read addresses in registers!  Ouch!

Also, I'm writing a lot of SIMD assembly language now, complete with AVX and FMA4 and other up-to-date features... but the SIMD registers are not displayed!  That's a huge bummer.  Why are registers ymm0 ~ ymm15 missing?

Oh, one other extremely annoying aspect of the IDE is... the variables are not displayed in any obvious order.  They should be displayed in alphabetic order.  As it is now, it takes me FOREVER to find specific variables in large functions.  Very annoying!

Still, I love codeblocks... it's just missing a few very basic capabilities and features.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: 64-bit register values and SIMD
« Reply #1 on: February 21, 2012, 07:03:36 am »
...version, platform please? Did you try the debugger branch?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: 64-bit register values and SIMD
« Reply #2 on: February 21, 2012, 09:58:37 pm »
...version, platform please? Did you try the debugger branch?

I think I have the latest binary build for "64-bit ubuntu 10.04 LTS".

When I select "help -> about" in the codeblocks IDE, it displays a dialog that says:

10.05

and underneath that it says in smaller text:

Build: May 27 2010, 11:01:42 - wx2.8.10 (Linux, unicode) - 64-bit.


What is a "debugger branch"?

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: 64-bit register values and SIMD
« Reply #4 on: February 23, 2012, 01:49:03 am »
What is a "debugger branch"?
http://forums.codeblocks.org/index.php/topic,15947.0.html

This is all rather greek to me.  So let me ask this question (taken from the link you provided above).  To get newer updated versions of linux64 codeblocks periodically (nightly builds or something like that), I should put the following into my ubuntu64 /etc/apt/sources.list file:

deb http://apt.jenslody.de/ any dbg
deb-src http://apt.jenslody.de/ any dbg


Then when I update my system it will install the new version?  Or what?

PS:  I still don't know what a "debugger branch" is?  How is that different from the latest "nightly build"?
« Last Edit: February 23, 2012, 01:58:45 am by bootstrap »

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: 64-bit register values and SIMD
« Reply #5 on: February 23, 2012, 06:32:44 am »
What is a "debugger branch"?
http://forums.codeblocks.org/index.php/topic,15947.0.html

This is all rather greek to me.  So let me ask this question (taken from the link you provided above).  To get newer updated versions of linux64 codeblocks periodically (nightly builds or something like that), I should put the following into my ubuntu64 /etc/apt/sources.list file:

deb http://apt.jenslody.de/ any dbg
deb-src http://apt.jenslody.de/ any dbg


Then when I update my system it will install the new version?  Or what?
Yes, this should work.
Normally, my repo gets more often updated as the windows nightlies.
But you should also read the notes for ubuntu users on my server .


PS:  I still don't know what a "debugger branch" is?  How is that different from the latest "nightly build"?
A branch with many new debugger features, that will be merged back into trunk in the (more or less) near future.
All other features are normally in sync with trunk.

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
re: 64-bit register values and SIMD
« Reply #6 on: February 23, 2012, 11:49:05 pm »
Okay, I followed your instructions jens, and it did install svn7844 and wx2.8.12 and it does execute.

Unfortunately, I don't see that it fixed my problems.  Are my problems fixed yet and I don't see it (or need to select something somewhere), or are they not fixed?

PS:  The new version often doesn't display anything in the disassembly window when at a breakpoint while the old version did.  Is that a new bug?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: 64-bit register values and SIMD
« Reply #7 on: February 24, 2012, 06:40:45 am »
7844 is not the debugger branch, as you have written yourself (highlighting by me):
[...] I should put the following into my ubuntu64 /etc/apt/sources.list file:

deb http://apt.jenslody.de/ any dbg
deb-src http://apt.jenslody.de/ any dbg

[...]
you should not use the main, but the dbg section !
Revision for debugger-branch in my server is 7790 actuallly.

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: 64-bit register values and SIMD
« Reply #8 on: February 25, 2012, 04:35:16 am »
7844 is not the debugger branch, as you have written yourself (highlighting by me):
[...] I should put the following into my ubuntu64 /etc/apt/sources.list file:

deb http://apt.jenslody.de/ any dbg
deb-src http://apt.jenslody.de/ any dbg

[...]
you should not use the main, but the dbg section !
Revision for debugger-branch in my server is 7790 actuallly.
Yikes, confusion!

Okay, I changed "any main" to "any dbg" in my /etc/apt/sources.list file and executed "sudo apt-get update".  That seemed to work, meaning it seemed to download and do its things, but when I run codeblocks it still runs the version I got yesterday (svn 7844).  Why is that?  Do I have two versions of codeblocks on my system somewhere?  A "find" command doesn't find anything that looks likely.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: 64-bit register values and SIMD
« Reply #9 on: February 25, 2012, 09:03:58 am »
apt-get update does not update the software, it only updates the package cache.
By the way, debugger-branch is now 7845.

You can try apt-get upgrade to update your system, but I recommend a package manager with a gui, like synaptic .

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: 64-bit register values and SIMD
« Reply #10 on: February 27, 2012, 09:06:39 am »
apt-get update does not update the software, it only updates the package cache.
By the way, debugger-branch is now 7845.

You can try apt-get upgrade to update your system, but I recommend a package manager with a gui, like synaptic .

When I run codeblocks it says "svn7844" in the startup dialog and in the "help->about" dialog.

However, the register window still only displays 32-bit hexadecimal values for the registers, though the decimal values do reflect the full 64-bit values.  However, the decimal values aren't much use for looking for bits and bit-fields, or for displaying address ranges in memory.  Are you saying this SHOULD be fixed in svn7844, but I'm the only one it doesn't work for?

However, I still have the NEW problem that the disassembly window doesn't display anything when I "run to cursor" or "single step".  However, the disassembly window DOES fill up with contents when I "step into" a function.  I never had a problem with the disassembly window in the original vanilla 10.05 release.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12006
    • Travis build status
Re: 64-bit register values and SIMD
« Reply #11 on: February 27, 2012, 09:19:56 am »
If you have "Settings -> Debugger..." and "Debug->Active debuggers" menus then you have the debugger's branch version.

About the bugs:
1. Yes, it seems the cpu registers window uses 32 bit numbers for the hex values
2. You'll have to show a simple example code and the exact steps, so we can reproduce the disassembly problem. It seems to work correctly here.

Edit:
Code: [Select]
Index: src/src/cpuregistersdlg.cpp
===================================================================
--- src/src/cpuregistersdlg.cpp (revision 7856)
+++ src/src/cpuregistersdlg.cpp (working copy)
@@ -66,7 +66,7 @@
     }
 
     wxString fmt;
-    fmt.Printf(_T("0x%x"), (size_t)value);
+    fmt.Printf(_T("0x%lx"), /*(size_t)*/value);
     m_pList->SetItem(idx, 1, fmt);
     fmt.Printf(_T("%lu"), value);
     m_pList->SetItem(idx, 2, fmt);

This patch seems to fix it, I've tried it on 64bit linux only.
« Last Edit: February 27, 2012, 09:25:30 am by oBFusCATed »
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: 64-bit register values and SIMD
« Reply #12 on: February 27, 2012, 09:55:07 am »
When I run codeblocks it says "svn7844" in the startup dialog and in the "help->about" dialog.
7844 is not the debugger branch, as you have written yourself (highlighting by me):
[...] I should put the following into my ubuntu64 /etc/apt/sources.list file:

deb http://apt.jenslody.de/ any dbg
deb-src http://apt.jenslody.de/ any dbg

[...]
you should not use the main, but the dbg section !
[...]
By the way, debugger-branch is now 7845.

But if I understand oBFusCATed correctly it does not work there at the moment.

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: 64-bit register values and SIMD
« Reply #13 on: February 27, 2012, 12:31:45 pm »
Looks like now I can't figure out how to make ubuntu64 install the debug branch.  I *have* replaced those lines in the sources.list file and updated, but I guess I still have the main branch.  Is it now impossible to get the debug branch due to version numbering or something?

As for the disassembly window not showing contents, I generally start running with "run to cursor".

Another question.  Is it supposed to be possible to change register values while at a breakpoint?  I can't seem to find a way, but other debuggers I've seen (and written) allow that.

When I ran synaptic, I couldn't figure out how to get it to do anything sensible.  Any simpler ways that actually (horror) becoming expert at synaptic.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12006
    • Travis build status
Re: 64-bit register values and SIMD
« Reply #14 on: February 27, 2012, 12:35:38 pm »
As for the disassembly window not showing contents, I generally start running with "run to cursor".
Exact steps, please, but first make sure you have the debugger's branch. There were some fixes in regard to the disassembly.

Another question.  Is it supposed to be possible to change register values while at a breakpoint?  I can't seem to find a way, but other debuggers I've seen (and written) allow that.
In debugger's branch you can execute gdb commands, there is an entry box at the bottom of the debugger log.
Only you'll have to learn what are the exact gdb commands. I guess there is a room for improvement here :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]