How to debug those functions in a .h file
Ramana Radhakrishnan
ramana.radhakrishnan@codito.com
Wed Nov 24 09:31:00 GMT 2004
Hi,
> Hi all
> I meet a problem when using gdb. Suppose I have the following dir
> structure:
> /project/include/myfun.h
> /project/src/demo.c
>
> Under /project/src, after compile and link those 2 files, I get demo.o
> file. Then, I run
> gdb demo.o
> and go into the interface of gdb. I can break such functions in demo.c
> file but failed to break those in myfun.h unless I copy myfun.h under dir
> /project/src.
> It seems that gdb will only search the .h file in the current dir but not
> other dir. Then how can I debug the functions in /project/include/myfun.h
> without copying the file to current dir?
You could use the dir command .
The manual says and I quote .
`dir DIRNAME ...'
Add directory DIRNAME to the front of the source path. Several
directory names may be given to this command, separated by `:'
(`;' on MS-DOS and MS-Windows, where `:' usually appears as part
of absolute file names) or whitespace. You may specify a
directory that is already in the source path; this moves it
forward, so GDB searches it sooner.
You can use the string `$cdir' to refer to the compilation
directory (if one is recorded), and `$cwd' to refer to the current
working directory. `$cwd' is not the same as `.'--the former
tracks the current working directory as it changes during your GDB
session, while the latter is immediately expanded to the current
directory at the time you add an entry to the source path.
So set the directories for the source path and things should work .
cheers
Ramana
>
> Thanx.
>
> Aaron
>
> Intel China Software Lab
>
> Tel: 8621-52574545 Ext.1587
>
> E_mail:yukun.chen@intel.com
>
>
----
Ramana Radhakrishnan
Codito Technologies
More information about the Gdb
mailing list