[Lazarus] Cross-compiling without target libs

Kjow antispammoni at gmail.com
Sun Jul 18 15:53:09 CEST 2010


2010/7/18 Marc Weustink <marc at dommelstein.net>:
> OutputDebugString is meant to be captured by a debugger. Unfortunately this
> isn't shown anyware in Lazarus

Normally I use DebugView for that, its a little application that is
extremely useful, I use the OutputDebugString() / DebugView
combination for all kinds of development in other languages too,
whenever I cannot easily use stdout for debugging I make myself a
little drop-in replacement for the printf() or its equivalent in the
used language and use that to format and output debug messages.

It is absolutely not understandable why GDB captures these messages
while it is completely unable to display them in any meaningful
manner. It will capture the messages (it will replace and eat the
whole function call, not only the message!) and then declare them
wrongly as "warnings" and bury them in all the other warnings it does
generate, Lazarus does not have any chance to extract only the debug
messages from the output of GDB even if it wanted to. These messages
are basically lost, once GDB gets its hands on them. GDB completely
sabotages the usage of OutputDebugString().

If there is no way to tell GDB to either stop intercepting these
messages or at least display them in a more meaningful way or pass
them on to where they were meant to go (the windows API) instead of
silently *eating* the whole function call, then this is a bug in GDB.
These debug messages are none of GDB's business as long as it does not
provide any way do actually *display* them in a meaningful way.

Attached at the end is the debug output of the standard Lazarus empty
one form project with one button and a debug message as it is seen in
the debug output window.

My debug message is almost at the end.

If GDB cannot be made to stop its unwanted behavior would it then make
sense to make Lazarus (optionally) filter out all messages that start
with '&"warning: ' and display them separately? Maybe in the messages
window?

Or alternatively to make it more generic make the debug-output window
itself be able to filter the messages by type, make a list of
checkboxes to tick for all the different types of messages (hide the
prompt, input from lazarus to GDB, info, warning, error or everything
else that can be easily distinguished)?

