Recent

Author Topic: Debug with ssh problem.  (Read 7237 times)

hosune7845

  • Full Member
  • ***
  • Posts: 159
Debug with ssh problem.
« on: May 06, 2016, 06:56:28 am »
Hi.

I use Lazarus on Ubuntu x32 on Host PC for arm-linux cross-compiling.

I compiled successfully for arm-linux binary. But I cannot debug.

The binary(executable) file is shared by SAMBA.(HOST-TARGET)

And I followed this instruction for SSH debug : http://wiki.freepascal.org/Remote_Debugging

First. I don't understand step 6

Quote
For remote debug we need to set the correct value for "Host application", "Command line parameters" and "Working directory". Remember: It is remote!

I set Host application to host binary path, Command line parameters to blink, Working directory to Target binary path.

But gdb output is
Quote
(gdb Undefined command: "gdb", Try "help".

How can I solve this problem?

-----------

I tried also with gdbserver.

Here's my step

1. set Lazarus tools-option-Debugger-General-debugger type to gdbserver
2. set Lazarus tools-option-Debugger-General-debugger_remote_hostname to my target IP
3. set Lazarus tools-option-Debugger-General-debugger_remote_part to 2345
4. In Target, run "gdbserver HOSTIP:2345 binary/path/

But debugger Output is with error :
Quote
=thread-group-added,id="i1"
(gdb)
<-gdb-set confirm off>
^done
(gdb)
<-gdb-set new-console off>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<set width 50000>
&"set width 50000\n"
=cmd-param-changed,param="width",value="50000"
^done
(gdb)
<set target-async on>
&"set target-async on\n"
=cmd-param-changed,param="mi-async",value="on"
^done
(gdb)
<show target-async>
&"show target-async\n"
~"Whether MI is in asynchronous mode is on.\n"
^done
(gdb)
<-gdb-version>
~"GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11\n"
~"Copyright (C) 2016 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-linux-gnu\".\nType \"show configuration\" for configuration details."
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\".\n"
^done
(gdb)
<target remote 192.168.0.35:2345>
&"target remote 192.168.0.35:2345\n"
~"Remote debugging using 192.168.0.35:2345\n"
&"warning: Architecture rejected target-supplied description\n"
=thread-group-started,id="i1",pid="2860"
=thread-created,id="1",group-id="i1"
=thread-group-exited,id="i1"
&"Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030f0ffbe00000000c0fbfdb6300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
^error,msg="Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030f0ffbe00000000c0fbfdb6300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
(gdb)
<kill>

Plz answer the question.

I'll use only one.

hosune7845

  • Full Member
  • ***
  • Posts: 159
Re: Debug with ssh problem.
« Reply #1 on: May 06, 2016, 09:52:20 am »
I solved with gdbserver.

GDB in Host is not compiled for target=arm-linux host=i386-linux. here's instruction from http://embryo1103.tistory.com/45#recentTrackback

Quote
1. download latest version of gdb source from www.gnu.org/software/gdb

2. untar source
localhost opt # tar xvzf gdb-6.6.tar.gz
localhost opt # cd gdb-6.6

3.configure and make - make install
localhost gdb-6.6 # ./configure --build=i686-linux --host=i686-linux --target=arm-linux --prefix=$PWD/build
localhost gdb-6.6 # make && make install

4. u can see gdb binary in build/bin as arm-linux-gdb
localhost gdb-6.6 # cp build/bin/arm-linux-gdb

But cannot set breakpoint with this error :
Quote
<-break-delete 2>
^error,msg="Warning:\nCannot insert breakpoint 4: Cannot execute this command while the target is running.\nUse the \"interrupt\" command to stop the target\nand then try again.\n"


anyidea?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: Debug with ssh problem.
« Reply #2 on: May 06, 2016, 04:36:00 pm »
First of all, unfortunately both remote debug methods had little maintenance lately, so there may be issues... lets see.

gdbserver is probably better working.

ssh only works, if gdb on the remote supports async mode.

The binary(executable) file is shared by SAMBA.(HOST-TARGET)

And I followed this instruction for SSH debug : http://wiki.freepascal.org/Remote_Debugging

First. I don't understand step 6

Quote
For remote debug we need to set the correct value for "Host application", "Command line parameters" and "Working directory". Remember: It is remote!

I set Host application to host binary path, Command line parameters to blink, Working directory to Target binary path.
"Host application"
If you shared /home/hosune  on your remote computer, and you access it on your local pc as /mnt/samba/hosune, then "Host application" /home/hosune is  /home/hosune/project1  (as seen by the remote pc)

About the IDE options, I think the image on the wiki is wrong. It the "debugger type and path" should afaik be the path to ssh (with all ssh commandline, if any needed)..
"Remote_GDB_exe" is more likely /usr/bin/gdb  (whatever it actually is on the remote system)


Quote
But cannot set breakpoint with this error :
Quote
<-break-delete 2>
^error,msg="Warning:\nCannot insert breakpoint 4: Cannot execute this command while the target is running.\nUse the \"interrupt\" command to stop the target\nand then try again.\n"
No idea, can you get a logfile http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session ?

hosune7845

  • Full Member
  • ***
  • Posts: 159
Re: Debug with ssh problem.
« Reply #3 on: May 09, 2016, 09:21:30 am »
Thank you.
Quote
First of all, unfortunately both remote debug methods had little maintenance lately, so there may be issues... lets see.

gdbserver is probably better working.

ssh only works, if gdb on the remote supports async mode.

My Target supports async mode.

Quote
First of all, unfortunately both remote debug methods had little maintenance lately, so there may be issues... lets see.

gdbserver is probably better working.

ssh only works, if gdb on the remote supports async mode.

Plz let me know need to set all options?

Quote
No idea, can you get a logfile http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session ?
I tried to run Lazarus with  "--debug-log=LOG_FILE  --debug-enable=DBG_CMD_ECHO,DBG_STATE,DBG_DATA_MONITORS,DBGMI_QUEUE_DEBUG,DBGMI_TYPE_INFO"

But if i run-debug, my target is down %)

