Recent

Author Topic: changing register value or next execution statement.  (Read 5055 times)

taazz

  • Hero Member
  • *****
  • Posts: 5368
changing register value or next execution statement.
« on: November 27, 2015, 12:36:40 pm »
Is it possible to change register values from inside the IDE while debugging? I haven't found anything that will allow me to do so
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

MathMan

  • Sr. Member
  • ****
  • Posts: 325
Re: changing register value or next execution statement.
« Reply #1 on: November 27, 2015, 01:47:18 pm »
Is it possible to change register values from inside the IDE while debugging? I haven't found anything that will allow me to do so

Hm, good question though I never had the requirement to do so. I understand your "... haven't found anything ..." to mean that you tried to change reg values in the register pane of the debugger, correct?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: changing register value or next execution statement.
« Reply #2 on: November 27, 2015, 02:09:13 pm »
Hm, good question though I never had the requirement to do so.
It helps cut down debugging time when the error is not reproducible on every run or when I have to wait until a loop reaches lets say 1024 or 1500 runs and yes generally its not something required all the time but can speed up extremely some things.
I understand your "... haven't found anything ..." to mean that you tried to change reg values in the register pane of the debugger, correct?
I have tried a number of things so far, from execute mov assembly command in the evaluate modify dialog to change the value of eip in the registers window which allows you to edit the name of the register but not its value for some stupid reason, search both popup menus on the editor and the assembly dialog for "set next command" or similar delphi compatible description/name and of course I did a grep in the lazarus directory for the same description to see if anything is in the works.

I think I have exhausted my options with out success hopefully the answer will not be along the lines of the sigsegv exception that can not be handled in the current implementation.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

mse

  • Sr. Member
  • ****
  • Posts: 286
Re: changing register value or next execution statement.
« Reply #3 on: November 27, 2015, 02:17:16 pm »
Is it possible to change register values from inside the IDE while debugging? I haven't found anything that will allow me to do so
MSEide supports it. Simply edit the values in the CPU window. On Lazarus you could try to use $<registername> in a watch expression.
« Last Edit: November 27, 2015, 02:19:21 pm by mse »

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: changing register value or next execution statement.
« Reply #4 on: November 27, 2015, 02:20:49 pm »
GDB itself should be able to change the registers. (http://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_60.html)
But I'm not sure if you can manipulate or give commands to GDB during debugging.
There is the "Debug Output" window but that just shows the GDB-output.

Is there any way to push commands to GDB from Lazarus-IDE during debugging?

(Otherwise the "Register"-windows should be adjusted to change the values after which Lazarus-IDE can push the correct commands to GDB.)

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: changing register value or next execution statement.
« Reply #5 on: November 27, 2015, 02:51:53 pm »
Is it possible to change register values from inside the IDE while debugging? I haven't found anything that will allow me to do so
MSEide supports it. Simply edit the values in the CPU window. On Lazarus you could try to use $<registername> in a watch expression.
$ is used for hex numbers in pascal haven't found any way to show the contents of a register in a watch and tried all the known chars ($,#,!,% etc) although a bit hasty I admit.
Is there any way to push commands to GDB from Lazarus-IDE during debugging?
Well If I new any way to do that I wouldn't be here asking would I?  I think that your idea is excellent,  instead of a debug view window we can have a debug console window that one can also type in gdb commands along with the output.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9793
  • Debugger - SynEdit - and more
    • wiki
Re: changing register value or next execution statement.
« Reply #6 on: November 27, 2015, 03:08:09 pm »
its  a missing feature.

$ does not work because the IDE translates it to 0x so gdb takes it as hex.

You can compile the ide with DBG_WITH_DEBUGGER_DEBUG defined. That gives you a direct interface to gdb in the "debug output" window.
This is not an official feature, it works as is, and thats all.
Note, you must not (are not allowed to) issue run/step commands this way. doing so IDE and gdb will loose sync.
But you can modify data.

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: changing register value or next execution statement.
« Reply #7 on: November 27, 2015, 03:43:17 pm »
Is there any way to push commands to GDB from Lazarus-IDE during debugging?

You can compile the ide with DBG_WITH_DEBUGGER_DEBUG defined. That gives you a direct interface to gdb in the "debug output" window.
This is not an official feature, it works as is, and thats all.
Yeah, that was what I was looking for and was suggesting.
Tools > Configure "Build Lazarus" > Edit Defines and add "DBG_WITH_DEBUGGER_DEBUG"
Click its checkmark and choose build.

After the compile and restart you can choose View > Debug Windows > Debug Output
and you get an extra line to enter a command and an execute button.

With the correct commands you can change the registers.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: changing register value or next execution statement.
« Reply #8 on: November 27, 2015, 04:38:12 pm »
thank you martin that works for me, although I have an other problem now it seems that the break points are not working any more for dwarf or dwarf 2 debug info but hey that might be completely unrelated to the debug parameter. in any case thank you that will help a lot in the next couple of weeks.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9793
  • Debugger - SynEdit - and more
    • wiki
Re: changing register value or next execution statement.
« Reply #9 on: November 27, 2015, 05:43:05 pm »
breakpoints should not be affected by this. (So long as you do not issue run or step commands through the gdb input).

Just check the gdb output and see if it shows any errors.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: changing register value or next execution statement.
« Reply #10 on: November 27, 2015, 10:11:49 pm »
breakpoints should not be affected by this. (So long as you do not issue run or step commands through the gdb input).

Just check the gdb output and see if it shows any errors.
I did not think that it is affected but it seems that for some reason setting the application to dwarf or dwarf 2 debug set the debugger is not able to recognize them, even the blue dots in the side of the editor are not shown, changing it back to automatic it shows the blue dots and the break points work again. It seems to me that for some reason the debug data are not recognized or something along those lines it does not matter much I can work but I will run any number of test you might need now that I have the problem in front of me.

Edit:

After a clean & build cycle on both the application and the packages it uses using dwarf debug info the problem is no longer present I'll try to run various tests and report back any interesting results.
« Last Edit: November 27, 2015, 11:17:07 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018