Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 86057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:11:11+00:00 2026-05-10T22:11:11+00:00

I have an application that is sensitive to the directory it gets invoked from

  • 0

I have an application that is sensitive to the directory it gets invoked from — it loads some files using relative paths.

When I start the program through a debugger, how can I control what the initial current directory will be?

I’d prefer to avoid adding special code to the debugged program to make it call chdir; my instinct is that the debugger should provide some way to specify that externally, since it’s inherently an external setting anyway.

The debugger I’m using is TotalView, but I’m open to answers for other Linux debuggers since it could help me find a comparable setting in TV. I can specify environment variables when I invoke the program, so on a lark, I tried setting PWD, but no luck.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:11:12+00:00Added an answer on May 10, 2026 at 10:11 pm

    With GDB, the initial working directory is the directory you instantiate GDB from. So, just run GDB from whatever you want the working directory to be. Alternatively, while the program is running, you can change the current working directory just by doing:

    (gdb) print chdir('new/working/directory') 

    GDB also had a built-in command for changing the process’ working directory from the GDB prompt:

    (gdb) cd new/working/directory 

    I’ve never used TotalView, but it should have a similar functionality for executing code (with side effects) from within the debugger.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application that needs to retrieve some data from my database.
I have a winforms application that presently ships with a chm file for context-sensitive
I have an application that I want to host on Heroku. It has sensitive
We have a .NET 2.0 application that uses the RijindaelManaged class to encrypt some
I have an application that will contain information that is sensitive to a user.
Is it possible to implement Single Page Web Application that would have sensitive data,
I am developing an application that involves some sensitive user information. I retrieve this
I have a stored procedure that retrieves sensitive information from an SQL Server 2008
We have a publisher application that sends out data using multicast. The application is
I have a blog application that models a database using Entity Framework. The problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.