Without the option, it's fine.

I compiled my Host gdb as host=i386-linux target=arm-linux, target gdb as host=target=arm-linux.

Also, i use VMware(like-Virtual Box) on my Win7PC.

Strangely, if i access to my target with gdbserver, target makes me know "accessed from my win7pc IP". Not my Ubuntu IP. is it right?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: Debug with ssh problem.
« Reply #4 on: May 09, 2016, 04:22:18 pm »
Quote
My Target supports async mode.
You can still try ssh.
If async does not work, then the "pause" button will not work. And you also will not be able to change breakpoints while the app is running.

Quote
Plz let me know need to set all options?
ssh, or gdbserver? I did point out what was needed for ssh (see earlier post).

gdbserver, I need more info what goes wrong.

Quote
But if i run-debug, my target is down
What does that mean? How does that manifest?

Anyway, instead of a log, copy and paste the output of the "debug output" window. (Also described on the wiki).
Important: Make sure the window is open before you press "run".

Quote
I compiled my Host gdb as host=i386-linux target=arm-linux, target gdb as host=target=arm-linux.
I am not sure you need a special host gdb. But I didnt do much testing on that.

Quote
Strangely, if i access to my target with gdbserver, target makes me know "accessed from my win7pc IP". Not my Ubuntu IP. is it right?
Is ubuntu running in the virtualbox?
In that case you probably use NAT for networking. So yes, then it uses the win IP.

hosune7845

  • Full Member
  • ***
  • Posts: 159
Re: Debug with ssh problem.
« Reply #5 on: May 10, 2016, 02:58:57 am »
Thank you and your answers.

Quote
ssh, or gdbserver? I did point out what was needed for ssh (see earlier post).

gdbserver, I need more info what goes wrong.

Sorry, it's ssh.

In your post,
Quote
"Host application"
If you shared /home/hosune  on your remote computer, and you access it on your local pc as /mnt/samba/hosune, then "Host application" /home/hosune is  /home/hosune/project1  (as seen by the remote pc)

About the IDE options, I think the image on the wiki is wrong. It the "debugger type and path" should afaik be the path to ssh (with all ssh commandline, if any needed)..
"Remote_GDB_exe" is more likely /usr/bin/gdb  (whatever it actually is on the remote system)
You said "Host Application", "Debugger type and path", "Remote_GDB_exe".

So i set Host App to binary in shared folder, Debugger type n path to ssh path, Remote_GDB_exe to target gdb path. Is it right?

Quote
Quote
I solved this problem. It was app crash.

What does that mean? How does that manifest?

Anyway, instead of a log, copy and paste the output of the "debug output" window. (Also described on the wiki).
Important: Make sure the window is open before you press "run".
I did mean if run Lazarus with the option, My target is going to shutdown.