(gdb)
<-gdb-set confirm off>
^done
(gdb)
<-gdb-set new-console off>
^done
(gdb)
<-gdb-version>
~"GNU gdb (GDB) 7.0\n"
~"Copyright (C) 2009 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law.  Type \"show
copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"mingw32\".\n"
~"For bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
^done
(gdb)
<-gdb-version>
~"GNU gdb (GDB) 7.0\n"
~"Copyright (C) 2009 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law.  Type \"show
copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"mingw32\".\n"
~"For bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
^done
(gdb)
<-gdb-set env ALLUSERSPROFILE=C:\Dokumente und Einstellungen\All Users>
^done
(gdb)
<-gdb-set env APPDATA=C:\Dokumente und Einstellungen\bernd\Anwendungsdaten>
^done
(gdb)
<-gdb-set env CLIENTNAME=Console>
^done
(gdb)
<-gdb-set env CommonProgramFiles=C:\Programme\Gemeinsame Dateien>
^done
(gdb)
<-gdb-set env COMPUTERNAME=VBOX-577961E4>
^done
(gdb)
<-gdb-set env ComSpec=C:\WINDOWS\system32\cmd.exe>
^done
(gdb)
<-gdb-set env FP_NO_HOST_CHECK=NO>
^done
(gdb)
<-gdb-set env HOMEDRIVE=C:>
^done
(gdb)
<-gdb-set env HOMEPATH=\Dokumente und Einstellungen\bernd>
^done
(gdb)
<-gdb-set env LOGONSERVER=\\VBOX-577961E4>
^done
(gdb)
<-gdb-set env NUMBER_OF_PROCESSORS=1>
^done
(gdb)
<-gdb-set env OS=Windows_NT>
^done
(gdb)
<-gdb-set env Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;;C:\FPC\2.2.4\bin\i386-Win32>
^done
(gdb)
<-gdb-set env PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH>
^done
(gdb)
<-gdb-set env PROCESSOR_ARCHITECTURE=x86>
^done
(gdb)
<-gdb-set env PROCESSOR_IDENTIFIER=x86 Family 6 Model 9 Stepping 5,
GenuineIntel>
^done
(gdb)
<-gdb-set env PROCESSOR_LEVEL=6>
^done
(gdb)
<-gdb-set env PROCESSOR_REVISION=0905>
^done
(gdb)
<-gdb-set env ProgramFiles=C:\Programme>
^done
(gdb)
<-gdb-set env SESSIONNAME=Console>
^done
(gdb)
<-gdb-set env SystemDrive=C:>
^done
(gdb)
<-gdb-set env SystemRoot=C:\WINDOWS>
^done
(gdb)
<-gdb-set env TEMP=C:\DOKUME~1\bernd\LOKALE~1\Temp>
^done
(gdb)
<-gdb-set env TMP=C:\DOKUME~1\bernd\LOKALE~1\Temp>
^done
(gdb)
<-gdb-set env USERDOMAIN=VBOX-577961E4>
^done
(gdb)
<-gdb-set env USERNAME=bernd>
^done
(gdb)
<-gdb-set env USERPROFILE=C:\Dokumente und Einstellungen\bernd>
^done
(gdb)
<-gdb-set env windir=C:\WINDOWS>
^done
(gdb)
<-file-exec-and-symbols "C:/lazarus/Temp/lib/i386-win32/project1.exe">
^done
(gdb)
<-environment-cd .>
^done
(gdb)
<-environment-cd "C:/lazarus/Temp/lib/i386-win32/">
^done
(gdb)
<-data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<info functions FPC_CPUINIT>
&"info functions FPC_CPUINIT\n"
~"All functions matching regular expression \"FPC_CPUINIT\":\n"
^done
(gdb)
<info functions $$_RUNERROR$>
&"info functions $$_RUNERROR$\n"
~"All functions matching regular expression \"$$_RUNERROR$\":\n"
^done
(gdb)
<-exec-arguments >
^done
(gdb)
<set width 50000>
&"set width 50000\n"
^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<info address main>
&"info address main\n"
&"No symbol \"main\" in current context.\n"
^error,msg="No symbol \"main\" in current context."
(gdb)
<-break-insert -t main>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<ptype TObject>
&"ptype TObject\n"
&"No symbol table is loaded.  Use the \"file\" command.\n"
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<info address FPC_RAISEEXCEPTION>
&"info address FPC_RAISEEXCEPTION\n"
&"No symbol \"FPC_RAISEEXCEPTION\" in current context.\n"
^error,msg="No symbol \"FPC_RAISEEXCEPTION\" in current context."
(gdb)
<-break-insert FPC_RAISEEXCEPTION>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<info address FPC_BREAK_ERROR>
&"info address FPC_BREAK_ERROR\n"
&"No symbol \"FPC_BREAK_ERROR\" in current context.\n"
^error,msg="No symbol \"FPC_BREAK_ERROR\" in current context."
(gdb)
<-break-insert FPC_BREAK_ERROR>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<info address FPC_RUNERROR>
&"info address FPC_RUNERROR\n"
&"No symbol \"FPC_RUNERROR\" in current context.\n"
^error,msg="No symbol \"FPC_RUNERROR\" in current context."
(gdb)
<-break-insert FPC_RUNERROR>
^error,msg="No symbol table is loaded.  Use the \"file\" command."
(gdb)
<info file>
&"info file\n"
~"Symbols from \"C:/lazarus/Temp/lib/i386-win32/project1.exe\".\n"
~"Local exec file:\n"
~"\t`C:/lazarus/Temp/lib/i386-win32/project1.exe', file type pei-i386.\n"
~"\tEntry point: 0x518340\n"
~"\t0x00401000 - 0x00518370 is .text\n"
~"\t0x00519000 - 0x0055deb0 is .data\n"
~"\t0x0055e000 - 0x0055e040 is .rdata\n"
~"\t0x0055f000 - 0x00563fd4 is .bss\n"
~"\t0x00564000 - 0x00566a34 is .idata\n"
~"\t0x00567000 - 0x0058a96c is .rsrc\n"
^done
(gdb)
<-break-insert -t *5342016>
^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x00518340",at="",times="0",original-location="*5342016"}
(gdb)
<-break-insert -f foo>
&"No symbol table is loaded.  Use the \"file\" command.\n"
^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="foo",times="0",original-location="foo"}
(gdb)
<-break-delete 2>
^done
(gdb)
<-exec-run>
=thread-group-created,id="3188"
=thread-created,id="1",group-id="3188"
~"[New Thread 3188.0xc90]\n"
^running
*running,thread-id="all"
(gdb)
&"warning: Can not parse XML library list; XML support was disabled at
compile time\n"
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x00518340",func="??",args=[]},thread-id="1",stopped-threads="all"
(gdb)
<info program>
&"info program\n"
~"\tUsing the running image of child Thread 3188.0xc90.\n"
~"Program stopped at 0x518340.\n"
~"It stopped at a breakpoint that has since been deleted.\n"
~"Type \"info stack\" or \"info registers\" for more information.\n"
^done
(gdb)
<-exec-continue>
^running
*running,thread-id="all"
(gdb)
=thread-created,id="2",group-id="3188"
~"[New Thread 3188.0x9c0]\n"
*running,thread-id="all"
~"[Switching to Thread 3188.0x9c0]\n"
*stopped,reason="signal-received",signal-name="SIGTRAP",signal-meaning="Trace/breakpoint
trap",frame={addr="0x7c911231",func="??",args=[]},thread-id="2",stopped-threads="all"
=thread-selected,id="2"
(gdb)
<info program>
&"info program\n"
~"\tUsing the running image of child Thread 3188.0x9c0.\n"
~"Program stopped at 0x7c911231.\n"
~"It stopped with signal SIGTRAP, Trace/breakpoint trap.\n"
~"Type \"info stack\" or \"info registers\" for more information.\n"
^done
(gdb)
<-symbol-list-lines unit1.pas>
^error,msg="mi_cmd_symbol_list_lines: Unknown source file name."
(gdb)
<-exec-continue>
^running
*running,thread-id="all"
(gdb)
=thread-exited,id="2",group-id="3188"
&"warning: this is a debug message sent from my program because I
clicked the button\n"
=thread-exited,id="1",group-id="3188"
=thread-group-exited,id="3188"
*stopped,reason="exited-normally"
(gdb)
<-file-exec-and-symbols >
^done
(gdb)




More information about the Lazarus mailing list