How to change current working directory for dbx on UNIX?

How to change current working directory for dbx on UNIX?
means I'll run pgm from one directory , but getcwd() should return path which I want to be, which is not d current dir

:slight_smile:

U can try cd .. thats shud work
else try using USE

In VC++ we can set the path in project =>swttings=>working directory.

What if we want 2 do same in UNIX.
i.e.
our source files are at diff location.
We have to copy executable to required diff location and run it.

if u r trying to execute the file, u can use makefiles where u can define the paths of different files and corresponding executables to be formed.

Thanks a lot Swarna :slight_smile:

Adding to Swarna's comment,

I guess your application is built in some location and your are trying to run the
same binary in dbx in a different directory.

As the actual binary is built in some other location,the references to your source
files will be that of the build location.

Assume i have a build machine,with source,include,make,bin directory,

/user/builds/src
/user/builds/inlcude
/user/builds/make
/user/builds/bin

The binary so built will have references the /user/builds/src & /user/builds/inlcude directories.

In case u want to debug the actual binary in some other location say by copying it to /home/test/bin

As the actual binary still has references to the /user/builds/src and /user/builds/include

You require the pathmapping,

In the dbx initialization file ie ~/.dbxrc

Add the below lines,

pathmap /user/builds/src /path/to/yourlocal/src

For more on pathmap,
help pathmap

Using "use" in dbx is deprecated.You may have to use pathmap instead.

Hope this helps,

Thanks
Nagarajan Ganesan.