And, Here's Debug output.
Quote
=thread-group-added,id="i1"
(gdb)
<-gdb-set confirm off>
^done
(gdb)
<-gdb-set new-console off>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<set width 50000>
&"set width 50000\n"
=cmd-param-changed,param="width",value="50000"
^done
(gdb)
<set target-async on>
&"set target-async on\n"
=cmd-param-changed,param="mi-async",value="on"
^done
(gdb)
<show target-async>
&"show target-async\n"
~"Whether MI is in asynchronous mode is on.\n"
^done
(gdb)
<-gdb-version>
~"GNU gdb (GDB) 7.11\n"
~"Copyright (C) 2016 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"--host=i386-linux --target=arm-linux\".\nType \"show configuration\" for configuration details."
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\".\n"
^done
(gdb)
<target remote 192.168.0.23:2345>
&"target remote 192.168.0.23:2345\n"
~"Remote debugging using 192.168.0.23:2345\n"
=thread-group-started,id="i1",pid="1769"
=thread-created,id="1",group-id="i1"
~"0xb6fdfbc0 in ?? ()\n"
*stopped,frame={addr="0xb6fdfbc0",func="??",args=[]},thread-id="1",stopped-threads="all",core="3"
^done
(gdb)
<-gdb-set env XDG_VTNR=7>
^done
(gdb)
<-gdb-set env XDG_SESSION_ID=c2>
^done
(gdb)
<-gdb-set env XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/hsson>
^done
(gdb)
<-gdb-set env CLUTTER_IM_MODULE=xim>
^done
(gdb)
<-gdb-set env SESSION=ubuntu>
^done
(gdb)
<-gdb-set env GPG_AGENT_INFO=/home/hsson/.gnupg/S.gpg-agent:0:1>
^done
(gdb)
<-gdb-set env VTE_VERSION=4205>
^done
(gdb)
<-gdb-set env TERM=xterm-256color>
^done
(gdb)
<-gdb-set env SHELL=/bin/bash>
^done
(gdb)
<-gdb-set env QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1>
^done
(gdb)
<-gdb-set env WINDOWID=52428810>
^done
(gdb)
<-gdb-set env GNOME_KEYRING_CONTROL=>
~"Setting environment variable \"GNOME_KEYRING_CONTROL\" to null value.\n"
^done
(gdb)
<-gdb-set env UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1383>
^done
(gdb)
<-gdb-set env GTK_MODULES=gail:atk-bridge:unity-gtk-module>
^done
(gdb)
<-gdb-set env USER=root>
^done
(gdb)
<-gdb-set env QT_ACCESSIBILITY=1>
^done
(gdb)
<-gdb-set env LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:>
^done
(gdb)
<-gdb-set env XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0>
^done
(gdb)
<-gdb-set env XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0>
^done
(gdb)
<-gdb-set env SSH_AUTH_SOCK=/run/user/1000/keyring/ssh>
^done
(gdb)
<-gdb-set env DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path>
^done
(gdb)
<-gdb-set env XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg>
^done
(gdb)
<-gdb-set env MAIL=/var/mail/root>
^done
(gdb)
<-gdb-set env DESKTOP_SESSION=ubuntu>
^done
(gdb)
<-gdb-set env PATH=/usr/local/lazarus/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games>
^done
(gdb)
<-gdb-set env QT_QPA_PLATFORMTHEME=appmenu-qt5>
^done
(gdb)
<-gdb-set env QT_IM_MODULE=ibus>
^done
(gdb)
<-gdb-set env JOB=unity-settings-daemon>
^done
(gdb)
<-gdb-set env PWD=/home/hsson>
^done
(gdb)
<-gdb-set env XDG_SESSION_TYPE=x11>
^done
(gdb)
<-gdb-set env XMODIFIERS=@im=ibus>
^done
(gdb)
<-gdb-set env LANG=en_US.UTF-8>
^done
(gdb)
<-gdb-set env GNOME_KEYRING_PID=>
~"Setting environment variable \"GNOME_KEYRING_PID\" to null value.\n"
^done
(gdb)
<-gdb-set env MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path>
^done
(gdb)
<-gdb-set env GDM_LANG=en_US>
^done
(gdb)
<-gdb-set env COMPIZ_CONFIG_PROFILE=ubuntu>
^done
(gdb)
<-gdb-set env IM_CONFIG_PHASE=1>
^done
(gdb)
<-gdb-set env GDMSESSION=ubuntu>
^done
(gdb)
<-gdb-set env GTK2_MODULES=overlay-scrollbar>
^done
(gdb)
<-gdb-set env SESSIONTYPE=gnome-session>
^done
(gdb)
<-gdb-set env SHLVL=2>
^done
(gdb)
<-gdb-set env XDG_SEAT=seat0>
^done
(gdb)
<-gdb-set env HOME=/root>
^done
(gdb)
<-gdb-set env LANGUAGE=en_US>
^done
(gdb)
<-gdb-set env GNOME_DESKTOP_SESSION_ID=this-is-deprecated>
^done
(gdb)
<-gdb-set env UPSTART_INSTANCE=>
~"Setting environment variable \"UPSTART_INSTANCE\" to null value.\n"
^done
(gdb)
<-gdb-set env LOGNAME=root>
^done
(gdb)
<-gdb-set env XDG_SESSION_DESKTOP=ubuntu>
^done
(gdb)
<-gdb-set env UPSTART_EVENTS=xsession started>
^done
(gdb)
<-gdb-set env COMPIZ_BIN_PATH=/usr/bin/>
^done
(gdb)
<-gdb-set env DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-AaGRNGt5vM>
^done
(gdb)
<-gdb-set env XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop>
^done
(gdb)
<-gdb-set env QT4_IM_MODULE=xim>
^done
(gdb)
<-gdb-set env LESSOPEN=| /usr/bin/lesspipe %s>
^done
(gdb)
<-gdb-set env UPSTART_JOB=unity7>
^done
(gdb)
<-gdb-set env INSTANCE=>
~"Setting environment variable \"INSTANCE\" to null value.\n"
^done
(gdb)
<-gdb-set env DISPLAY=:0>
^done
(gdb)
<-gdb-set env XDG_RUNTIME_DIR=/run/user/1000>
^done
(gdb)
<-gdb-set env GTK_IM_MODULE=ibus>
^done
(gdb)
<-gdb-set env XDG_CURRENT_DESKTOP=Unity>
^done
(gdb)
<-gdb-set env LESSCLOSE=/usr/bin/lesspipe %s %s>
^done
(gdb)
<-gdb-set env XAUTHORITY=/home/hsson/.Xauthority>
^done
(gdb)
<-gdb-set env _=/usr/local/lazarus/startlazarus>
^done
(gdb)
<-gdb-set env LIBOVERLAY_SCROLLBAR=0>
^done
(gdb)
<-file-exec-and-symbols "/home/hsson/Desktop/hssonpc/project1">
^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<-environment-cd .>
^done
(gdb)
<-environment-cd "/home/hsson/Desktop/hssonpc/">
^done
(gdb)
<-data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC>
^error,msg="No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context."
(gdb)
<info functions FPC_CPUINIT>
&"info functions FPC_CPUINIT\n"
~"All functions matching regular expression \"FPC_CPUINIT\":\n"
~"\nNon-debugging symbols:\n"
~"0x00027640  SYSTEM_$$_FPC_CPUINIT\n"
^done
(gdb)
<-exec-arguments >
^done
(gdb)
<set inferior-tty /dev/pts/6>
&"set inferior-tty /dev/pts/6\n"
=cmd-param-changed,param="inferior-tty",value="/dev/pts/6"
^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<ptype TObject>
&"ptype TObject\n"
~"type = TOBJECT = class \n"
~"  public\n"
~"    constructor CREATE (TOBJECT, POINTER) : ^TOBJECT;\n"
~"    destructor  DESTROY (TOBJECT, POINTER); virtual;\n"
~"    function  NEWINSTANCE (unnamedtype) : ^TOBJECT; virtual;\n"
~"    procedure FREEINSTANCE (TOBJECT); virtual;\n"
~"    function  SAFECALLEXCEPTION (TOBJECT, TOBJECT, POINTER) : HRESULT; virtual;\n"
~"    procedure DEFAULTHANDLER (TOBJECT, var); virtual;\n"
~"    procedure FREE (TOBJECT);\n"
~"    function  INITINSTANCE (unnamedtype, POINTER) : ^TOBJECT;\n"
~"    procedure CLEANUPINSTANCE (TOBJECT);\n"
~"    function  CLASSTYPE (unnamedtype) : record <unknown>;\n"
~"    function  CLASSINFO (unnamedtype) : POINTER;\n"
~"    function  CLASSNAME (unnamedtype, SHORTSTRING) : SHORTSTRING;\n"
~"    function  CLASSNAMEIS (unnamedtype, SHORTSTRING) : BOOLEAN;\n"
~"    function  CLASSPARENT (unnamedtype) : record <unknown>;\n"
~"    function  INSTANCESIZE (unnamedtype) : LONGINT;\n"
~"    function  INHERITSFROM (unnamedtype, TCLASS) : BOOLEAN;\n"
~"    function  STRINGMESSAGETABLE (unnamedtype) : PSTRINGMESSAGETABLE;\n"
~"    function  METHODADDRESS (unnamedtype, SHORTSTRING) : POINTER;\n"
~"    function  METHODNAME (unnamedtype, SHORTSTRING, POINTER) : SHORTSTRING;\n"
~"    function  FIELDADDRESS (TOBJECT, SHORTSTRING) : POINTER;\n"
~"    procedure AFTERCONSTRUCTION (TOBJECT); virtual;\n"
~"    procedure BEFOREDESTRUCTION (TOBJECT); virtual;\n"
~"    procedure DEFAULTHANDLERSTR (TOBJECT, var); virtual;\n"
~"    procedure DISPATCH (TOBJECT, var); virtual;\n"
~"    procedure DISPATCHSTR (TOBJECT, var); virtual;\n"
~"    function  GETINTERFACE (TOBJECT, TGUID, out) : BOOLEAN;\n"
~"    function  GETINTERFACEBYSTR (TOBJECT, SHORTSTRING, out) : BOOLEAN;\n"
~"    function  GETINTERFACEWEAK (TOBJECT, TGUID, out) : BOOLEAN;\n"
~"    function  GETINTERFACEENTRY (unnamedtype, TGUID) : PINTERFACEENTRY;\n"
~"    function  GETINTERFACEENTRYBYSTR (unnamedtype, SHORTSTRING) : PINTERFACEENTRY;\n"
~"    function  GETINTERFACETABLE (unnamedtype) : PINTERFACETABLE;\n"
~"    function  UNITNAME (unnamedtype, ANSISTRING) : ANSISTRING;\n"
~"    function  EQUALS (TOBJECT, TOBJECT) : BOOLEAN; virtual;\n"
~"    function  GETHASHCODE (TOBJECT) : LONGINT; virtual;\n"
~"    function  TOSTRING (TOBJECT, ANSISTRING) : ANSISTRING; virtual;\n"
~"end\n"
^done
(gdb)
<ptype Exception>
&"ptype Exception\n"
~"type = EXCEPTION = class : public TOBJECT \n"
~"  private\n"
~"    FMESSAGE : ANSISTRING;\n"
~"    FHELPCONTEXT : LONGINT;\n"
~"\n"
~"  public\n"
~"    constructor CREATE (EXCEPTION, POINTER, ANSISTRING) : ^EXCEPTION;\n"
~"    constructor CREATEFMT (EXCEPTION, POINTER, ANSISTRING, unnamedtype, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATERES (EXCEPTION, POINTER, PSTRING) : ^EXCEPTION;\n"
~"    constructor CREATERESFMT (EXCEPTION, POINTER, PSTRING, unnamedtype, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATEHELP (EXCEPTION, POINTER, ANSISTRING, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATEFMTHELP (EXCEPTION, POINTER, ANSISTRING, unnamedtype, LONGINT, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATERESHELP (EXCEPTION, POINTER, PSTRING, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATERESFMTHELP (EXCEPTION, POINTER, PSTRING, unnamedtype, LONGINT, LONGINT) : ^EXCEPTION;\n"
~"    function  TOSTRING (EXCEPTION, ANSISTRING) : ANSISTRING; virtual;\n"
~"end\n"
^done
(gdb)
<ptype Shortstring>
&"ptype Shortstring\n"
~"type = record \n"
~"    length : BYTE;\n"
~"    st : array [1..255] of CHAR;\n"
~"end\n"
^done
(gdb)
<ptype pointer>
&"ptype pointer\n"
~"type = ^POINTER\n"
^done
(gdb)
<ptype byte>
&"ptype byte\n"
~"type = BYTE\n"
^done
(gdb)
<set print elements 2500>
&"set print elements 2500\n"
=cmd-param-changed,param="print elements",value="2500"
^done
(gdb)
<info file>
&"info file\n"
~"Symbols from \"/home/hsson/Desktop/hssonpc/project1\".\n"
~"Remote serial target in gdb-specific protocol:\n"
~"Debugging a target over a serial line.\n"
~"\tWhile running this, GDB does not access memory from...\n"
~"Local exec file:\n"
~"\t`/home/hsson/Desktop/hssonpc/project1', file type elf32-littlearm.\n"
~"\tEntry point: 0x1e12c\n"
~"\t0x00008114 - 0x0000812d is .interp\n"
~"\t0x00008130 - 0x00008150 is .note.ABI-tag\n"
~"\t0x00008150 - 0x0000a620 is .hash\n"
~"\t0x0000a620 - 0x0000f8d0 is .dynsym\n"
~"\t0x0000f8d0 - 0x000170f6 is .dynstr\n"
~"\t0x000170f6 - 0x00017b4c is .gnu.version\n"
~"\t0x00017b4c - 0x00017bac is .gnu.version_r\n"
~"\t0x00017bac - 0x00017c6c is .rel.dyn\n"
~"\t0x00017c6c - 0x0001a4ac is .rel.plt\n"
~"\t0x0001a4ac - 0x0001a4b8 is .init\n"
~"\t0x0001a4b8 - 0x0001e12c is .plt\n"
~"\t0x0001e12c - 0x0046a918 is .text\n"
~"\t0x0046a918 - 0x0046a920 is .fini\n"
~"\t0x0046a920 - 0x005c6de8 is .rodata\n"
~"\t0x005c6de8 - 0x005c6dec is .eh_frame\n"
~"\t0x005cedec - 0x005cedf0 is .init_array\n"
~"\t0x005cedf0 - 0x005cedf4 is .fini_array\n"
~"\t0x005cedf4 - 0x005cedf8 is .jcr\n"
~"\t0x005cedf8 - 0x005cef50 is .dynamic\n"
~"\t0x005cef50 - 0x005d0380 is .got\n"
~"\t0x005d0380 - 0x005e6b20 is .data\n"
~"\t0x005e6b20 - 0x0060ff0c is fpc.resources\n"
~"\t0x0060ff10 - 0x0065cff0 is .bss\n"
~"\t0x0065cff0 - 0x0065d0e8 is fpc.reshandles\n"
^done
(gdb)
<-data-evaluate-expression sizeof(POINTER)>
^done,value="4"
(gdb)
<-break-insert -f foo>
&"Function \"foo\" not defined.\n"
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="foo",times="0",original-location="foo"}
(gdb)
<-break-delete 1>
^done
(gdb)
<-break-insert main>
^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0001e248",func="main",file="project1.lpr",fullname="/home/hsson/Desktop/lazarus/test/project1.lpr",line="16",thread-groups=["i1"],times="0",original-location="main"}
(gdb)
<-break-insert *123180>
^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x0001e12c",at="<_start>",thread-groups=["i1"],times="0",original-location="*123180"}
(gdb)
<-break-insert +0>
^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x0001e248",func="main",file="project1.lpr",fullname="/home/hsson/Desktop/lazarus/test/project1.lpr",line="12",thread-groups=["i1"],times="0",original-location="/home/hsson/Desktop/lazarus/test/project1.lpr:+0"}
(gdb)
<-exec-continue &>
^running
*running,thread-id="all"
(gdb)
(gdb)
<-break-delete 2>
^error,msg="Warning:\nCannot insert breakpoint 4: Cannot execute this command while the target is running.\nUse the \"interrupt\" command to stop the target\nand then try again.\n"
(gdb)
<kill>
« Last Edit: May 10, 2016, 03:42:38 am by hosune7845 »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: Debug with ssh problem.
« Reply #6 on: May 10, 2016, 03:32:54 am »
About SSH:

Imagine the IDE sees   /mnt/remote/name/project1".

On the remote system, that same file is  /home/name/project1

"Host application"
should be the full (absolute) path /home/name/project1

"Debugger type and path"
   /usr/bin/ssh 1.2.3.4
assuming 1.2.3.4 is the remote ip
/usr/bin/ssh  must be ssh on the computer running the IDE.

the ssh client must support taking a command as the last argument.
that is    /usr/bin/ssh 1.2.3.4 ls   must run "ls" on the remote system (and you should see the directory list)

You best set up public key auth, so it will not hang on auth. Or you must be able to set the password on the commandline (SshOpt). connection and login must work without any input needed.

"Remote_GDB_exe"
the full path of gdb on the remote system.
(there is no need for a gdb on the computer with the IDE, only remote)


-------------------------------------------------------------
gdbserver:

try to change InternalStartBreak (in the debugger options, in the property grid), try gdsbMainAddr or gdsbMain

Not sure if that will solve it, there might be a 2nd issue,
The error gdb returns doesnt really make sense, it looks like there might be a bug in gdb. (or gdbserver)


hosune7845

  • Full Member
  • ***
  • Posts: 159
Re: Debug with ssh problem.
« Reply #7 on: May 10, 2016, 03:53:55 am »
About SSH:

