[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More on Command Line and Run Arugments

From: Peter Wainwright
Subject: Re: More on Command Line and Run Arugments
Date: Mon, 23 Jun 2008 18:54:40 +0100

On Mon, 2008-06-23 at 08:58 -0700, Wells, John - FS wrote:
> The biggest problem I have with ddd is getting it to import my
> environment so that when I run a program ddd knows the locations of
> objects and source.  I know about the preferences settings and
> setting the working directory.  My program open a series of files that
> are located in different places on my system.  For obvious reasons I
> do not hard code the paths.   I build the paths to these various files
> in the program before attempting an open.  When I run my program from
> the command line, that is outside of ddd, it runs fine.  It opens all
> it's files and goes merrily on it's way.  If I run within ddd it does
> not find it's files even though the path names are built exactly
> the same way and are correct.  
> To make my program run in ddd I have to put all my files into my home
> directory.  This seems to be a default for ddd even though I have
> changed the working directory and directed ddd(gdb) where the source
> files and objects are located.  I have read till my eyes bled the
> documentation trying to solve the problem and I have sent emails
> before requested help solving this problem.  I received zero response
> from anyone and I could not find anything in the documentation.  This
> is the main reason I quit using ddd.  Does anyone have any idea why I
> am getting this behavior?  If my explanation is not clear and you
> think you might know the answser, ask me a question. 

You seem to have two separate issues here - forgive me if I have
misunderstood you, but your program opens some files itself with
fopen(), is that so?
If so, this is quite unconnected to the settings of source file
path/object file path which you give to DDD/GDB.

I find it is rarely necessary to set the source/object file paths, since
programs built with "-g" usually hard code the entire path of the source
file into the executable or library.  This is read by DDD by executing
the GDB "info sources" command.  [There is occasionally an issue if
there are 2 source files with the same name in different directories.
Also, if the source tree has been moved since the executable was
compiled, you might need to set the source path to the new location.]

Now to your own programs fopen() calls: How are you constructing your
paths? Are they relative to the current working directory? If so, you
need to make really, really sure you are starting in the right
directory, i.e. the same directory you run the program from when it
works properly. You mentioned the working directory in the same sentence
as the preferences - you do realize that "Change Directory" is not a
preference setting, I hope - all it does is execute "cd" in the current
session. You need to set it every time you run the program (or just "cd"
to the appropriate directory before starting DDD). You should check by
executing "pwd" in the gdb console.

Another thought - are the paths constructed by hacking around with
argv[0]? As far as I know DDD sets that correctly, but its worth
thinking about.

I've run out of ideas,


> John
> All will be well.  And all shall be well.  All manner of thing shall
> be well. -- Lady Julian of Norwich
> _______________________________________________
> Ddd mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/ddd

reply via email to

[Prev in Thread] Current Thread [Next in Thread]