1 | þtext
|
---|
2 | ===============================================================================
|
---|
3 | emxgnu.doc emx 0.9d GNU DEVELOPMENT TOOLS INFORMATION 21-Dec-1998
|
---|
4 | ===============================================================================
|
---|
5 | Copyright (c) 1990-1998 by Eberhard Mattes
|
---|
6 | þendtext
|
---|
7 |
|
---|
8 | þtitle GNU Development Tools Information
|
---|
9 |
|
---|
10 | þformat bold emx emxbind emximp emxomf emxomfld emxtsf pmgdb
|
---|
11 | þformat bold GCC CPP GDB GAS GASP readline ld ar nm objdump GPPDEMID
|
---|
12 | þformat bold genclass makeinfo texindex termcap texinfo
|
---|
13 |
|
---|
14 | þformat tty .a .cc .cpp .cxx .C .def .dll .exe .o .obj .res .map
|
---|
15 | þformat tty install.doc build.doc emxl.exe emx.dll emxlibc.dll emxlibcm.dll
|
---|
16 | þformat tty emxlibcs.dll emxomf.exe
|
---|
17 | þformat tty gcc.exe cpp.exe cc1.exe cc1plus.exe cc1obj.exe as.exe
|
---|
18 | þformat tty c_alias.a c_alias.lib sys.lib os2.a os2.lib
|
---|
19 | þformat tty emx2.a emx2.lib libg++
|
---|
20 | þformat tty dll0.o dll0.obj crt0.o lib1.a lib2.a
|
---|
21 | þformat tty .gdbinit termcap.dat gppdemid.dll
|
---|
22 | þformat tty /emx /emx/bin /emx/etc
|
---|
23 | þformat tty -mepilogue -mno-epilogue -mprobe -mno-probe -pg -pn -fstack-check
|
---|
24 | þformat tty -Zdll -Zexe -Zmt -Zmtd -Zmts -Zomf -Zstack -Zso -Zno-rte -Zcrtdll
|
---|
25 | þformat tty -Zsys -Zno-demangle -Zdemangle-proto -Zbsd-signals -Zsysv-signals
|
---|
26 | þformat tty -Zsmall-conv
|
---|
27 | þformat tty -lgpp -lobjc -ltermcap -lbtermcap -lstdcpp -ltmalloc
|
---|
28 | þformat tty -c -s -d -da -freg-struct-return
|
---|
29 | þformat tty -fpcc-struct-return -E -R -l -r -b -ZC++-comments -Zc++-comments
|
---|
30 | þformat tty -Zlinker -O -Xlinker -Zmap -Zstrip -Zbin-files
|
---|
31 |
|
---|
32 | þformat tty __MT__ __32BIT__ __EMX__
|
---|
33 |
|
---|
34 | þformat tty alloca() fopen() open() ptrace() malloc() _heapchk() _tmalloc()
|
---|
35 | þformat tty fork()
|
---|
36 | þformat tty <stdarg.h> <varargs.h> <fix-args.h>
|
---|
37 | þformat tty DosCreateThread DosAllocMem
|
---|
38 |
|
---|
39 | þformat tty __.SYMDEF
|
---|
40 |
|
---|
41 | þformat abbrev etc. W.M.
|
---|
42 |
|
---|
43 |
|
---|
44 | þif text
|
---|
45 | þh= Table of Contents
|
---|
46 | þtoc
|
---|
47 | þendif
|
---|
48 |
|
---|
49 |
|
---|
50 | þh1 Introduction to GNU Development Tools Information
|
---|
51 | þipf
|
---|
52 | :font facename=Helv size=24x14.:hp2.GNU Development Tools Information
|
---|
53 | :ehp2.
|
---|
54 | :p.
|
---|
55 | :font facename=Helv size=16x10. Copyright (c) 1990-1993 by Eberhard Mattes
|
---|
56 | :font facename=default size=0x0.
|
---|
57 | :p.
|
---|
58 | þendipf
|
---|
59 |
|
---|
60 | This text describes how to use the GNU C Compiler and other GNU
|
---|
61 | utilities with emx.
|
---|
62 | þif text
|
---|
63 | See emxdev.doc for instructions for the emx utilities.
|
---|
64 | þendif
|
---|
65 | For detailed information about GCC, GDB, and GAS, read the GCC, GDB,
|
---|
66 | and GAS manuals, see install.doc. See build.doc for details on
|
---|
67 | compiling the GNU utilities.
|
---|
68 |
|
---|
69 | All programs assume that the entire package is installed on one
|
---|
70 | disk drive in these directories:
|
---|
71 |
|
---|
72 | þexample
|
---|
73 | /emx/bin Executable files
|
---|
74 | /emx/etc termcap.dat
|
---|
75 | /emx/lib Library files
|
---|
76 | /emx/include Header files (C language)
|
---|
77 | /emx/include/cpp Header files (C++ language)
|
---|
78 | /emx/include/objc Header files (Objective C language)
|
---|
79 | þendexample
|
---|
80 |
|
---|
81 | If the /emx directory is not on the current drive, use the
|
---|
82 | C_INCLUDE_PATH and LIBRARY_PATH environment variables, for instance
|
---|
83 |
|
---|
84 | þexample
|
---|
85 | set C_INCLUDE_PATH=c:/emx/include
|
---|
86 | set LIBRARY_PATH=c:/emx/lib
|
---|
87 | þendexample
|
---|
88 |
|
---|
89 | to use drive C.
|
---|
90 |
|
---|
91 | Use forward slashes instead of backward slashes in path names!
|
---|
92 |
|
---|
93 | Directories:
|
---|
94 |
|
---|
95 | þexample
|
---|
96 | /emx Main directory, empty
|
---|
97 | /emx/bin Executable files and batch files
|
---|
98 | /emx/dll Dynamic link libraries
|
---|
99 | /emx/doc Documentation
|
---|
100 | /emx/etc termcap.dat
|
---|
101 | /emx/gnu/binutils.old old GNU binary utilities (sources)
|
---|
102 | /emx/gnu/binutils.26 new GNU binary utilities (sources)
|
---|
103 | /emx/gnu/doc Documentation
|
---|
104 | /emx/gnu/duel DUEL (for GDB)
|
---|
105 | /emx/gnu/gcc-2.8 GNU C compiler source (GCC)
|
---|
106 | /emx/gnu/gdb-4.16 GNU debugger source (GDB)
|
---|
107 | /emx/gnu/gppdemid C++ demangler for LINK386
|
---|
108 | /emx/gnu/info GNU info source
|
---|
109 | /emx/gnu/libtxi -libtxi (for GNU info)
|
---|
110 | /emx/gnu/libg++-2.8.1.1a GNU C++ library (obsolete)
|
---|
111 | /emx/gnu/libstdc++-2.8.1.1 GNU standard C++ library
|
---|
112 | /emx/gnu/makeinfo GNU makeinfo source
|
---|
113 | /emx/gnu/termcap GNU termcap
|
---|
114 | /emx/gnu/texindex GNU texindex source
|
---|
115 | /emx/include header files (C language)
|
---|
116 | /emx/include/cpp Header files (C++ language)
|
---|
117 | /emx/include/objc Header files (Objective C language)
|
---|
118 | /emx/lib Libraries
|
---|
119 | þendexample
|
---|
120 |
|
---|
121 |
|
---|
122 | þh1 GCC -- compiling and linking C and C++ programs
|
---|
123 | þlabel GCC
|
---|
124 | þi1 GCC
|
---|
125 | þkeyword GCC
|
---|
126 |
|
---|
127 | GCC 2.8.1 has been ported to emx, including Richard W.M. Jones's
|
---|
128 | bounds checking patches.
|
---|
129 |
|
---|
130 | þipfminitoc
|
---|
131 |
|
---|
132 | þh2 Calling GCC
|
---|
133 | þlabel Calling GCC
|
---|
134 |
|
---|
135 | For small projects, one invokation GCC can be used to compile and link
|
---|
136 | the program. Example:
|
---|
137 |
|
---|
138 | þexample
|
---|
139 | gcc dwim.c
|
---|
140 | þendexample
|
---|
141 |
|
---|
142 | This assumes that emxl.exe can be found in one of the directories
|
---|
143 | listed in the EMXPATH and PATH environment variables, or in the
|
---|
144 | directory /emx/bin, see also þhpt{ld}. If no output file name is
|
---|
145 | given, the name of the first input file, with .exe extension (or
|
---|
146 | .dll extension if -Zdll is given), is used for the output file
|
---|
147 | unless linking is suppressed (with the -c option, for instance).
|
---|
148 | That is, the above example creates þtt{dwim.exe}.
|
---|
149 |
|
---|
150 | Please note that the example given above creates a file named
|
---|
151 | þtt{dwim} which will be deleted after conversion to .exe format.
|
---|
152 |
|
---|
153 | If the output file name doesn't end in .exe or .dll, the output file
|
---|
154 | will have a.out format (however, see þhpt{-Zexe}). Example:
|
---|
155 |
|
---|
156 | þexample
|
---|
157 | gcc -o dwim dwim.c
|
---|
158 | þendexample
|
---|
159 |
|
---|
160 | This example creates the a.out file `þtt{dwim}'.
|
---|
161 |
|
---|
162 |
|
---|
163 | þh2 Environment variables
|
---|
164 | þlabel Environment variables for GCC
|
---|
165 |
|
---|
166 | If you want to develop programs on a drive different from the drive
|
---|
167 | where emx is installed, you have to set the C_INCLUDE_PATH and
|
---|
168 | LIBRARY_PATH environment variables, for instance,
|
---|
169 |
|
---|
170 | þexample
|
---|
171 | set C_INCLUDE_PATH=c:/emx/include
|
---|
172 | set LIBRARY_PATH=c:/emx/lib
|
---|
173 | þendexample
|
---|
174 |
|
---|
175 | If you want to compile þhpt{C++} programs, set CPLUS_INCLUDE_PATH as well:
|
---|
176 |
|
---|
177 | þexample
|
---|
178 | set CPLUS_INCLUDE_PATH=c:/emx/include/cpp;c:/emx/include
|
---|
179 | þendexample
|
---|
180 |
|
---|
181 | If you want to compile þhpt{Objective C} programs, set
|
---|
182 | OBJC_INCLUDE_PATH as well:
|
---|
183 |
|
---|
184 | þexample
|
---|
185 | set OBJC_INCLUDE_PATH=c:/emx/include
|
---|
186 | þendexample
|
---|
187 |
|
---|
188 | The genclass utility needs the following environment variable:
|
---|
189 |
|
---|
190 | þexample
|
---|
191 | set PROTODIR=c:/emx/include/cpp/gen
|
---|
192 | þendexample
|
---|
193 |
|
---|
194 | If the TMPDIR, TMP and TEMP environment variables are not set, GCC
|
---|
195 | writes temporary files in the current working directory. GCC tries
|
---|
196 | TMPDIR, TMP and TEMP in turn and uses the first valid one. Note
|
---|
197 | that þtt{c:} is not a valid directory name, you have to use þtt{c:/}
|
---|
198 | or þtt{\} instead. In other cases, a trailing slash or backslash is
|
---|
199 | optional. For instance, use
|
---|
200 |
|
---|
201 | þexample
|
---|
202 | SET TMPDIR=f:/tmp/
|
---|
203 | þendexample
|
---|
204 |
|
---|
205 | to put temporary files into the þtt{f:/tmp} directory.
|
---|
206 |
|
---|
207 | When compiling projects consisting of many modules (such as
|
---|
208 | libraries) under OS/2, you can speed up compilation if you have
|
---|
209 | enough memory by keeping GCC in memory. For example, to keep GCC in
|
---|
210 | memory for 5 minutes, use
|
---|
211 |
|
---|
212 | þexample
|
---|
213 | set GCCLOAD=5
|
---|
214 | þendexample
|
---|
215 |
|
---|
216 | The following programs use GCCLOAD: gcc.exe, cpp.exe, cc1.exe,
|
---|
217 | cc1plus.exe, cc1obj.exe, as.exe and emxomf.exe.
|
---|
218 |
|
---|
219 | You can put GCC options into the environment variable GCCOPT. These
|
---|
220 | options will be read before the options given on the command line.
|
---|
221 | For example, to use þtt{-pipe}, type
|
---|
222 |
|
---|
223 | þexample
|
---|
224 | set GCCOPT=-pipe
|
---|
225 | þendexample
|
---|
226 |
|
---|
227 | þh2 Bounds checking
|
---|
228 |
|
---|
229 | The emx port of GCC includes Richard W.M. Jones's bounds checking
|
---|
230 | patches. See the GCC manual and þtt{\emx\gnu\doc\bounds\README} for
|
---|
231 | details. The complete report is in
|
---|
232 | þtt{\emx\gnu\doc\bounds\bcrep2.ps} (shipped in þtt{gnudoc.zip}).
|
---|
233 | Use GhostScript if you don't have a PostScript printer.
|
---|
234 | þtt{\emx\gnu\doc\bounds\bcreport.txt} contains important excerpts
|
---|
235 | from an earlier version of the report as plain ASCII text.
|
---|
236 |
|
---|
237 | There are a few additional restrictions under OS/2:
|
---|
238 |
|
---|
239 | þitemize
|
---|
240 | þitem
|
---|
241 | Bounds checking is not available for multithread programs
|
---|
242 | þitem
|
---|
243 | Bounds checking is available for statically linked programs only
|
---|
244 | þitem
|
---|
245 | Bounds checking is not available for DLLs
|
---|
246 | þitem
|
---|
247 | If your program uses _tmalloc(), you have use the -ltmalloc
|
---|
248 | option as the bounds checking library þtt{check.a} replaces
|
---|
249 | malloc()
|
---|
250 | þenditemize
|
---|
251 |
|
---|
252 | The header files <stdarg.h> and <varargs.h> automatically include
|
---|
253 | <fix-args.h> if bounds checking is enabled. Therefore you don't
|
---|
254 | have to include <fix-args.h> yourself.
|
---|
255 |
|
---|
256 |
|
---|
257 | þh2 #pragma statement
|
---|
258 | þlabel #pragma statement
|
---|
259 | þlabel #pragma pack()
|
---|
260 | þindex #pragma pack()
|
---|
261 | þkeyword #pragma
|
---|
262 |
|
---|
263 | The emx port of GCC supports the
|
---|
264 |
|
---|
265 | þtypewriter
|
---|
266 | #pragma pack(þpa{N})
|
---|
267 | þendtypewriter
|
---|
268 |
|
---|
269 | statement where þpa{N} is 1, 2 or 4. The default is 4. Structure
|
---|
270 | fields are aligned to multiples of þpa{N} bytes, according to the
|
---|
271 | value þpa{N} as set by the last þtt{#pragma pack} statement.
|
---|
272 |
|
---|
273 | þexample
|
---|
274 | #pragma pack()
|
---|
275 | þendexample
|
---|
276 |
|
---|
277 | reverts to the default (4). Note that other C compilers revert to
|
---|
278 | the value in effect before the previous þtt{#pragma pack}
|
---|
279 | statement.
|
---|
280 |
|
---|
281 |
|
---|
282 | þh2 Additional command line options
|
---|
283 | þlabel Additional command line options
|
---|
284 |
|
---|
285 | Several command line options have been added to GCC:
|
---|
286 |
|
---|
287 | þlist
|
---|
288 | þitem þhpt{-mepilogue}
|
---|
289 |
|
---|
290 | emit only one epilogue per function
|
---|
291 |
|
---|
292 | þitem -mno-epilogue
|
---|
293 |
|
---|
294 | emit multiple epilogues per function if appropriate (default)
|
---|
295 |
|
---|
296 | þitem þhpt{-mprobe}
|
---|
297 |
|
---|
298 | generate stack probes
|
---|
299 |
|
---|
300 | þitem -mno-probe
|
---|
301 |
|
---|
302 | do not generate stack probes (default)
|
---|
303 |
|
---|
304 | þitem þhpt{-pn}
|
---|
305 |
|
---|
306 | Enable profiling but do not generate profile hooks
|
---|
307 |
|
---|
308 | þitem þhpt{-Zbin-files}
|
---|
309 |
|
---|
310 | open files in binary mode by default
|
---|
311 |
|
---|
312 | þitem þhpt{-Zbsd-signals}
|
---|
313 |
|
---|
314 | select the `BSD' signal processing model
|
---|
315 |
|
---|
316 | þitem þhpt{-Zcrtdll}
|
---|
317 |
|
---|
318 | link the C library dynamically
|
---|
319 |
|
---|
320 | þitem þhpt{-Zdll}
|
---|
321 |
|
---|
322 | create a dynamic link library
|
---|
323 |
|
---|
324 | þitem þhpt{-Zexe}
|
---|
325 |
|
---|
326 | touch output file, add .exe extension
|
---|
327 |
|
---|
328 | þitem þhpt{-Zmap}
|
---|
329 |
|
---|
330 | let LINK386 or emxbind create a .map file
|
---|
331 |
|
---|
332 | þitem þhpt{-Zlinker}
|
---|
333 |
|
---|
334 | pass option to LINK386
|
---|
335 |
|
---|
336 | þitem þhpt{-Zmt}
|
---|
337 |
|
---|
338 | multithread code
|
---|
339 |
|
---|
340 | þitem þhpt{-Zmtd}
|
---|
341 |
|
---|
342 | multithread code, link C library dynamically
|
---|
343 |
|
---|
344 | þitem þhpt{-Zmts}
|
---|
345 |
|
---|
346 | multithread code, link C library statically
|
---|
347 |
|
---|
348 | þitem þhpt{-Zno-rte}
|
---|
349 |
|
---|
350 | create DLL without runtime environment
|
---|
351 |
|
---|
352 | þitem þhpt{-Zomf}
|
---|
353 |
|
---|
354 | create .obj files instead of .o files
|
---|
355 |
|
---|
356 | þitem þhpt{-Zsmall-conv}
|
---|
357 |
|
---|
358 | use small, fast, and inaccurate routines for converting decimal
|
---|
359 | numbers to binary and vice versa
|
---|
360 |
|
---|
361 | þitem þhpt{-Zstack}
|
---|
362 |
|
---|
363 | set the stack size
|
---|
364 |
|
---|
365 | þitem þhpt{-Zso}
|
---|
366 |
|
---|
367 | create stand-alone DLL
|
---|
368 |
|
---|
369 | þitem þhpt{-Zsys}
|
---|
370 |
|
---|
371 | create stand-alone OS/2 program (no emx.dll)
|
---|
372 |
|
---|
373 | þitem þhpt{-Zsysv-signals}
|
---|
374 |
|
---|
375 | select the `System V' signal processing model
|
---|
376 |
|
---|
377 | þendlist
|
---|
378 |
|
---|
379 | The following table shows which compiler phases are affected by the
|
---|
380 | options. If an option affects the preprocessor, the compiler, or
|
---|
381 | the assembler, you should use that option when compiling. When an
|
---|
382 | option affects the linker, you should use that option when linking.
|
---|
383 | However, you can use options affecting the preprocessor, the
|
---|
384 | compiler, or the assembler also when not compiling; you can use
|
---|
385 | options affecting the linker also when not linking.
|
---|
386 |
|
---|
387 | þexample
|
---|
388 | ³ Prepro- ³ Com- ³ Assem- ³
|
---|
389 | Option ³ cessor ³ piler ³ bler ³ Linker
|
---|
390 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ
|
---|
391 | -mepilogue ³ X ³ X ³ ³
|
---|
392 | -mno-epilogue ³ X ³ X ³ ³
|
---|
393 | -mprobe ³ ³ X ³ ³
|
---|
394 | -mno-probe ³ ³ X ³ ³
|
---|
395 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ
|
---|
396 | -pg ³ X ³ X ³ ³ X
|
---|
397 | -pn ³ ³ ³ ³ X
|
---|
398 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ
|
---|
399 | -Zcrtdll ³ ³ ³ ³ X
|
---|
400 | -Zdll ³ ³ ³ ³ X
|
---|
401 | -Zmt ³ X ³ ³ ³ X
|
---|
402 | -Zmtd ³ X ³ ³ ³ X
|
---|
403 | -Zmts ³ X ³ ³ ³ X
|
---|
404 | -Zomf ³ X ³ ³ X ³ X
|
---|
405 | -Zno-rte ³ ³ ³ ³ X
|
---|
406 | -Zso ³ ³ ³ ³ X
|
---|
407 | -Zsys ³ ³ ³ ³ X
|
---|
408 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ
|
---|
409 | -Zexe ³ ³ ³ ³ X
|
---|
410 | -Zlinker ³ ³ ³ ³ X
|
---|
411 | -Zmap ³ ³ ³ ³ X
|
---|
412 | -Zstack ³ ³ ³ ³ X
|
---|
413 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ
|
---|
414 | -Zbin-files ³ ³ ³ ³ X
|
---|
415 | -Zbsd-signals ³ ³ ³ ³ X
|
---|
416 | -Zsmall-conv ³ ³ ³ ³ X
|
---|
417 | -Zsysv-signals ³ ³ ³ ³ X
|
---|
418 | þendexample
|
---|
419 |
|
---|
420 |
|
---|
421 | þh3 -mepilogue
|
---|
422 | þlabel -mepilogue
|
---|
423 | þi2 -mepilogue
|
---|
424 | þi2 -mno-epilogue
|
---|
425 | þkeyword -mepilogue -mno-epilogue
|
---|
426 |
|
---|
427 | By default (-mno-epilogue), GCC may emit multiple epilogues (return
|
---|
428 | statements) per function if appropriate. With -mepilogue, GCC emits
|
---|
429 | only one epilogue at the end of each function; any function exit in
|
---|
430 | the middle of a function jumps to the epilogue at the end of the
|
---|
431 | function. Moreover, -mepilogue causes a symbol to be defined at the
|
---|
432 | start of the epilogue code. The name of that symbol is constructed
|
---|
433 | by prepending `tt{__POST$}' to the function's label.
|
---|
434 |
|
---|
435 | -mno-epilogue generates faster code. For tracing with the OS/2
|
---|
436 | þtt{TRACE} command, however, each function should have only one
|
---|
437 | epilogue, so that a tracepoint can be defined for the epilogue.
|
---|
438 |
|
---|
439 | The C library for emx has been compiled with -mepilogue to enable
|
---|
440 | tracing of DLLs. See also þhpt{emxtsf}.
|
---|
441 |
|
---|
442 | þh3 -mprobe
|
---|
443 | þlabel -mprobe
|
---|
444 | þi2 -mprobe
|
---|
445 | þi2 -mno-probe
|
---|
446 | þkeyword -mprobe -mno-probe
|
---|
447 |
|
---|
448 | -mprobe enables generation of þhpt{stack probes} (see below),
|
---|
449 | -mno-probe (which is the default) disables generation of stack
|
---|
450 | probes. See also GCC's -fstack-check option.
|
---|
451 |
|
---|
452 | All libraries for emx are compiled with both stack probes and stack
|
---|
453 | checking enabled.
|
---|
454 |
|
---|
455 |
|
---|
456 | þh3 -pn
|
---|
457 | þlabel -pn
|
---|
458 | þi2 -pn
|
---|
459 | þkeyword -pn
|
---|
460 |
|
---|
461 | -pn enables profiling by using þtt{gcrt0.o} instead of þtt{crt0.o}
|
---|
462 | for linking the program. In contrast to -pg, no profiling hooks are
|
---|
463 | generated.
|
---|
464 |
|
---|
465 | þh3 -Zbin-files
|
---|
466 | þlabel -Zbin-files
|
---|
467 | þi2 -Zbin-files
|
---|
468 | þkeyword -Zbin-files
|
---|
469 |
|
---|
470 | The additional GCC command line option -Zbin-files causes the
|
---|
471 | program to be linked with þtt{binmode.o}, selecting binary mode
|
---|
472 | as default for fopen(), open(), etc.
|
---|
473 |
|
---|
474 |
|
---|
475 | þh3 -Zbsd-signals
|
---|
476 | þlabel -Zbsd-signals
|
---|
477 | þi2 -Zbsd-signals
|
---|
478 | þkeyword -Zbsd-signals
|
---|
479 |
|
---|
480 | The additional GCC command line option -Zbsd-signals causes the
|
---|
481 | program to be linked with þtt{sigbsd.o}, selecting the `BSD' signal
|
---|
482 | processing model. See also þhpt{-Zsysv-signals}. -Zbsd-signals
|
---|
483 | cannot be used with þhpt{-Zsys}.
|
---|
484 |
|
---|
485 |
|
---|
486 | þh3 -Zcrtdll
|
---|
487 | þlabel -Zcrtdll
|
---|
488 | þi2 -Zcrtdll
|
---|
489 | þkeyword -Zcrtdll
|
---|
490 |
|
---|
491 | -Zcrtdll causes the executable file to be linked dynamically to the
|
---|
492 | C runtime library. If -Zmt is also given, the program will use
|
---|
493 | emxlibcm.dll. Otherwise, the program will use emxlibcs.dll.
|
---|
494 | Without -Zcrtdll, the executable file is linked statically to the C
|
---|
495 | runtime library.
|
---|
496 |
|
---|
497 | -Zcrtdll uses the import library þtt{c_import} and a small static
|
---|
498 | library (þtt{c_static}) which contains code that must be linked
|
---|
499 | statically. To link with a different import library, use
|
---|
500 | þsy{-Zcrtdll=<lib>} instead of -Zcrtdll. The library name
|
---|
501 | þsy{<lib>} must not include a directory or a suffix. The library
|
---|
502 | will be sought in the standard library path, therefore you can use
|
---|
503 | the þtt{-L} option for adding another library directory. Example:
|
---|
504 | þexample
|
---|
505 | gcc -Zcrtdll=myclib -L/mylib myprog.c
|
---|
506 | þendexample
|
---|
507 | þif ipf
|
---|
508 | See also þhpt{-Zmt}, þhpt{-Zmtd}, þhpt{-Zmts}, and þhpt{Startup
|
---|
509 | modules and libraries}.
|
---|
510 | þendif
|
---|
511 |
|
---|
512 |
|
---|
513 | þh3 -Zdll
|
---|
514 | þlabel -Zdll
|
---|
515 | þi2 -Zdll
|
---|
516 | þkeyword -Zdll
|
---|
517 |
|
---|
518 | The additional GCC command line option -Zdll causes the program to
|
---|
519 | be linked with dll0.o (or dll0.obj if þhpt{-Zomf} is given) instead
|
---|
520 | of crt0.o. This is required for creating dynamic link libraries.
|
---|
521 | þif ipf
|
---|
522 | See also þhpt{Startup modules and libraries}.
|
---|
523 | þendif
|
---|
524 |
|
---|
525 |
|
---|
526 | þh3 -Zexe
|
---|
527 | þlabel -Zexe
|
---|
528 | þi2 -Zexe
|
---|
529 | þkeyword -Zexe
|
---|
530 |
|
---|
531 | To avoid changing Unix-style makefiles, the additional GCC command line
|
---|
532 | option -Zexe can be used. If -Zexe is present, the linker (ld or
|
---|
533 | emxomfld) automatically adds the .exe extension to the output file
|
---|
534 | name and creates an empty file of that name (without .exe) to keep
|
---|
535 | the þbf{make} utility happy. The output file name must not have an
|
---|
536 | extension. See the descriptions of þhpt{ld} and þhpt{emxomfld} for details.
|
---|
537 |
|
---|
538 | þh3 -Zlinker
|
---|
539 | þlabel -Zlinker
|
---|
540 | þi2 -Zlinker
|
---|
541 | þkeyword -Zlinker
|
---|
542 |
|
---|
543 | Use the additional GCC command line option -Zlinker to pass an
|
---|
544 | option to LINK386. -Zlinker should be used only when using the
|
---|
545 | -Zomf option. The argument following -Zlinker will be passed to
|
---|
546 | þhpt{emxomfld} (preceded by an -O option) which in turn will pass it
|
---|
547 | to LINK386. The LINK386 option must start with a slash. Example:
|
---|
548 |
|
---|
549 | þexample
|
---|
550 | gcc yzzyx.obj -Zomf -Zlinker /runfromvdm
|
---|
551 | þendexample
|
---|
552 |
|
---|
553 | Don't confuse the -Zlinker option with the -Xlinker option, which
|
---|
554 | passes an option to þhpt{ld} or emxomfld.
|
---|
555 |
|
---|
556 | þh3 -Zmap
|
---|
557 | þlabel -Zmap
|
---|
558 | þi2 -Zmap
|
---|
559 | þkeyword -Zmap
|
---|
560 |
|
---|
561 | Use the additional GCC command line option -Zmap to let LINK386 or
|
---|
562 | emxbind create a .map file. The name of the .map file will be
|
---|
563 | derived from the output file name, both LINK386 and emxbind add the
|
---|
564 | default extension .map. To specify the name of the .map file, use
|
---|
565 | þsy{-Zmap=<map_file>}.
|
---|
566 |
|
---|
567 | GCC passes the -Zmap option down to emxomfld (or ld) which passes
|
---|
568 | the file name down to LINK386 (or emxbind).
|
---|
569 |
|
---|
570 | To get a detailed .map file including all the public symbols, also
|
---|
571 | use þtt{-Zlinker /map} with -Zomf. By default, the .map file
|
---|
572 | created by LINK386 lists only the segments. Example:
|
---|
573 |
|
---|
574 | þexample
|
---|
575 | gcc -o dwimtest.exe dwim.c -Zomf -Zmap -Zlinker /map
|
---|
576 | þendexample
|
---|
577 |
|
---|
578 | Note that LINK386 creates the .map file in the same directory as the
|
---|
579 | .exe file unless the name of the .map file includes a path.
|
---|
580 |
|
---|
581 | þh3 -Zmt
|
---|
582 | þlabel -Zmt
|
---|
583 | þi2 -Zmt
|
---|
584 | þkeyword -Zmt
|
---|
585 |
|
---|
586 | Use the additional GCC command line option -Zmt to compile
|
---|
587 | multithread code. The preprocessor macro __MT__ will be
|
---|
588 | defined when -Zmt is used.
|
---|
589 | þif ipf
|
---|
590 | See also þhpt{-Zmts} and þhpt{-Zmtd}.
|
---|
591 | þendif
|
---|
592 |
|
---|
593 |
|
---|
594 | þh3 -Zmtd
|
---|
595 | þlabel -Zmtd
|
---|
596 | þi2 -Zmtd
|
---|
597 | þkeyword -Zmtd
|
---|
598 |
|
---|
599 | Use the additional GCC command line option -Zmtd to link a
|
---|
600 | multithread program that uses emxlibcm.dll, the DLL version of
|
---|
601 | the C library. The preprocessor macro __MT__ will be defined when
|
---|
602 | -Zmtd is used. -Zmtd is equivalent to -Zmt -Zcrtdll and is provided
|
---|
603 | for compatibility with existing makefiles.
|
---|
604 | þif ipf
|
---|
605 | See also þhpt{-Zcrtdll}, þhpt{-Zmt}, þhpt{-Zmts}, and þhpt{Startup
|
---|
606 | modules and libraries}.
|
---|
607 | þendif
|
---|
608 |
|
---|
609 |
|
---|
610 | þh3 -Zmts
|
---|
611 | þlabel -Zmts
|
---|
612 | þi2 -Zmts
|
---|
613 | þkeyword -Zmts
|
---|
614 |
|
---|
615 | Use the additional GCC command line option -Zmts to link a
|
---|
616 | multithread program which is statically linked with the C
|
---|
617 | library. The preprocessor macro __MT__ will be defined if -Zmts is
|
---|
618 | used. -Zmts is equivalent to -Zmt (without -Zcrtdll) and is provided
|
---|
619 | for compatibility with existing makefiles.
|
---|
620 | þif ipf
|
---|
621 | See also þhpt{-Zcrtdll}, þhpt{-Zmt}, þhpt{-Zmtd}, and þhpt{Startup
|
---|
622 | modules and libraries}.
|
---|
623 | þendif
|
---|
624 |
|
---|
625 |
|
---|
626 | þh3 -Zno-rte
|
---|
627 | þlabel -Zno-rte
|
---|
628 | þi2 -Zno-rte
|
---|
629 | þkeyword -Zno-rte
|
---|
630 |
|
---|
631 | Use -Zno-rte with þhpt{-Zdll} and þhpt{-Zomf} (all of which must be
|
---|
632 | specified) to create a DLL without runtime environment
|
---|
633 | not use the runtime environment of its client application.
|
---|
634 | þhpt{-Zcrtdll}, þhpt{-Zmt}, þhpt{-Zmtd}, þhpt{-Zmts}, þhpt{-Zso}, and
|
---|
635 | þhpt{-Zsys} must not be used with -Zno-rte.
|
---|
636 | þif ipf
|
---|
637 | See also þhpt{Startup modules and libraries}.
|
---|
638 | þendif
|
---|
639 |
|
---|
640 |
|
---|
641 | þh3 -Zomf
|
---|
642 | þlabel -Zomf
|
---|
643 | þi2 -Zomf
|
---|
644 | þkeyword -Zomf
|
---|
645 |
|
---|
646 | The additional GCC command line option -Zomf causes GCC to call
|
---|
647 | þhpt{emxomf} for converting .o files to .obj files and to call
|
---|
648 | þhpt{emxomfld} instead of þhpt{ld}. As emxomfld calls LINK386, this
|
---|
649 | option works only under OS/2. You should use a module definition
|
---|
650 | file (.def file) or the þhpt{-Zstack} option if you need a stack
|
---|
651 | bigger than 0x8000 bytes. Note that LINK386 adds a default
|
---|
652 | extension (.exe or .dll) to the output file name.
|
---|
653 |
|
---|
654 | þh3 -Zsmall-conv
|
---|
655 | þlabel -Zsmall-conv
|
---|
656 | þi2 -Zsmall-conv
|
---|
657 | þkeyword -Zsmall-conv
|
---|
658 |
|
---|
659 | The additional GCC command line option -Zomf causes the program to
|
---|
660 | be linked with þtt{smallcnv.o}, select smaller, faster, and
|
---|
661 | inaccurate routines for converting decimal numbers to binary and
|
---|
662 | vice versa. By default, accurate conversion routines are used.
|
---|
663 | -Zsmall-conv saves about 14KB for programs which use binary to
|
---|
664 | decimal conversions, about 11KB for programs which use decimal to
|
---|
665 | binary conversions, and about 15KB for programs which use both.
|
---|
666 |
|
---|
667 | The -Zsmall-conv option cannot be used with the -Zcrtdll option;
|
---|
668 | the C runtime DLLs always use the accurate conversion routines.
|
---|
669 |
|
---|
670 | þh3 -Zstack
|
---|
671 | þlabel -Zstack
|
---|
672 | þi2 -Zstack
|
---|
673 | þkeyword -Zstack
|
---|
674 |
|
---|
675 | The -Zstack option sets the OS/2 stack size of the executable.
|
---|
676 | -Zstack takes an argument, which is the stack size in KByte. The
|
---|
677 | stack size can be given in decimal, octal or hexadecimal, using C
|
---|
678 | notation. The -Zstack option is passed down unmodified to þhpt{ld}
|
---|
679 | or þhpt{emxomfld}. Example:
|
---|
680 |
|
---|
681 | þexample
|
---|
682 | gcc bigstack.c -Zomf -Zstack 0x2000
|
---|
683 | þendexample
|
---|
684 |
|
---|
685 | This sets the stack size to 8 MBytes.
|
---|
686 |
|
---|
687 | þh3 -Zso
|
---|
688 | þlabel -Zso
|
---|
689 | þi2 -Zso
|
---|
690 | þkeyword -Zso
|
---|
691 |
|
---|
692 | Use -Zso with þhpt{-Zdll}, þhpt{-Zsys}, and þhpt{-Zomf} (all of
|
---|
693 | which must be specified) to create a stand-alone DLL, that is, a DLL
|
---|
694 | which does not use the runtime environment of its client application
|
---|
695 | but has a runtime environment of its own.
|
---|
696 | þif ipf
|
---|
697 | See also þhpt{Startup modules and libraries}.
|
---|
698 | þendif
|
---|
699 |
|
---|
700 |
|
---|
701 | þh3 -Zsys
|
---|
702 | þlabel -Zsys
|
---|
703 | þi2 -Zsys
|
---|
704 | þkeyword -Zsys
|
---|
705 |
|
---|
706 | Use -Zsys with þhpt{-Zomf} to link with the system call library (emx
|
---|
707 | emulator) sys.lib instead of using the run time library emx.dll for
|
---|
708 | system calls. The library version of the system calls provide only
|
---|
709 | a subset of the emx system call interface. þhpt{fork()}, for
|
---|
710 | instance, isn't supported with -Zsys. DLLs created with -Zsys must
|
---|
711 | be either custom C runtime DLLs or stand-alone DLLs (see þhpt{-Zso}).
|
---|
712 | þif ipf
|
---|
713 | See also þhpt{Startup modules and libraries}.
|
---|
714 | þendif
|
---|
715 |
|
---|
716 |
|
---|
717 | þh3 -Zsysv-signals
|
---|
718 | þlabel -Zsysv-signals
|
---|
719 | þi2 -Zsysv-signals
|
---|
720 | þkeyword -Zsysv-signals
|
---|
721 |
|
---|
722 | The additional GCC command line option -Zsysv-signals causes the
|
---|
723 | program to be linked with þtt{sigsysv.o}, selecting the `System V'
|
---|
724 | signal processing model. See also þhpt{-Zbsd-signals}.
|
---|
725 | -Zsysv-signals cannot be used with þhpt{-Zsys}.
|
---|
726 |
|
---|
727 |
|
---|
728 | þh2 Special file extensions
|
---|
729 | þlabel Special file extensions
|
---|
730 |
|
---|
731 | You can give the name of a module definition file on the command
|
---|
732 | line. The name must end with .def and is passed to þhpt{ld}, which
|
---|
733 | in turn passes it to þhpt{emxbind}. When using þhpt{-Zomf}, the
|
---|
734 | name is passed to þhpt{emxomfld}, which in turn passes it to
|
---|
735 | LINK386. If the output file names ends with .dll, a default module
|
---|
736 | definition file is used by emxbind unless a .def file is given on
|
---|
737 | the GCC command line.
|
---|
738 |
|
---|
739 | You can give the name of a binary resource file on the command
|
---|
740 | line. The name must end with .res and is passed to ld, which in
|
---|
741 | turn passes it to emxbind. When using -Zomf, the name is passed to
|
---|
742 | emxomfld, which runs þbf{rc} to copy the resources to the output
|
---|
743 | file.
|
---|
744 |
|
---|
745 | þh2 Startup modules and libraries
|
---|
746 | þlabel Startup modules and libraries
|
---|
747 |
|
---|
748 | The following table shows the startup module and the libraries
|
---|
749 | passed to the linker by GCC, depending on the command line options
|
---|
750 | þhpt{-Zcrtdll}, þhpt{-Zmt}, þhpt{-Zomf}, þhpt{-Zso}, þhpt{-Zsys}, and
|
---|
751 | þhpt{-Zdll}. Note that -Zmtd is equivalent to -Zmt -Zcrtdll and
|
---|
752 | -Zmts is equivalent to -Zmt without -Zcrtdll:
|
---|
753 |
|
---|
754 | þexample
|
---|
755 | Options ³Startup³ Libraries
|
---|
756 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
---|
757 | -Zomf not specified ³ *.o ³ *.a
|
---|
758 | -Zomf specified ³ *.a ³ *.lib
|
---|
759 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
---|
760 | (none) ³ crt0 ³ gcc st/c st/c_app st/emx emx2
|
---|
761 | -Zmt³ crt0 ³ gcc mt/c mt/c_app mt/emx emx2
|
---|
762 | -Zsys ³ crt0 ³ gcc st/c st/c_app st/sys
|
---|
763 | -Zsys -Zmt³ crt0 ³ gcc mt/c mt/c_app mt/sys
|
---|
764 | -Zcrtdll ³ crt0 ³ c_static st/c_import emx2
|
---|
765 | -Zcrtdll -Zmt³ crt0 ³ c_static mt/c_import emx2
|
---|
766 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
---|
767 | -Zdll ³ dll0 ³ gcc st/c st/c_dllrt st/emx emx2
|
---|
768 | -Zdll -Zmt³ dll0 ³ gcc mt/c mt/c_dllrt mt/emx emx2
|
---|
769 | -Zdll -Zsys ³ dll0 ³ gcc st/c st/c_dllrt st/sys
|
---|
770 | -Zdll -Zsys -Zmt³ dll0 ³ gcc mt/c mt/c_dllrt mt/sys
|
---|
771 | -Zdll -Zsys -Zso ³ dll0 ³ gcc st/c st/c_dllso st/sys
|
---|
772 | -Zdll -Zsys -Zso -Zmt³ dll0 ³ gcc mt/c mt/c_dllso mt/sys
|
---|
773 | -Zdll -Zno-rte ³ dll0 ³ gcc st/c c_dllnrt
|
---|
774 | -Zdll -Zcrtdll ³ dll0 ³ c_static st/c_import emx2
|
---|
775 | -Zdll -Zcrtdll -Zmt³ dll0 ³ c_static mt/c_import emx2
|
---|
776 | þendexample
|
---|
777 |
|
---|
778 | In addition to the libraries mentioned above, the alias library
|
---|
779 | (c_alias.a or c_alias.lib) and the OS/2 import library (os2.a or
|
---|
780 | os2.lib) are always passed to the linker. If -Zomf is used,
|
---|
781 | þtt{end.lib} is also passed to the linker. Note that -Zomf must be
|
---|
782 | used if -Zsys is used.
|
---|
783 |
|
---|
784 | þh2 Assertions
|
---|
785 | þlabel Assertions
|
---|
786 |
|
---|
787 | The following assertions are predefined in the emx port of GCC:
|
---|
788 | þtt{#system(unix)}, þtt{#system(emx)}, þtt{#cpu(i386)} and
|
---|
789 | þtt{#machine(i386)}.
|
---|
790 |
|
---|
791 |
|
---|
792 | þh2 C++
|
---|
793 | þlabel C++
|
---|
794 |
|
---|
795 | Files containing C++ programs should have one of the following file
|
---|
796 | name extensions:
|
---|
797 |
|
---|
798 | þdescription
|
---|
799 | þitem .cc
|
---|
800 |
|
---|
801 | Unix style
|
---|
802 |
|
---|
803 | þitem .cpp
|
---|
804 |
|
---|
805 | PC style (GCC has been patched to recognize this)
|
---|
806 |
|
---|
807 | þitem .cxx
|
---|
808 |
|
---|
809 | (?)
|
---|
810 |
|
---|
811 | þitem .C
|
---|
812 |
|
---|
813 | Type an upper-case C!
|
---|
814 |
|
---|
815 | þenddescription
|
---|
816 |
|
---|
817 | Use the -lstdcpp command line option to link C++ programs with the
|
---|
818 | GNU standard C++ library (þhpt{libstdc++}), which includes the
|
---|
819 | former iostream library.
|
---|
820 |
|
---|
821 | Use the -lgpp command line option to link C++ programs with the GNU
|
---|
822 | C++ class libraray (þhpt{libg++}). If you link with libg++,
|
---|
823 | you have to obey the rules stated in þtt{/emx/doc/COPYING.LIB}.
|
---|
824 |
|
---|
825 | Example:
|
---|
826 |
|
---|
827 | þexample
|
---|
828 | gcc hello.cc -lstdcpp -s
|
---|
829 | þendexample
|
---|
830 |
|
---|
831 | The þbf{collect} program is not required with the emx port of GCC.
|
---|
832 |
|
---|
833 | Hint: Use the -s option (of GCC, þhpt{emxomf} or þhpt{emxbind}) to
|
---|
834 | remove the symbol table; it's quite big.
|
---|
835 |
|
---|
836 |
|
---|
837 | þh2 Objective C
|
---|
838 | þlabel Objective C
|
---|
839 |
|
---|
840 | To link a program written in the Objective C language, you have to
|
---|
841 | use library þtt{objc}: use -lobjc on the GCC command line. Example:
|
---|
842 |
|
---|
843 | þexample
|
---|
844 | gcc objcsamp.m -lobjc -s
|
---|
845 | þendexample
|
---|
846 |
|
---|
847 | Note that GCC does not include any class libraries for Objective C.
|
---|
848 |
|
---|
849 |
|
---|
850 | þh2 Stack probes
|
---|
851 | þlabel Stack probes
|
---|
852 | þlabel stack probes
|
---|
853 |
|
---|
854 | Stack probes are used to manage automatic stack growth if the stack
|
---|
855 | is not completely committed. When allocating stack space, the new
|
---|
856 | stack pages are touched before changing the stack pointer to make
|
---|
857 | them accessible. Generation of stack probes is disabled by default.
|
---|
858 | Use the þhpt{-mprobe} option to enable generation of stack probes.
|
---|
859 |
|
---|
860 | The -fstack-check option of GCC generates stack probes for stack
|
---|
861 | checking; when there's not enough stack space, an exception will be
|
---|
862 | generated. Unlike -mprobe, -fstack-check guarantees "enough" stack
|
---|
863 | space left for running a simple exception handler.
|
---|
864 |
|
---|
865 | You need stack probes if
|
---|
866 |
|
---|
867 | þitemize
|
---|
868 | þitem
|
---|
869 |
|
---|
870 | you use DosCreateThread to create a thread that doesn't have a
|
---|
871 | completely committed stack, that is, if bit 1 of the
|
---|
872 | þsl{ulThreadFlags} argument is zero, or
|
---|
873 |
|
---|
874 | þitem
|
---|
875 |
|
---|
876 | you create a DLL which might be used by an application which uses
|
---|
877 | DosCreateThread to create a thread that doesn't have a completely
|
---|
878 | committed stack, or
|
---|
879 |
|
---|
880 | þitem
|
---|
881 |
|
---|
882 | you want to trap the stack overflow exception issued when hitting
|
---|
883 | the guard page at the bottom of the stack. (You should use
|
---|
884 | -fstack-check instead of -mprobe.)
|
---|
885 |
|
---|
886 | þenditemize
|
---|
887 |
|
---|
888 | Stack probes are not generated for all allocations of stack space: A
|
---|
889 | stack probe is not generated if the size of the allocated memory
|
---|
890 | block is constant and less than 4096 bytes. This optimization
|
---|
891 | causes a problem if two such allocations of stack space occur
|
---|
892 | without access to the stack between the allocations. There are two
|
---|
893 | occasions for this: Two calls in a row to þhpt{alloca()} with
|
---|
894 | constant argument which is less than 4096 and where nothing is
|
---|
895 | stored to the first pointer returned by alloca() before getting the
|
---|
896 | second pointer:
|
---|
897 |
|
---|
898 | þexample
|
---|
899 | p = alloca (0xf00);
|
---|
900 | q = alloca (0xf00);
|
---|
901 | þendexample
|
---|
902 |
|
---|
903 | The second case is a function with less than 4096 bytes of local
|
---|
904 | data which calls alloca() with constant argument which is less than
|
---|
905 | 4096 before accessing a local variable or calling a function:
|
---|
906 |
|
---|
907 | þexample
|
---|
908 | void test (void)
|
---|
909 | {
|
---|
910 | char local[0xf00], *p;
|
---|
911 |
|
---|
912 | p = alloca (0xf00);
|
---|
913 | /*...*/
|
---|
914 | }
|
---|
915 | þendexample
|
---|
916 |
|
---|
917 | As both cases are unlikely to occur in practice, I chose to not
|
---|
918 | generate a stack probe for less than 4096 bytes. If you experience
|
---|
919 | problems (that is, stack exceptions), insert the statement
|
---|
920 |
|
---|
921 | þexample
|
---|
922 | {char *p=alloca (0); *p = 0;}
|
---|
923 | þendexample
|
---|
924 |
|
---|
925 | in critical places, as between the two alloca() calls in the first
|
---|
926 | example and before the alloca() call in the second example.
|
---|
927 |
|
---|
928 | All emx libraries are compiled with both stack probes and stack
|
---|
929 | checking enabled.
|
---|
930 |
|
---|
931 |
|
---|
932 | þh2 Other changes
|
---|
933 | þlabel Other changes
|
---|
934 |
|
---|
935 | The preprocessor CPP defines the symbols __32BIT__ and __EMX__. If
|
---|
936 | the þhpt{-Zmt}, þhpt{-Zmts}, or þhpt{-Zmtd} option is given on the
|
---|
937 | GCC command line, the symbol __MT__ is defined.
|
---|
938 |
|
---|
939 | The file name extensions of the debugging output files (-d option)
|
---|
940 | have been changed as follows:
|
---|
941 |
|
---|
942 | þexample
|
---|
943 | combine -> cmb
|
---|
944 | cse -> cs1
|
---|
945 | cse2 -> cs2
|
---|
946 | flow -> flo
|
---|
947 | greg -> gre
|
---|
948 | jump -> jp1
|
---|
949 | jump2 -> jp2
|
---|
950 | loop -> loo
|
---|
951 | lreg -> lre
|
---|
952 | sched -> sd1
|
---|
953 | sched2 -> sd2
|
---|
954 | stack -> stk
|
---|
955 | þendexample
|
---|
956 |
|
---|
957 | The extension is added to the base name of the input file, not to
|
---|
958 | the complete name of the input file. For instance, when compiling
|
---|
959 | þtt{world.c}, the file þtt{world.cs1} will be created instead of
|
---|
960 | þtt{world.c.cse}. If using the -da GCC option, you should use the
|
---|
961 | þtt{-h30} emx option.
|
---|
962 |
|
---|
963 |
|
---|
964 | þh2 Calling conventions
|
---|
965 | þlabel Calling conventions
|
---|
966 |
|
---|
967 | The calling convention used by GCC is almost compatible with the
|
---|
968 | `þtt{system}' calling convention of IBM C Set/2. Structures are
|
---|
969 | returned differently: IBM C Set/2 uses a hidden parameter which is
|
---|
970 | removed from the stack by the caller, GCC returns the structure in
|
---|
971 | registers EAX and EDX if its size is 8 bytes or less
|
---|
972 | (-freg-struct-return is the default). GCC uses a hidden parameter
|
---|
973 | if the size of the structure is more than 8 bytes, but the callee
|
---|
974 | removes the hidden parameter from the stack. Currently, the GCC
|
---|
975 | option -fpcc-struct-return doesn't solve that problem. Instead,
|
---|
976 | rewrite the function and the function call as follows:
|
---|
977 |
|
---|
978 | þexample
|
---|
979 | /* Original code */
|
---|
980 | struct s1 func1 (int a1)
|
---|
981 | {
|
---|
982 | struct s1 t1;
|
---|
983 | ...
|
---|
984 | return (t1);
|
---|
985 | }
|
---|
986 | ...
|
---|
987 |
|
---|
988 | struct s1 v1;
|
---|
989 | v1 = f1 (0);
|
---|
990 | þendexample
|
---|
991 |
|
---|
992 |
|
---|
993 | þexample
|
---|
994 | /* Modified code */
|
---|
995 |
|
---|
996 | struct s1 *f1 (struct s1 *ret, int a1)
|
---|
997 | {
|
---|
998 | struct s1 t1;
|
---|
999 | ...
|
---|
1000 | *ret = t1;
|
---|
1001 | return (ret);
|
---|
1002 | }
|
---|
1003 |
|
---|
1004 | ...
|
---|
1005 |
|
---|
1006 | struct s1 v1;
|
---|
1007 | f1 (&v1, 0);
|
---|
1008 | þendexample
|
---|
1009 |
|
---|
1010 | þi1
|
---|
1011 |
|
---|
1012 | þh1 libg++ -- the GNU C++ library (gpp.a and gpp.lib)
|
---|
1013 | þlabel libg++
|
---|
1014 | þlabel gpp
|
---|
1015 | þindex libg++
|
---|
1016 | þindex gpp
|
---|
1017 |
|
---|
1018 | libg++ 2.8.1.1a, the obsolete GNU C++ library, has been ported to
|
---|
1019 | emx.
|
---|
1020 |
|
---|
1021 | If you link with libg++, (-lgpp), you have to obey the rules
|
---|
1022 | stated in þtt{/emx/doc/COPYING.LIB}.
|
---|
1023 |
|
---|
1024 | Due to name collisions, the following include files have been renamed:
|
---|
1025 |
|
---|
1026 | þexample
|
---|
1027 | Complex.h -> Complx.h
|
---|
1028 | Regex.h -> Regx.h
|
---|
1029 | String.h -> Strng.h
|
---|
1030 | þendexample
|
---|
1031 |
|
---|
1032 |
|
---|
1033 | þh1 libstdc++ -- the GNU standard C++ library
|
---|
1034 | þlabel libstdc++
|
---|
1035 | þindex libstdc++
|
---|
1036 |
|
---|
1037 | libstdc++ 2.8.1.1, the GNU standard C++ library, is provided for emx.
|
---|
1038 | Use the -lstdcpp option to link with that library.
|
---|
1039 | See þtt{/emx/doc/COPYING.SCP} for copyright information.
|
---|
1040 |
|
---|
1041 | The þtt{istream::seekg}, þtt{istream::tellg}, þtt{ostream::seekp},
|
---|
1042 | and þtt{ostream::tellg} methods do not work for text files.
|
---|
1043 |
|
---|
1044 |
|
---|
1045 | þh1 GDB -- debugging programs
|
---|
1046 | þlabel GDB
|
---|
1047 | þindex GDB
|
---|
1048 | þkeyword GDB
|
---|
1049 |
|
---|
1050 | GDB uses GNU þhpt{readline}, see below. GDB works only with a.out
|
---|
1051 | files (under DOS) and with bound files (both under OS/2 and DOS),
|
---|
1052 | not with arbitrary DOS or OS/2 progams. The DUEL debugging language
|
---|
1053 | has been added to GDB, see below. Anthony Green's þhpt{GDBRX}
|
---|
1054 | extension has been added to GDB, see below.
|
---|
1055 |
|
---|
1056 | See the GDB manual for details.
|
---|
1057 |
|
---|
1058 | A preliminary version of a Presentation Manager front end for GDB is
|
---|
1059 | shipped with emx. See the online help and the online tutorial of
|
---|
1060 | pmgdb for details.
|
---|
1061 |
|
---|
1062 | þh2 Example
|
---|
1063 |
|
---|
1064 | The following example shows how to debug a fictitious program
|
---|
1065 | þtt{myprog.exe}. See install.doc for an example with one of the emx
|
---|
1066 | sample programs.
|
---|
1067 |
|
---|
1068 | þexample
|
---|
1069 | C> gcc -g myprog.c (compile)
|
---|
1070 | C> gdb myprog.exe (start debugger)
|
---|
1071 | (gdb) set args -o myprog.out myprog.in (set arguments)
|
---|
1072 | (gdb) b main (set breakpoint)
|
---|
1073 | (gdb) run (start program)
|
---|
1074 | (gdb) dl argv[0..argc-1] (display arguments)
|
---|
1075 | (gdb) s (step)
|
---|
1076 | þendexample
|
---|
1077 |
|
---|
1078 | Command line arguments for the program to be debugged can be passed
|
---|
1079 | on the GDB command line if the þtt{--args} option is used:
|
---|
1080 |
|
---|
1081 | þexample
|
---|
1082 | C> gcc -g myprog.c (compile)
|
---|
1083 | C> gdb --args myprog.exe -o myprog.out myprog.in (start debugger)
|
---|
1084 | (gdb) b main (set breakpoint)
|
---|
1085 | (gdb) run (start program)
|
---|
1086 | (gdb) dl argv[0..argc-1] (display arguments)
|
---|
1087 | (gdb) s (step)
|
---|
1088 | þendexample
|
---|
1089 |
|
---|
1090 | If the executable file cannot be found and does not include a
|
---|
1091 | filename extension, GDB appends `þtt{.exe}' to the filename and
|
---|
1092 | tries again.
|
---|
1093 |
|
---|
1094 | Continuing the example, if there's no file named `þtt{myprog}', you
|
---|
1095 | can omit the `þtt{.exe}' extension of the executable file name:
|
---|
1096 |
|
---|
1097 | þexample
|
---|
1098 | C> gdb --args myprog -o myprog.out myprog.in
|
---|
1099 | þendexample
|
---|
1100 |
|
---|
1101 | That is, you can just prepend `þtt{gdb --args}' to the command line.
|
---|
1102 |
|
---|
1103 | þh2 Restrictions
|
---|
1104 |
|
---|
1105 | Please do not use backslashes in path names. For your convenience,
|
---|
1106 | backslashes in path names specified as command line arguments of GDB
|
---|
1107 | are automatically turned into slashes. For commands entered
|
---|
1108 | interactively, you have to use slashes yourself.
|
---|
1109 |
|
---|
1110 | The following GDB commands do not work or do not work completely or
|
---|
1111 | have been changed:
|
---|
1112 |
|
---|
1113 | þitemize
|
---|
1114 | þitem
|
---|
1115 |
|
---|
1116 | `þtt{signal}' does not work under OS/2 unless the same signal is used
|
---|
1117 | by which the debuggee has been stopped
|
---|
1118 |
|
---|
1119 | þitem
|
---|
1120 |
|
---|
1121 | `þtt{attach}' and `þtt{detach}' cannot work in general; however,
|
---|
1122 | these commands can be used in a limited way for descendant processes
|
---|
1123 | as explained below
|
---|
1124 |
|
---|
1125 | þitem
|
---|
1126 |
|
---|
1127 | `þtt{tty}' and `þtt{term-status}' are not implemented
|
---|
1128 |
|
---|
1129 | þitem
|
---|
1130 |
|
---|
1131 | `þtt{directory}' has been changed to use semicolons instead of
|
---|
1132 | colons for separating directories.
|
---|
1133 |
|
---|
1134 | þitem
|
---|
1135 |
|
---|
1136 | `þtt{watch}' is almost unusable because GDB disables the watchpoints
|
---|
1137 | as soon as a function without debugging symbols is called, such as
|
---|
1138 | an OS/2 API function. That could be fixed by making GDB believe
|
---|
1139 | that the functions in os2.a have debugging symbols.
|
---|
1140 |
|
---|
1141 | þenditemize
|
---|
1142 |
|
---|
1143 | þh2 Special features
|
---|
1144 |
|
---|
1145 | Various special features have been added to the emx port of GDB.
|
---|
1146 |
|
---|
1147 | þipfminitoc
|
---|
1148 |
|
---|
1149 | þh3 Setting command line arguments for the program being debugged
|
---|
1150 |
|
---|
1151 | The þtt{--args} option of GDB causes all arguments following the
|
---|
1152 | name of the executable file on the command line of GDB to be used as
|
---|
1153 | arguments for the program for the program being to debugged.
|
---|
1154 | Example:
|
---|
1155 |
|
---|
1156 | þexample
|
---|
1157 | gdb --args -nx myprog.exe -o myprog.out myprog.in
|
---|
1158 | þendexample
|
---|
1159 |
|
---|
1160 | This invocation of GDB is equivalent to running
|
---|
1161 |
|
---|
1162 | þexample
|
---|
1163 | gdb -nx myprog.exe
|
---|
1164 | þendexample
|
---|
1165 |
|
---|
1166 | and typing the GDB command
|
---|
1167 |
|
---|
1168 | þexample
|
---|
1169 | set args -o myprog.out myprog.in
|
---|
1170 | þendexample
|
---|
1171 |
|
---|
1172 | However, the `þtt{set args}' command supports redirection operators,
|
---|
1173 | whereas þtt{--args} passes them as command line arguments to the
|
---|
1174 | program being debugged. The `þtt{show args}' command does not print
|
---|
1175 | the equivalent `þtt{set args}' arguments for achieving the effect of
|
---|
1176 | þtt{--args}; for instance, quoting is not correct.
|
---|
1177 |
|
---|
1178 | þh3 Running the debuggee in the same window
|
---|
1179 |
|
---|
1180 | If you want to run the debuggee in the same OS/2 session (window) as
|
---|
1181 | GDB (for instance if you're running GDB in a full-screen session),
|
---|
1182 | use the -E emx option.
|
---|
1183 |
|
---|
1184 | þh3 Switching sessions
|
---|
1185 |
|
---|
1186 | By default, GDB selects the child session when executing a þtt{CALL}
|
---|
1187 | instruction of the inferior process. Use the `þtt{set switch off}'
|
---|
1188 | command to disable that feature. Use `þtt{set switch on}' to turn
|
---|
1189 | on switching to the child session. Use `þtt{show switch}' to
|
---|
1190 | display the current setting. Under DOS, `þtt{set switch}' is
|
---|
1191 | ignored.
|
---|
1192 |
|
---|
1193 | To debug a Presentation Manager application, run GDB full-screen and
|
---|
1194 | use `þtt{set switch on}'. Do not manually switch to the
|
---|
1195 | Presentation Manager session while the program is stopped!
|
---|
1196 | Otherwise the Presentation Manager will hang and you will have to reboot.
|
---|
1197 | Alternatively, you can use pmgdb to debug Presentation Manager
|
---|
1198 | applications.
|
---|
1199 |
|
---|
1200 | As import method þhpt{(I1)} uses a þtt{JMP} instruction instead of a
|
---|
1201 | þtt{CALL} instruction to call OS/2 API functions, the `þtt{stepi}'
|
---|
1202 | command must not be used to step into the code generated by emximp
|
---|
1203 | for a method (I1) import. Use `þtt{nexti}' on the call to that
|
---|
1204 | code, instead.
|
---|
1205 |
|
---|
1206 | þh3 Closing the window after termination of the debuggee
|
---|
1207 |
|
---|
1208 | Use the `þtt{set close}' command to control whether to close the
|
---|
1209 | child session window after termination of the debuggee. `þtt{set
|
---|
1210 | close off}' is the default -- the window will stay open. After a
|
---|
1211 | debuggee has been started, `þtt{set close}' doesn't take effect for
|
---|
1212 | that debuggee.
|
---|
1213 |
|
---|
1214 | þh3 Debugging threads
|
---|
1215 |
|
---|
1216 | You can freeze a thread with the `þtt{thread disable}' command
|
---|
1217 | (`þtt{freeze}' is an alias). Without argument, this command freezes
|
---|
1218 | the current thread. Otherwise, the argument must be a thread
|
---|
1219 | number. A frozen thread won't execute until you thaw it.
|
---|
1220 |
|
---|
1221 | You can thaw a thread with the `þtt{thread enable}' command
|
---|
1222 | (`þtt{thaw}' is an alias). Without argument, this command thaws the
|
---|
1223 | current thread. Otherwise, the argument must be a thread number.
|
---|
1224 |
|
---|
1225 | You can freeze or thaw multiple threads with one command by using
|
---|
1226 | `þtt{thread apply}':
|
---|
1227 |
|
---|
1228 | þexample
|
---|
1229 | thread apply all thaw
|
---|
1230 | thread apply 2-4 6 freeze
|
---|
1231 | þendexample
|
---|
1232 |
|
---|
1233 | Restarting the process being debugged while the current thread is
|
---|
1234 | frozen will result in this message:
|
---|
1235 |
|
---|
1236 | þexample
|
---|
1237 | ptrace: No such process.
|
---|
1238 | þendexample
|
---|
1239 |
|
---|
1240 | Use the `þtt{thread}' command to switch to an enabled thread when
|
---|
1241 | this happens:
|
---|
1242 |
|
---|
1243 | þexample
|
---|
1244 | thread 5
|
---|
1245 | þendexample
|
---|
1246 |
|
---|
1247 | Note that debugging multithread processes has some rough edges. See
|
---|
1248 | the GDB manual for more information on debugging multithread
|
---|
1249 | processes.
|
---|
1250 |
|
---|
1251 | þh3 Debugging DLLs
|
---|
1252 |
|
---|
1253 | GDB automatically loads the symbols of DLLs created with ld and
|
---|
1254 | emxbind. Currently, there are a few rough edges such as problems
|
---|
1255 | with restarting the program being debugged if symbols have been
|
---|
1256 | loaded from DLLs.
|
---|
1257 |
|
---|
1258 | Use the `þtt{set show-dlls on}' command to let GDB show the path names
|
---|
1259 | of DLLs as they are loaded and freed.
|
---|
1260 |
|
---|
1261 | Use the `þtt{dll-break}' command to set a stop-on-load breakpoint on
|
---|
1262 | a DLL. The `þtt{dll-break}' command takes one argument, the name of
|
---|
1263 | the DLL. The name must not include a path; the extension
|
---|
1264 | `þtt{.dll}' will be added if no extension is provided. Letter case
|
---|
1265 | does not matter. When the named DLL is loaded, GDB will stop the
|
---|
1266 | program being debugged. Then, you can set breakpoints in the DLL
|
---|
1267 | and continue. The `þtt{dll-clear}' command removes a stop-on-load
|
---|
1268 | breakpoint by number; the `þtt{info dll-break}' command lists all
|
---|
1269 | stop-on-load breakpoints, showing the number of the stop-on-load
|
---|
1270 | breakpoint and the name of the DLL.
|
---|
1271 |
|
---|
1272 | þh3 Debugging descendant processes
|
---|
1273 |
|
---|
1274 | Under OS/2, you can optionally debug processes (descendant
|
---|
1275 | processes) started by the debuggee. For each descendant process to
|
---|
1276 | be debugged, one extra instance of GDB will be required. Due to
|
---|
1277 | OS/2 limitations, session switching does not work for descendants;
|
---|
1278 | therefore descendants which are Presentation Manager applications
|
---|
1279 | cannot be debugged.
|
---|
1280 |
|
---|
1281 | GDB maintains a list of programs to be debugged when started by the
|
---|
1282 | debuggee. The `þtt{descendant add}' command adds a program to that
|
---|
1283 | list. The first argument of that command is the name of the
|
---|
1284 | executable file, which can be specified in the following three ways:
|
---|
1285 |
|
---|
1286 | þenumerate
|
---|
1287 | þitem
|
---|
1288 | A path name (including a directory) will be turned into an absolute
|
---|
1289 | path name by GDB; all descendants matching the absolute path name
|
---|
1290 | will be debugged. The path name should include the correct file
|
---|
1291 | name extension as no default extension will be applied.
|
---|
1292 | þitem
|
---|
1293 | A file name (without directory); all descendants whose file name
|
---|
1294 | (without directory) match the specified file name will be debugged.
|
---|
1295 | The file name should include the correct file name extension as no
|
---|
1296 | default extension will be applied.
|
---|
1297 | þitem
|
---|
1298 | The word `þtt{fork}' means that this entry applies to child
|
---|
1299 | processes created with fork().
|
---|
1300 | þitem
|
---|
1301 | A `þtt{*}' means that this entry applies to all descendants, without
|
---|
1302 | regard to their file names.
|
---|
1303 | þendenumerate
|
---|
1304 |
|
---|
1305 | The second argument specifies the action to be taken when a
|
---|
1306 | descendant with a matching executable file name is started. The
|
---|
1307 | following actions are available:
|
---|
1308 |
|
---|
1309 | þdescription
|
---|
1310 | þitem þtt{window}
|
---|
1311 | Start a new instance of GDB, running in a new windowed session.
|
---|
1312 |
|
---|
1313 | þitem þtt{fs}
|
---|
1314 | Start a new instance of GDB, running in a new full-screen session.
|
---|
1315 |
|
---|
1316 | þitem þtt{cont}
|
---|
1317 | Do not start a new instance of GDB and continue the debuggee. The
|
---|
1318 | descendant will block until GDB is attached to the descendant. Note
|
---|
1319 | that the debuggee may also block if it waits for the start or
|
---|
1320 | completion of the child process.
|
---|
1321 | þenddescription
|
---|
1322 |
|
---|
1323 | If the first argument is `þtt{fork}' and the third argument is
|
---|
1324 | `þtt{init}', you'll be able to debug the initialization code of the
|
---|
1325 | forked process; this is used for debugging the implementation of
|
---|
1326 | fork(). If there is no third argument or if the third argument is
|
---|
1327 | not `þtt{init}', debugging of the child process will start in the
|
---|
1328 | fork() call; one `þtt{step}' command will step to the location (in
|
---|
1329 | the child process) from which fork() has been called (in the parent
|
---|
1330 | process).
|
---|
1331 |
|
---|
1332 | Any remaining arguments should be GDB options and will be passed to
|
---|
1333 | the new instance of GDB. This is in particular useful to set up GDB
|
---|
1334 | with commands from a file specified with `þtt{--command}' or to
|
---|
1335 | prevent GDB from reading the `þtt{!gdbinit}' file with `þtt{-nx}'.
|
---|
1336 |
|
---|
1337 | Examples for `þtt{descendant add}':
|
---|
1338 |
|
---|
1339 | þexample
|
---|
1340 | desc add * window
|
---|
1341 | desc add fork window init -q
|
---|
1342 | desc add special.exe window --command special.gdb
|
---|
1343 | þendexample
|
---|
1344 |
|
---|
1345 | At least one descendant must be defined with `þtt{descendant add}'
|
---|
1346 | þem{before} the start of the debuggee; otherwise debugging of
|
---|
1347 | descendants will be disabled. If debugging of descendants is
|
---|
1348 | enabled (by defining at least one descendant), GDB will show a
|
---|
1349 | message each time a new descendant is started:
|
---|
1350 |
|
---|
1351 | þexample
|
---|
1352 | [New process: 4713 C:/EMX/TEST/ARGS.EXE]
|
---|
1353 | þendexample
|
---|
1354 |
|
---|
1355 | The message includes the process ID (4713 in the example) and the
|
---|
1356 | path name of the executable file. If the path name does not match
|
---|
1357 | any entry in the table of descendants, the descendant will be run
|
---|
1358 | with debugging disabled. The descendant will be terminated or will
|
---|
1359 | block if the instance of GDB debugging its parent process ends.
|
---|
1360 |
|
---|
1361 | If the path name matches an entry in the table of descendants, the
|
---|
1362 | associated action will be performed. First, the table is searched
|
---|
1363 | for a matching absolute path name. If there is no matching entry,
|
---|
1364 | all entries having file names (without directory) will be searched.
|
---|
1365 | If there is still no matching entry, the `þtt{*}' entry will be used
|
---|
1366 | if present. That is, the most stricly matching entry will be used,
|
---|
1367 | falling back to more general entries if there is no matching entry.
|
---|
1368 |
|
---|
1369 | For the actions `þtt{window}' and `þtt{fs}' a new instance of GDB
|
---|
1370 | will be started for the descendant. Now, you can set a breakpoint
|
---|
1371 | (usually on `þtt{main}') and continue execution of the descendant
|
---|
1372 | with the `þtt{continue}' command. If the descendant has been
|
---|
1373 | created with fork(), use the `þtt{step}' command. The instance of
|
---|
1374 | GDB debugging the parent process of the descendant must not be
|
---|
1375 | terminated until debugging of all the descendants of that parent
|
---|
1376 | process is complete.
|
---|
1377 |
|
---|
1378 | The following example shows how to debug `þtt{args.exe}' when run
|
---|
1379 | from `þtt{exec.exe}'. Both are test programs in þtt{\emx\test}.
|
---|
1380 | First, start GDB on the parent process:
|
---|
1381 |
|
---|
1382 | þexample
|
---|
1383 | [c:\emx\test]gdb -q exec.exe
|
---|
1384 | (gdb) desc add * window -q
|
---|
1385 | Debugging of descendant * enabled (number 1).
|
---|
1386 | (gdb) set close
|
---|
1387 | (gdb) run
|
---|
1388 | Starting program: c:/emx/test/exec.exe
|
---|
1389 | [New thread 1]
|
---|
1390 | þendexample
|
---|
1391 |
|
---|
1392 | Now type `þtt{run args a b c}' in the `þtt{exec.exe}' window. This
|
---|
1393 | will cause `þtt{exec.exe}' to start `þtt{args.exe}'. GDB will display
|
---|
1394 |
|
---|
1395 | þexample
|
---|
1396 | [New process: 41 C:/EMX/TEST/ARGS.EXE]
|
---|
1397 | þendexample
|
---|
1398 |
|
---|
1399 | and a new window will show up, running GDB:
|
---|
1400 |
|
---|
1401 | þexample
|
---|
1402 | 0x138 in ?? ()
|
---|
1403 | (gdb)
|
---|
1404 | þendexample
|
---|
1405 |
|
---|
1406 | Now, you can debug `þtt{args.exe}':
|
---|
1407 |
|
---|
1408 | þexample
|
---|
1409 | (gdb) b main
|
---|
1410 | Breakpoint 1 at 0x1007f: file args.c, line 11.
|
---|
1411 | (gdb) cont
|
---|
1412 | Continuing.
|
---|
1413 | [New thread 1]
|
---|
1414 | [Switching to thread 1]
|
---|
1415 |
|
---|
1416 | Breakpoint 1, main (argc=4, argv=0x282ffd4, envp=0x282fdc8) at args.c:11
|
---|
1417 | 11 _envargs (&argc, &argv, "ARGS");
|
---|
1418 | (gdb) p argv[1]
|
---|
1419 | $1 = 0x282fff0 "a"
|
---|
1420 | (gdb) cont
|
---|
1421 | Continuing.
|
---|
1422 | [Thread terminated: 1]
|
---|
1423 |
|
---|
1424 | Program exited normally.
|
---|
1425 | (gdb) q
|
---|
1426 | þendexample
|
---|
1427 |
|
---|
1428 | If the action `þtt{cont}' is specified for a descendant, you have to
|
---|
1429 | start GDB manually to debug the descendant. Use the `þtt{attach}'
|
---|
1430 | command with the process ID of the descendant as argument:
|
---|
1431 |
|
---|
1432 | þexample
|
---|
1433 | [C:\EMX\TEST]gdb -q args.exe
|
---|
1434 | (gdb) attach 41
|
---|
1435 | Attaching to program `c:/emx/test/args.exe', process 41
|
---|
1436 | 0x138 in ?? ()
|
---|
1437 | (gdb)
|
---|
1438 | þendexample
|
---|
1439 |
|
---|
1440 | You can take the process ID from the output of the instance of GDB
|
---|
1441 | debugging the parent process. The `þtt{detach}' command detaches
|
---|
1442 | GDB from the descendant, letting the descendant run without
|
---|
1443 | debugging (as long as the instance of GDB debugging the parent
|
---|
1444 | process lives).
|
---|
1445 |
|
---|
1446 | Note that GDB's table of descendants applies to the first level of
|
---|
1447 | descendants only; to debug a child process of a descendant process,
|
---|
1448 | you have to issue another `þtt{descendant add}' command in the
|
---|
1449 | second instance of GDB. Child processes of descendants not defined
|
---|
1450 | in the table of descendants cannot be debugged.
|
---|
1451 |
|
---|
1452 | The `þtt{info descendants}' command lists the table of descendands;
|
---|
1453 | for each descendant, a number, the path name or file name, the
|
---|
1454 | action, and the GDB options are shown.
|
---|
1455 |
|
---|
1456 | The `þtt{descendant clear}' command removes an entry of the table of
|
---|
1457 | descendants. You have to specify the number of the entry, as shown
|
---|
1458 | by `þtt{info descendants}'.
|
---|
1459 |
|
---|
1460 | To modify an entry of the table of descendants, just issue another
|
---|
1461 | `þtt{descendant add}' command for the same file name or path name.
|
---|
1462 |
|
---|
1463 |
|
---|
1464 | þh3 Examining the heap
|
---|
1465 |
|
---|
1466 | If the debuggee has been linked with the emx or GNU implementation
|
---|
1467 | of malloc(), you can examine the heap with the `þtt{info heap}'
|
---|
1468 | command. That command will list all used and free blocks of the
|
---|
1469 | heap. You'll get more detailed information if you type `þtt{info
|
---|
1470 | heap /v}'. Moreover, you can type an argument which specifies the
|
---|
1471 | address of the heap to examine. If the address points to a
|
---|
1472 | substructure of the heap, such as a block or a segment, that
|
---|
1473 | substructure will be displayed.
|
---|
1474 |
|
---|
1475 | For programs linked with -Zcrtdll, GDB does not know the address of
|
---|
1476 | the heap. Therefore, you have to use the `þtt{info heap}' command
|
---|
1477 | with the address of the heap (this works with the emx implementation
|
---|
1478 | of malloc() only):
|
---|
1479 | þenumerate
|
---|
1480 | þitem
|
---|
1481 | Before starting the program, type
|
---|
1482 | þexample
|
---|
1483 | set show-dlls
|
---|
1484 | þendexample
|
---|
1485 | to let GDB print information about DLLs.
|
---|
1486 | þitem
|
---|
1487 | Start the program with the `þtt{run}' command. GDB will show
|
---|
1488 | the names and addresses of the DLLs. You need the address of
|
---|
1489 | the þtt{.data} object of emxlibcs.dll or emxlibcm.dll:
|
---|
1490 | þexample
|
---|
1491 | [Load DLL: C:\EMX\DLL\EMXLIBCM.DLL]
|
---|
1492 | [.text: 0x0e400000 - 0x0e419c10]
|
---|
1493 | [.data: 0x0e420000 - 0x0e425f90]
|
---|
1494 | [.bss: 0x0e425f90 - 0x0e428190]
|
---|
1495 | þendexample
|
---|
1496 | In this example, the address of the þtt{.data} object is 0xe420000.
|
---|
1497 | þitem
|
---|
1498 | Search the file þtt{\emx\etc\emxlibcs.map} (or
|
---|
1499 | þtt{\emx\etc\emxlibcm.map}, depending on which DLL is used) for
|
---|
1500 | the symbol þtt{_um_regular_heap}:
|
---|
1501 | þexample
|
---|
1502 | 0002:00007CB4 _um_regular_heap
|
---|
1503 | þendexample
|
---|
1504 | In this example, the offset we're looking for is 0x7cb4.
|
---|
1505 | þitem
|
---|
1506 | Compute the address of the þtt{_um_regular_heap} variable by
|
---|
1507 | adding the address of the þtt{.data} object and the offset
|
---|
1508 | of the variable. In the example, the address is 0xe427cb4.
|
---|
1509 | þitem
|
---|
1510 | Display the value of the variable:
|
---|
1511 | þexample
|
---|
1512 | x/w 0xe427cb4
|
---|
1513 | þendexample
|
---|
1514 | GDB responds with
|
---|
1515 | þexample
|
---|
1516 | 0xe427cb4 <end+239105292>: 0x02970000
|
---|
1517 | þendexample
|
---|
1518 | In this example, the address of the heap is 0x2970000.
|
---|
1519 | þitem
|
---|
1520 | Use the `þtt{info heap}' command with the address of the heap:
|
---|
1521 | þexample
|
---|
1522 | info heap 0x2970000
|
---|
1523 | þendexample
|
---|
1524 | All numbers in this recipe are samples.
|
---|
1525 | þendenumerate
|
---|
1526 |
|
---|
1527 | If the debuggee has the _heapchk() function linked in, you can call
|
---|
1528 | it from GDB to check the heap:
|
---|
1529 |
|
---|
1530 | þexample
|
---|
1531 | call _heapchk()
|
---|
1532 | þendexample
|
---|
1533 |
|
---|
1534 | That function returns 0 if the heap is OK, 1 if the heap is empty
|
---|
1535 | (uninitialized). Other return values indicate heap corruption. To
|
---|
1536 | check the heap each time the program stops, use
|
---|
1537 |
|
---|
1538 | þexample
|
---|
1539 | display _heapchk()
|
---|
1540 | þendexample
|
---|
1541 |
|
---|
1542 | _heapchk() works with the emx implementation of malloc() only.
|
---|
1543 | Other malloc packages may support a similar function.
|
---|
1544 |
|
---|
1545 | þh3 Initialization file
|
---|
1546 |
|
---|
1547 | The .gdbinit file has been renamed þtt{!gdbinit}. To save typing,
|
---|
1548 | you might want to create a file named þtt{!gdbinit} in the directory
|
---|
1549 | where you're debugging. Here's an example of a þtt{!gdbinit} file:
|
---|
1550 |
|
---|
1551 | þexample
|
---|
1552 | file myprog.exe
|
---|
1553 | set arg -o test.out test.inp
|
---|
1554 | b main
|
---|
1555 | set close on
|
---|
1556 | run
|
---|
1557 | set switch off
|
---|
1558 | þendexample
|
---|
1559 |
|
---|
1560 | þh3 DUEL
|
---|
1561 |
|
---|
1562 | Michael Golan's DUEL debugging language has been added to GDB.
|
---|
1563 | You'll find detailed instructions in þtt{\emx\doc\duel.man}. Note
|
---|
1564 | that GDB has not been modified to require `þtt{##}' for comments,
|
---|
1565 | therefore you have to use alternate names for two DUEL operators:
|
---|
1566 | Use `þtt{%/}' instead of `þtt{#/}', and `þtt{%%}' instead of
|
---|
1567 | `þtt{#}'.
|
---|
1568 |
|
---|
1569 |
|
---|
1570 | þh3 GDBRX -- use REXX in GDB
|
---|
1571 | þlabel GDBRX
|
---|
1572 |
|
---|
1573 | The `þtt{rexx}' command of GDB invokes the OS/2 REXX interpreter.
|
---|
1574 | The argument of the `þtt{rexx}' command is interpreted as a REXX
|
---|
1575 | program. `þtt{rx}' is an alias for the `þtt{rexx}' command.
|
---|
1576 | Important: use single quotes instead of double quotes in REXX
|
---|
1577 | commands as GDB treats double quotes specially. Example:
|
---|
1578 |
|
---|
1579 | þexample
|
---|
1580 | (gdb) rx say 'Hello World!'
|
---|
1581 | Hello World!
|
---|
1582 | þendexample
|
---|
1583 |
|
---|
1584 | Once the REXX interpreter has been invoked, the default subcommand
|
---|
1585 | handler is GDBRX. This means that any commands REXX doesn't
|
---|
1586 | understand get passed back to GDB for processing. Any output from
|
---|
1587 | GDB gets passed back to REXX through the standard result variable
|
---|
1588 | þtt{RC}. Example:
|
---|
1589 |
|
---|
1590 | þexample
|
---|
1591 | (gdb) rx do i = 2 to 4; 'p 'i; say rc; end
|
---|
1592 | $1 = 2
|
---|
1593 | $2 = 3
|
---|
1594 | $3 = 4
|
---|
1595 | þendexample
|
---|
1596 |
|
---|
1597 | This is where the real power of the REXX command lies. It makes it
|
---|
1598 | really easy to hack together quick and dirty debugging functions.
|
---|
1599 | For instance, þtt{\emx\bin\logargs.cmd} is a REXX program that logs
|
---|
1600 | all parameters used in calls to a given function. You invoke it
|
---|
1601 | with
|
---|
1602 |
|
---|
1603 | þexample
|
---|
1604 | (gdb) rx call logargs
|
---|
1605 | þendexample
|
---|
1606 |
|
---|
1607 | þtt{logargs.cmd} assumes that you have loaded the program, and have
|
---|
1608 | breaked somewhere in it (since it starts off with a
|
---|
1609 | `þtt{continue}').
|
---|
1610 |
|
---|
1611 | When you run it you get something like this:
|
---|
1612 |
|
---|
1613 | þexample
|
---|
1614 | cd \emx\test
|
---|
1615 | gdb version.exe
|
---|
1616 | (gdb) b main
|
---|
1617 | (gdb) set sw off
|
---|
1618 | (gdb) set cl on
|
---|
1619 | (gdb) run
|
---|
1620 | (gdb) rx call logargs
|
---|
1621 | logargs 1.1
|
---|
1622 | Enter function name:
|
---|
1623 | bit
|
---|
1624 | Running...
|
---|
1625 | þendexample
|
---|
1626 |
|
---|
1627 | And you end up with a very useful þtt{logargs.txt} file:
|
---|
1628 |
|
---|
1629 | þexample
|
---|
1630 | *** logargs 1.1 --- 20:02:33 02 Jul 1993 ***
|
---|
1631 | s=0x100b7 "VCPI ", n=1
|
---|
1632 | s=0x100c1 "XMS ", n=2
|
---|
1633 | s=0x100cb "VDISK 3.3", n=4
|
---|
1634 | s=0x100d5 "DESQview ", n=8
|
---|
1635 | s=0x100df "287 ", n=16
|
---|
1636 | s=0x100e9 "387 ", n=32
|
---|
1637 | s=0x100f3 "OS/2 2.x ", n=512
|
---|
1638 | s=0x100fd "-t ", n=1024
|
---|
1639 | s=0x10107 "-ac ", n=2048
|
---|
1640 | þendexample
|
---|
1641 |
|
---|
1642 | where each line represents the parameters passed to þtt{bit()}.
|
---|
1643 |
|
---|
1644 | When analyzing þtt{RC}, note that newlines are represented by two
|
---|
1645 | characters, CR and LF.
|
---|
1646 |
|
---|
1647 |
|
---|
1648 | þh2 Hints
|
---|
1649 |
|
---|
1650 | To debug an .exe file which doesn't have a symbol table use
|
---|
1651 | the symbol table from the a.out file and type
|
---|
1652 |
|
---|
1653 | þexample
|
---|
1654 | gdb -e myprog.exe -s myprog
|
---|
1655 | þendexample
|
---|
1656 |
|
---|
1657 | You can do post-mortem debugging by using the þtt{core} file written
|
---|
1658 | by emx when a program aborts.
|
---|
1659 |
|
---|
1660 | You can use the following redirection specifications with `þtt{set
|
---|
1661 | args}':
|
---|
1662 |
|
---|
1663 | þlist
|
---|
1664 | þitem þtt{<}þpa{FILENAME}
|
---|
1665 |
|
---|
1666 | Redirect the file named þpa{FILENAME} to standard input
|
---|
1667 |
|
---|
1668 | þitem þtt{>}þpa{FILENAME}
|
---|
1669 |
|
---|
1670 | Redirect standard output to the file named þpa{FILENAME},
|
---|
1671 | overwriting
|
---|
1672 |
|
---|
1673 | þitem þtt{>>}þpa{FILENAME}
|
---|
1674 |
|
---|
1675 | Redirect standard output to the file named þpa{FILENAME},
|
---|
1676 | appending
|
---|
1677 |
|
---|
1678 | þendlist
|
---|
1679 |
|
---|
1680 | You can prepend a handle number (0 to 9) to such a redirection
|
---|
1681 | specification; for instance
|
---|
1682 |
|
---|
1683 | þtypewriter
|
---|
1684 | 2>þpa{FILENAME}
|
---|
1685 | þendtypewriter
|
---|
1686 |
|
---|
1687 | redirects standard error to þpa{FILENAME}. Use quotation marks to
|
---|
1688 | include `þtt{<}', `þtt{>}', spaces, or TABs in arguments. Use
|
---|
1689 | backslashes to escape quotation marks.
|
---|
1690 |
|
---|
1691 | Example:
|
---|
1692 |
|
---|
1693 | þexample
|
---|
1694 | set args "first arg" "second arg" <input >output 2>error
|
---|
1695 | þendexample
|
---|
1696 |
|
---|
1697 |
|
---|
1698 | þh1 GAS -- assembling
|
---|
1699 | þlabel GAS
|
---|
1700 | þindex GAS
|
---|
1701 | þindex assembler
|
---|
1702 | þkeyword GAS
|
---|
1703 |
|
---|
1704 | GAS is the GNU assembler. The executable file name of GAS is
|
---|
1705 | as.exe. The GNU assembler preprocessor, GASP, is also
|
---|
1706 | available. Usually, GAS is called by þhpt{GCC}. See the GAS and GASP
|
---|
1707 | manuals for details.
|
---|
1708 |
|
---|
1709 | This port of GAS supports two additional command line options:
|
---|
1710 |
|
---|
1711 | þdescription
|
---|
1712 |
|
---|
1713 | þitem -Zomf
|
---|
1714 |
|
---|
1715 | Call emxomf to convert the output file to OMF. This option is
|
---|
1716 | used for creating .obj files.
|
---|
1717 |
|
---|
1718 | þitem -Zstrip
|
---|
1719 |
|
---|
1720 | Pass the -s option to emxomf. This option is used with -Zomf
|
---|
1721 | to omit debugging information.
|
---|
1722 |
|
---|
1723 | þenddescription
|
---|
1724 |
|
---|
1725 |
|
---|
1726 | þh1 ld -- linking
|
---|
1727 | þlabel ld
|
---|
1728 | þindex ld
|
---|
1729 | þindex linker
|
---|
1730 | þkeyword ld
|
---|
1731 |
|
---|
1732 | ld is the GNU linker.
|
---|
1733 |
|
---|
1734 | If the output file has an .exe or .dll extension, þhpt{emxbind} will
|
---|
1735 | automatically be called to bind emxl.exe and the temporary a.out
|
---|
1736 | file into an .exe or .dll file. See þtt{/emx/gnu/binutils.old/ld.c} and
|
---|
1737 | the description of þhpt{emxomfld} for command line options. ld is
|
---|
1738 | usually called only by GCC, not from the command line.
|
---|
1739 |
|
---|
1740 | The -s option (strip symbols) is passed on to emxbind. If ld
|
---|
1741 | doesn't call emxbind, ld will strip the symbol table.
|
---|
1742 | Unfortunately, ld doesn't correctly strip the symbol table.
|
---|
1743 |
|
---|
1744 | This port of ld supports several additional command line options:
|
---|
1745 |
|
---|
1746 | þdescription
|
---|
1747 |
|
---|
1748 | þitem -R
|
---|
1749 |
|
---|
1750 | The -R option is used for creating relocatable executable files. -R
|
---|
1751 | is automatically set if the output file has a .dll extension. -R is
|
---|
1752 | also automatically set if an import definition of type þhpt{(I2)} is
|
---|
1753 | referenced. This is used to import functions from dynamic link
|
---|
1754 | libraries. If you link with import definitions of type (I1), you
|
---|
1755 | have to manually supply the -R option.
|
---|
1756 |
|
---|
1757 | þitem -Zexe
|
---|
1758 |
|
---|
1759 | If the -Zexe option is present, ld deletes the output file (whose
|
---|
1760 | name is given on the command line) and, after linking, calls emxbind
|
---|
1761 | to create an .exe file (.exe is appended to the name of the output
|
---|
1762 | file) After calling emxbind, ld creates an empty output file
|
---|
1763 | (without .exe). This feature is used for minimizing changes to
|
---|
1764 | Unix-style makefiles. See also the þhpt{-Zexe} option of þhpt{GCC}
|
---|
1765 | and þhpt{emxomfld}. The output file name must not have an extension
|
---|
1766 | if -Zexe is used.
|
---|
1767 |
|
---|
1768 | þitem -Zmap
|
---|
1769 |
|
---|
1770 | Let emxbind create a .map file. The name of the .map file will be
|
---|
1771 | derived from the output file name, the default extension is .map.
|
---|
1772 | To specify the name of the .map file, use þsy{-Zmap=<map_file>}.
|
---|
1773 |
|
---|
1774 | þitem -Zstack
|
---|
1775 |
|
---|
1776 | The -Zstack option is passed down to emxbind to set the stack size
|
---|
1777 | for OS/2 programs.
|
---|
1778 |
|
---|
1779 | þitem -Zno-demangle
|
---|
1780 |
|
---|
1781 | Don't demangle C++ symbols in error messages.
|
---|
1782 |
|
---|
1783 | þitem -Zdemangle-proto
|
---|
1784 |
|
---|
1785 | Include parameters and qualifiers in demangled C++ symbols in error
|
---|
1786 | messages.
|
---|
1787 |
|
---|
1788 | þenddescription
|
---|
1789 |
|
---|
1790 | If a file name with .def extension is given on the ld command line,
|
---|
1791 | it will be passed as module definition file (-d option) to emxbind.
|
---|
1792 | If there is no .def file on the command line and the output file is
|
---|
1793 | a .dll file, the -d option without argument is passed to emxbind;
|
---|
1794 | emxbind will use the name of the output file (with .def extension)
|
---|
1795 | for the module definition file.
|
---|
1796 |
|
---|
1797 | If a file name with .res extension is given on the ld command line,
|
---|
1798 | it will be passed as resource file (-r option) to emxbind.
|
---|
1799 |
|
---|
1800 | Note that the sequence of .o and .a files and -l options is
|
---|
1801 | essential. crt0.o or dll0.o must come first. Libraries are
|
---|
1802 | considered only once, that is, if a library references symbols
|
---|
1803 | defined in another library, the former one must be used before the
|
---|
1804 | latter one. If library lib1.a uses library lib2.a, which in turn
|
---|
1805 | uses library lib1.a, you have to use þtt{-llib1 -llib2 -llib1}.
|
---|
1806 |
|
---|
1807 |
|
---|
1808 | þh1 ranlib
|
---|
1809 | þindex ranlib
|
---|
1810 | þkeyword ranlib
|
---|
1811 |
|
---|
1812 | þbf{ranlib} is not available. Use the þtt{s} command of þbf{ar}
|
---|
1813 | instead.
|
---|
1814 |
|
---|
1815 |
|
---|
1816 | þh1 strip -- removing the symbol table
|
---|
1817 | þlabel strip
|
---|
1818 | þindex strip
|
---|
1819 | þkeyword strip
|
---|
1820 |
|
---|
1821 | þbf{strip} is used to delete symbols from an a.out file. It cannot
|
---|
1822 | be applied to bound .exe files. See þtt{/emx/gnu/binutils.old/strip.c}
|
---|
1823 | for command line options. See also the þhpt{emxbind} (-s command
|
---|
1824 | and the -s option of the -b command).
|
---|
1825 |
|
---|
1826 |
|
---|
1827 | þh1 info -- browsing info files
|
---|
1828 | þlabel info
|
---|
1829 | þindex info
|
---|
1830 | þkeyword info
|
---|
1831 |
|
---|
1832 | Before using þbf{info}, you have to install termcap. This is done by
|
---|
1833 | setting the TERM environment variable and one of the following
|
---|
1834 | environment variables: INIT, EMXETC, TERMCAP. Here's an example:
|
---|
1835 |
|
---|
1836 | þexample
|
---|
1837 | set term=mono
|
---|
1838 | set termcap=c:/emx/etc/termcap.dat
|
---|
1839 | þendexample
|
---|
1840 |
|
---|
1841 | Then, you have to set the INFOPATH environment variable. It's a
|
---|
1842 | list of directories, separated by semicolons. The þtt{/emx/info}
|
---|
1843 | directory should be included. Example:
|
---|
1844 |
|
---|
1845 | þexample
|
---|
1846 | set infopath=.;c:/emx/info
|
---|
1847 | þendexample
|
---|
1848 |
|
---|
1849 | If the INFOPATH environment variable is not set, the following list
|
---|
1850 | of directories will be used:
|
---|
1851 |
|
---|
1852 | þexample
|
---|
1853 | .;/emx/info;/emacs/info
|
---|
1854 | þendexample
|
---|
1855 |
|
---|
1856 | After setting all the environment variables, you can run info by
|
---|
1857 | typing
|
---|
1858 |
|
---|
1859 | þexample
|
---|
1860 | info
|
---|
1861 | þendexample
|
---|
1862 |
|
---|
1863 | Type þtt{?} to get a list of keys.
|
---|
1864 |
|
---|
1865 |
|
---|
1866 | þh1 makeinfo -- creating info files
|
---|
1867 | þlabel makeinfo
|
---|
1868 | þindex makeinfo
|
---|
1869 | þkeyword makeinfo
|
---|
1870 |
|
---|
1871 | makeinfo creates info files from texinfo files. Type makeinfo to
|
---|
1872 | get a list of options. There's also texinfo documentation available
|
---|
1873 | for makeinfo.
|
---|
1874 |
|
---|
1875 | When splitting files, makeinfo uses the extensions þtt{i01},
|
---|
1876 | þtt{i02}, ..., þtt{i99}.
|
---|
1877 |
|
---|
1878 |
|
---|
1879 | þh1 texindex -- creating the index for a printed manual
|
---|
1880 | þlabel texindex
|
---|
1881 | þindex texindex
|
---|
1882 | þkeyword texindex
|
---|
1883 |
|
---|
1884 | texindex sorts the index for typesetting a texinfo file with
|
---|
1885 | þbf{TeX}. To compile a texinfo file under OS/2, simply move to the
|
---|
1886 | directory where the source file resides and enter
|
---|
1887 |
|
---|
1888 | þtypewriter
|
---|
1889 | texi2dvi þpa{FILENAME}
|
---|
1890 | þendtypewriter
|
---|
1891 |
|
---|
1892 | where þpa{FILENAME} is the name of the source file. Example:
|
---|
1893 |
|
---|
1894 | þexample
|
---|
1895 | cd \emx\gnu\texinfo
|
---|
1896 | texi2dvi texi.tex
|
---|
1897 | þendexample
|
---|
1898 |
|
---|
1899 | þbf{texi2dvi} is a REXX procedure which calls þbf{TeX} and texindex.
|
---|
1900 | See the first two statements of þtt{/emx/bin/texi2dvi.cmd} for
|
---|
1901 | customization.
|
---|
1902 |
|
---|
1903 |
|
---|
1904 | þh1 termcap -- terminal capabilities
|
---|
1905 | þlabel termcap
|
---|
1906 | þindex termcap
|
---|
1907 | þkeyword termcap
|
---|
1908 |
|
---|
1909 | For using termcap, you have to put termcap.dat in the current
|
---|
1910 | working directory, into directory /emx/etc on the current drive, or
|
---|
1911 | into a directory listed in the INIT or EMXETC environment
|
---|
1912 | variables. You can also set the TERMCAP environment variable to
|
---|
1913 | contain the absolute path name of termcap.dat. If the TERM
|
---|
1914 | environment variable isn't set, ansi will be used (þtt{ansi.sys}
|
---|
1915 | required). Otherwise, the terminal given in the TERM environment
|
---|
1916 | variable will be used. I recommend using þtt{mono}. See
|
---|
1917 | termcap.dat for details.
|
---|
1918 |
|
---|
1919 | To link a program with the GNU termcap library, specify -ltermcap on
|
---|
1920 | the GCC command line. Read the license in þtt{/emx/doc/COPYING}!
|
---|
1921 |
|
---|
1922 | Alternatively, the BSD termcap library is available. See
|
---|
1923 | þtt{emxbsd.doc} and þtt{emxbsd.inf} for details.
|
---|
1924 |
|
---|
1925 | þh1 readline
|
---|
1926 | þlabel readline
|
---|
1927 | þindex readline
|
---|
1928 | þkeyword readline
|
---|
1929 |
|
---|
1930 | The standard þbf{Emacs}/þbf{readline} key bindings are used with the
|
---|
1931 | following exceptions and additions:
|
---|
1932 |
|
---|
1933 | þexample
|
---|
1934 | BS, C-H rubout
|
---|
1935 | HOME beg_of_line
|
---|
1936 | END end_of_line
|
---|
1937 | UP get_previous_history
|
---|
1938 | DOWN get_next_history
|
---|
1939 | LEFT backward
|
---|
1940 | RIGHT forward
|
---|
1941 | PAGEUP beginning_of_history
|
---|
1942 | PAGEDOWN end_of_history
|
---|
1943 | DELETE delete
|
---|
1944 | C-LEFT backward_word
|
---|
1945 | C-RIGHT forward_word
|
---|
1946 | C-HOME backward_kill_line
|
---|
1947 | C-END kill_line
|
---|
1948 | þendexample
|
---|
1949 |
|
---|
1950 | The readline library source comes with the GDB source files.
|
---|
1951 |
|
---|
1952 |
|
---|
1953 | þh1 GPPDEMID -- an identifier manipulation DLL for G++
|
---|
1954 | þlabel GPPDEMID
|
---|
1955 | þi1 GPPDEMID
|
---|
1956 | þkeyword GPPDEMID
|
---|
1957 |
|
---|
1958 | GPPDEMID (þtt{/emx/dll/gppdemid.dll}) is a dynamic link library
|
---|
1959 | which demangles symbols mangled by the G++ compiler. This DLL is
|
---|
1960 | used by LINK386 to demangle symbols to make error messages more
|
---|
1961 | readable when linking C++ programs. LINK386 is told about the name
|
---|
1962 | of the DLL by a special record inserted into the .obj files by
|
---|
1963 | þhpt{emxomf}.
|
---|
1964 |
|
---|
1965 | GPPDEMID is subject to the GNU Library General Public License, see
|
---|
1966 | þtt{/emx/doc/COPYING.LIB} for details. The source code for GPPDEMID
|
---|
1967 | can be found in the þtt{gnusrc.zip} archive.
|
---|
1968 |
|
---|
1969 |
|
---|
1970 | þh1 Known problems
|
---|
1971 | þlabel Known problems
|
---|
1972 |
|
---|
1973 | þitemize
|
---|
1974 |
|
---|
1975 | þitem
|
---|
1976 |
|
---|
1977 | gcc.exe cannot pass more than 24 (temporary) files derived by
|
---|
1978 | the GCC command from source files to the linker
|
---|
1979 |
|
---|
1980 | þitem
|
---|
1981 |
|
---|
1982 | If GDB fails under OS/2 with an error message like
|
---|
1983 |
|
---|
1984 | þexample
|
---|
1985 | DosDebug error: 00000135
|
---|
1986 | þendexample
|
---|
1987 |
|
---|
1988 | stop any screen savers you are running. If that does not help, use
|
---|
1989 | the -E emx option:
|
---|
1990 |
|
---|
1991 | þexample
|
---|
1992 | set emxopt=-E
|
---|
1993 | þendexample
|
---|
1994 |
|
---|
1995 | and run GDB from a full-screen command prompt.
|
---|
1996 |
|
---|
1997 | þenditemize
|
---|
1998 |
|
---|
1999 | þtext
|
---|
2000 |
|
---|
2001 | --------------------------- END OF EMXGNU.DOC ------------------------------
|
---|
2002 | þendtext
|
---|