Imagine the IDE sees   /mnt/remote/name/project1".

On the remote system, that same file is  /home/name/project1

"Host application"
should be the full (absolute) path /home/name/project1

"Debugger type and path"
   /usr/bin/ssh 1.2.3.4
assuming 1.2.3.4 is the remote ip
/usr/bin/ssh  must be ssh on the computer running the IDE.

the ssh client must support taking a command as the last argument.
that is    /usr/bin/ssh 1.2.3.4 ls   must run "ls" on the remote system (and you should see the directory list)

You best set up public key auth, so it will not hang on auth. Or you must be able to set the password on the commandline (SshOpt). connection and login must work without any input needed.

"Remote_GDB_exe"
the full path of gdb on the remote system.
(there is no need for a gdb on the computer with the IDE, only remote)


-------------------------------------------------------------
gdbserver:

try to change InternalStartBreak (in the debugger options, in the property grid), try gdsbMainAddr or gdsbMain

Not sure if that will solve it, there might be a 2nd issue,
The error gdb returns doesnt really make sense, it looks like there might be a bug in gdb. (or gdbserver)

I set ssh with your advice, And finally it works! Thank you.

« Last Edit: May 10, 2016, 04:02:13 am by hosune7845 »

hosune7845

  • Full Member
  • ***
  • Posts: 159
Re: Debug with ssh problem.
« Reply #8 on: May 11, 2016, 10:50:38 am »
After reboot Host and Target, It doesn't work  %)

Here's debugger output

Quote
</usr/bin/gdb -silent -i mi -nx>
Pseudo-terminal will not be allocated because stdin is not a terminal.
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.10.96-143 armv7l)


 * Documentation:  https://help.ubuntu.com/
 * Documentation:  https://help.ubuntu.com/


stdin: is not a tty
stdin: is not a tty
=thread-group-added,id="i1"
=thread-group-added,id="i1"
(gdb)
(gdb)
<-gdb-set confirm off>
^done
(gdb)
<-gdb-set new-console off>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<set width 50000>
&"set width 50000\n"
=cmd-param-changed,param="width",value="50000"
^done
(gdb)
<set target-async on>
&"set target-async on\n"
=cmd-param-changed,param="target-async",value="on"
^done
(gdb)
<show target-async>
&"show target-async\n"
~"Controlling the inferior in asynchronous mode is on.\n"
^done
(gdb)
<-gdb-version>
~"GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1\n"
~"Copyright (C) 2014 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"arm-linux-gnueabihf\".\nType \"show configuration\" for configuration details."
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\".\n"
^done
(gdb)
<-gdb-set env XDG_VTNR=7>
^done
(gdb)
<-gdb-set env XDG_SESSION_ID=c2>
^done
(gdb)
<-gdb-set env XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/hsson>
^done
(gdb)
<-gdb-set env CLUTTER_IM_MODULE=xim>
^done
(gdb)
<-gdb-set env SESSION=ubuntu>
^done
(gdb)
<-gdb-set env GPG_AGENT_INFO=/home/hsson/.gnupg/S.gpg-agent:0:1>
^done
(gdb)
<-gdb-set env VTE_VERSION=4205>
^done
(gdb)
<-gdb-set env TERM=xterm-256color>
^done
(gdb)
<-gdb-set env SHELL=/bin/bash>
^done
(gdb)
<-gdb-set env QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1>
^done
(gdb)
<-gdb-set env WINDOWID=48234506>
^done
(gdb)
<-gdb-set env GNOME_KEYRING_CONTROL=>
~"Setting environment variable \"GNOME_KEYRING_CONTROL\" to null value.\n"
^done
(gdb)
<-gdb-set env UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1211>
^done
(gdb)
<-gdb-set env GTK_MODULES=gail:atk-bridge:unity-gtk-module>
^done
(gdb)
<-gdb-set env USER=root>
^done
(gdb)
<-gdb-set env QT_ACCESSIBILITY=1>
^done
(gdb)
<-gdb-set env LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:>
^done
(gdb)
<-gdb-set env XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0>
^done
(gdb)
<-gdb-set env XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0>
^done
(gdb)
<-gdb-set env SSH_AUTH_SOCK=/run/user/1000/keyring/ssh>
^done
(gdb)
<-gdb-set env DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path>
^done
(gdb)
<-gdb-set env XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg>
^done
(gdb)
<-gdb-set env MAIL=/var/mail/root>
^done
(gdb)
<-gdb-set env DESKTOP_SESSION=ubuntu>
^done
(gdb)
<-gdb-set env PATH=/usr/local/lazarus/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games>
^done
(gdb)
<-gdb-set env QT_QPA_PLATFORMTHEME=appmenu-qt5>
^done
(gdb)
<-gdb-set env QT_IM_MODULE=ibus>
^done
(gdb)
<-gdb-set env JOB=unity-settings-daemon>
^done
(gdb)
<-gdb-set env PWD=/root/.ssh>
^done
(gdb)
<-gdb-set env XDG_SESSION_TYPE=x11>
^done
(gdb)
<-gdb-set env XMODIFIERS=@im=ibus>
^done
(gdb)
<-gdb-set env LANG=en_US.UTF-8>
^done
(gdb)
<-gdb-set env GNOME_KEYRING_PID=>
~"Setting environment variable \"GNOME_KEYRING_PID\" to null value.\n"
^done
(gdb)
<-gdb-set env MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path>
^done
(gdb)
<-gdb-set env GDM_LANG=en_US>
^done
(gdb)
<-gdb-set env COMPIZ_CONFIG_PROFILE=ubuntu>
^done
(gdb)
<-gdb-set env IM_CONFIG_PHASE=1>
^done
(gdb)
<-gdb-set env GDMSESSION=ubuntu>
^done
(gdb)
<-gdb-set env GTK2_MODULES=overlay-scrollbar>
^done
(gdb)
<-gdb-set env SESSIONTYPE=gnome-session>
^done
(gdb)
<-gdb-set env SHLVL=2>
^done
(gdb)
<-gdb-set env XDG_SEAT=seat0>
^done
(gdb)
<-gdb-set env HOME=/root>
^done
(gdb)
<-gdb-set env LANGUAGE=en_US>
^done
(gdb)
<-gdb-set env GNOME_DESKTOP_SESSION_ID=this-is-deprecated>
^done
(gdb)
<-gdb-set env UPSTART_INSTANCE=>
~"Setting environment variable \"UPSTART_INSTANCE\" to null value.\n"
^done
(gdb)
<-gdb-set env LOGNAME=root>
^done
(gdb)
<-gdb-set env XDG_SESSION_DESKTOP=ubuntu>
^done
(gdb)
<-gdb-set env UPSTART_EVENTS=xsession started>
^done
(gdb)
<-gdb-set env COMPIZ_BIN_PATH=/usr/bin/>
^done
(gdb)
<-gdb-set env DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-pveBMBVbeo>
^done
(gdb)
<-gdb-set env XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop>
^done
(gdb)
<-gdb-set env QT4_IM_MODULE=xim>
^done
(gdb)
<-gdb-set env LESSOPEN=| /usr/bin/lesspipe %s>
^done
(gdb)
<-gdb-set env UPSTART_JOB=unity7>
^done
(gdb)
<-gdb-set env INSTANCE=>
~"Setting environment variable \"INSTANCE\" to null value.\n"
^done
(gdb)
<-gdb-set env DISPLAY=:0>
^done
(gdb)
<-gdb-set env XDG_RUNTIME_DIR=/run/user/1000>
^done
(gdb)
<-gdb-set env GTK_IM_MODULE=ibus>
^done
(gdb)
<-gdb-set env XDG_CURRENT_DESKTOP=Unity>
^done
(gdb)
<-gdb-set env LESSCLOSE=/usr/bin/lesspipe %s %s>
^done
(gdb)
<-gdb-set env XAUTHORITY=/home/hsson/.Xauthority>
^done
(gdb)
<-gdb-set env _=/usr/local/lazarus/startlazarus>
^done
(gdb)
<-gdb-set env OLDPWD=/root>
^done
(gdb)
<-gdb-set env LIBOVERLAY_SCROLLBAR=0>
^done
(gdb)
<-file-exec-and-symbols "/home/user/program/project1">
^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<-environment-cd .>
^done
(gdb)
<-environment-cd "/home/user/program/">
^done
(gdb)
<-data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC>
^error,msg="No symbol \"FPC_THREADVAR_RELOCATE_PROC\" in current context."
(gdb)
<info functions FPC_CPUINIT>
&"info functions FPC_CPUINIT\n"
~"All functions matching regular expression \"FPC_CPUINIT\":\n"
~"\nNon-debugging symbols:\n"
~"0x00026b10  SYSTEM_$$_FPC_CPUINIT\n"
^done
(gdb)
<-exec-arguments >
^done
(gdb)
<set inferior-tty /dev/pts/1>
&"set inferior-tty /dev/pts/1\n"
=cmd-param-changed,param="inferior-tty",value="/dev/pts/1"
^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<ptype TObject>
&"ptype TObject\n"
~"type = TOBJECT = class \n"
~"  public\n"
~"    constructor CREATE (TOBJECT, POINTER) : ^TOBJECT;\n"
~"    destructor  DESTROY (TOBJECT, POINTER); virtual;\n"
~"    function  NEWINSTANCE (unnamedtype) : ^TOBJECT; virtual;\n"
~"    procedure FREEINSTANCE (TOBJECT); virtual;\n"
~"    function  SAFECALLEXCEPTION (TOBJECT, TOBJECT, POINTER) : HRESULT; virtual;\n"
~"    procedure DEFAULTHANDLER (TOBJECT, var); virtual;\n"
~"    procedure FREE (TOBJECT);\n"
~"    function  INITINSTANCE (unnamedtype, POINTER) : ^TOBJECT;\n"
~"    procedure CLEANUPINSTANCE (TOBJECT);\n"
~"    function  CLASSTYPE (unnamedtype) : record <unknown>;\n"
~"    function  CLASSINFO (unnamedtype) : POINTER;\n"
~"    function  CLASSNAME (unnamedtype, SHORTSTRING) : SHORTSTRING;\n"
~"    function  CLASSNAMEIS (unnamedtype, SHORTSTRING) : BOOLEAN;\n"
~"    function  CLASSPARENT (unnamedtype) : record <unknown>;\n"
~"    function  INSTANCESIZE (unnamedtype) : LONGINT;\n"
~"    function  INHERITSFROM (unnamedtype, TCLASS) : BOOLEAN;\n"
~"    function  STRINGMESSAGETABLE (unnamedtype) : PSTRINGMESSAGETABLE;\n"
~"    function  METHODADDRESS (unnamedtype, SHORTSTRING) : POINTER;\n"
~"    function  METHODNAME (unnamedtype, SHORTSTRING, POINTER) : SHORTSTRING;\n"
~"    function  FIELDADDRESS (TOBJECT, SHORTSTRING) : POINTER;\n"
~"    procedure AFTERCONSTRUCTION (TOBJECT); virtual;\n"
~"    procedure BEFOREDESTRUCTION (TOBJECT); virtual;\n"
~"    procedure DEFAULTHANDLERSTR (TOBJECT, var); virtual;\n"
~"    procedure DISPATCH (TOBJECT, var); virtual;\n"
~"    procedure DISPATCHSTR (TOBJECT, var); virtual;\n"
~"    function  GETINTERFACE (TOBJECT, TGUID, out) : BOOLEAN;\n"
~"    function  GETINTERFACEBYSTR (TOBJECT, SHORTSTRING, out) : BOOLEAN;\n"
~"    function  GETINTERFACEWEAK (TOBJECT, TGUID, out) : BOOLEAN;\n"
~"    function  GETINTERFACEENTRY (unnamedtype, TGUID) : PINTERFACEENTRY;\n"
~"    function  GETINTERFACEENTRYBYSTR (unnamedtype, SHORTSTRING) : PINTERFACEENTRY;\n"
~"    function  GETINTERFACETABLE (unnamedtype) : PINTERFACETABLE;\n"
~"    function  UNITNAME (unnamedtype, ANSISTRING) : ANSISTRING;\n"
~"    function  EQUALS (TOBJECT, TOBJECT) : BOOLEAN; virtual;\n"
~"    function  GETHASHCODE (TOBJECT) : LONGINT; virtual;\n"
~"    function  TOSTRING (TOBJECT, ANSISTRING) : ANSISTRING; virtual;\n"
~"end\n"
^done
(gdb)
<ptype Exception>
&"ptype Exception\n"
~"type = EXCEPTION = class : public TOBJECT \n"
~"  private\n"
~"    FMESSAGE : ANSISTRING;\n"
~"    FHELPCONTEXT : LONGINT;\n"
~"\n"
~"  public\n"
~"    constructor CREATE (EXCEPTION, POINTER, ANSISTRING) : ^EXCEPTION;\n"
~"    constructor CREATEFMT (EXCEPTION, POINTER, ANSISTRING, unnamedtype, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATERES (EXCEPTION, POINTER, PSTRING) : ^EXCEPTION;\n"
~"    constructor CREATERESFMT (EXCEPTION, POINTER, PSTRING, unnamedtype, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATEHELP (EXCEPTION, POINTER, ANSISTRING, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATEFMTHELP (EXCEPTION, POINTER, ANSISTRING, unnamedtype, LONGINT, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATERESHELP (EXCEPTION, POINTER, PSTRING, LONGINT) : ^EXCEPTION;\n"
~"    constructor CREATERESFMTHELP (EXCEPTION, POINTER, PSTRING, unnamedtype, LONGINT, LONGINT) : ^EXCEPTION;\n"
~"    function  TOSTRING (EXCEPTION, ANSISTRING) : ANSISTRING; virtual;\n"
~"end\n"
^done
(gdb)
<ptype Shortstring>
&"ptype Shortstring\n"
~"type = record \n"
~"    length : BYTE;\n"
~"    st : array [1..255] of CHAR;\n"
~"end\n"
^done
(gdb)
<ptype pointer>
&"ptype pointer\n"
~"type = ^POINTER\n"
^done
(gdb)
<ptype byte>
&"ptype byte\n"
~"type = BYTE\n"
^done
(gdb)
<set print elements 2500>
&"set print elements 2500\n"
=cmd-param-changed,param="print elements",value="2500"
^done
(gdb)
<info file>
&"info file\n"
~"Symbols from \"/home/user/program/project1\".\n"
~"Local exec file:\n"
~"\t`/home/user/program/project1', file type elf32-littlearm.\n"
~"\tEntry point: 0x1d5fc\n"
~"\t0x00008114 - 0x0000812d is .interp\n"
~"\t0x00008130 - 0x00008150 is .note.ABI-tag\n"
~"\t0x00008150 - 0x0000a558 is .hash\n"
~"\t0x0000a558 - 0x0000f4e8 is .dynsym\n"
~"\t0x0000f4e8 - 0x00016a12 is .dynstr\n"
~"\t0x00016a12 - 0x00017404 is .gnu.version\n"
~"\t0x00017404 - 0x00017464 is .gnu.version_r\n"
~"\t0x00017464 - 0x00017524 is .rel.dyn\n"
~"\t0x00017524 - 0x00019bd4 is .rel.plt\n"
~"\t0x00019bd4 - 0x00019be0 is .init\n"
~"\t0x00019be0 - 0x0001d5fc is .plt\n"
~"\t0x0001d5fc - 0x00332e58 is .text\n"
~"\t0x00332e58 - 0x00332e60 is .fini\n"
~"\t0x00332e60 - 0x00453d54 is .rodata\n"
~"\t0x00453d54 - 0x00453d58 is .eh_frame\n"
~"\t0x0045c000 - 0x0045c004 is .init_array\n"
~"\t0x0045c004 - 0x0045c008 is .fini_array\n"
~"\t0x0045c008 - 0x0045c00c is .jcr\n"
~"\t0x0045c00c - 0x0045c15c is .dynamic\n"
~"\t0x0045c15c - 0x0045d4c4 is .got\n"
~"\t0x0045d4c8 - 0x0046fdc0 is .data\n"
~"\t0x0046fdc0 - 0x00496f6c is fpc.resources\n"
~"\t0x00496f70 - 0x004b1ce8 is .bss\n"
~"\t0x004b1ce8 - 0x004b1db8 is fpc.reshandles\n"
^done
(gdb)
<-data-evaluate-expression sizeof(POINTER)>
^done,value="4"
(gdb)
<-break-insert -f foo>
&"Function \"foo\" not defined.\n"
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="foo",times="0",original-location="foo"}
(gdb)
<-break-delete 1>
^done
(gdb)
<-break-insert main>
^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0001d718",func="main",file="/root/tmp/project1.lpr",fullname="/root/tmp/project1.lpr",line="16",thread-groups=["i1"],times="0",original-location="main"}
(gdb)
<-break-insert *120316>
^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x0001d5fc",at="<_start>",thread-groups=["i1"],times="0",original-location="*120316"}
(gdb)
<-break-insert +0>
^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x0001d718",func="main",file="/root/tmp/project1.lpr",fullname="/root/tmp/project1.lpr",line="12",thread-groups=["i1"],times="0",original-location="/root/tmp/project1.lpr:+0"}
(gdb)
<-exec-run &>
^error,msg="Invalid argument: &"
(gdb)
<-exec-run>
&"/dev/pts/1: \352\267\270\353\237\260 \355\214\214\354\235\274\354\235\264\353\202\230 \353\224\224\353\240\211\355\204\260\353\246\254\352\260\200 \354\227\206\354\212\265\353\213\210\353\213\244.\n"
=thread-group-started,id="i1",pid="13638"
=thread-created,id="1",group-id="i1"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1"
^error,msg="During startup program exited with code 1."
(gdb)
<kill>

Also, Here's my all settings for SSH
1. In Tools-Option-Debugger-General,
    - Debugger type and path : /usr/bin/ssh/ root@192.168.0.23
    - Remote_GDB_Exe : /usr/bin/gdb

2. In Run-RunParameters
    - Host application to /home/user/program/project1

3. In prooject Option - paths
    Target file name (-o) : /home/hsson/Desktop/hssonpc/project1

/home/hsson/Desktop/hssonpc is samba folder on host.
/home/user/program is samba folder on target.

It works fine before reboot  :o
 

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: Debug with ssh problem.
« Reply #9 on: May 11, 2016, 03:02:46 pm »
Quote
Code: [Select]
exec-run &>
^error,msg="Invalid argument: &"
Not the cause of the error (most likely not), but that gdb does not support async mode. So if you try teh "pause" button, it will not work, and may cause errors.
Also, while the app in the debugger runs, you can not set/remove breakpoints, and if you try debugging may stop to work, until debugger is reset.

-------------------------------------------
Probably something with your app.
Code: [Select]
^error,msg="During startup program exited with code 1."that means your app terminated with an error.

If you login to your server, can you start the app by hand?

hosune7845

  • Full Member
  • ***
  • Posts: 159
Re: Debug with ssh problem.
« Reply #10 on: May 12, 2016, 02:22:37 am »
Quote
Code: [Select]
exec-run &>
^error,msg="Invalid argument: &"
Not the cause of the error (most likely not), but that gdb does not support async mode. So if you try teh "pause" button, it will not work, and may cause errors.
Also, while the app in the debugger runs, you can not set/remove breakpoints, and if you try debugging may stop to work, until debugger is reset.

-------------------------------------------
Probably something with your app.
Code: [Select]
^error,msg="During startup program exited with code 1."that means your app terminated with an error.

If you login to your server, can you start the app by hand?

Yes. I can do by hand.

But, It only work after set on target "xhost +", "export DISPLAY=:0" and starting ssh with -y option.

Also, my target supports async mode.

I used Lazarus on target with GDB. and, The remote debugging worked before reboot.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: Debug with ssh problem.
« Reply #11 on: May 12, 2016, 03:35:33 am »
you can set the -Y in the property grid, there should be an entry SSH_OPT

The environment you can set in "run param" (run menu)

hosune7845

  • Full Member
  • ***
  • Posts: 159
Re: Debug with ssh problem.
« Reply #12 on: May 12, 2016, 09:40:45 am »
you can set the -Y in the property grid, there should be an entry SSH_OPT

The environment you can set in "run param" (run menu)

OK. I'm going to set the parameter on "run param".


 

TinyPortal © 2005-2018