Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. HOWTO set the HOME environment variable when debugging on target

HOWTO set the HOME environment variable when debugging on target

Scheduled Pinned Locked Moved Unsolved QtonPi
1 Posts 1 Posters 806 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vikramg
    wrote on 12 Feb 2021, 23:35 last edited by
    #1

    I am launching an application for debug on an RPi target from a Linux x86-64 host, via QtCreator. Strangely, the HOME env variable does not get set when debugging. As a result, reads from QSettings etc fail because the application is trying to read from an incorrect location. (When running normally without debugging, the environment gets set correctly).

    From here: https://doc.qt.io/qtcreator/creator-debugger-engines.html it should be possible to add "GDB commands after GDB has been started, but before the debugged program is started or attached" in the "Additional startup commands" field in Project settings. I tried adding the following:

    set environment HOME = /home/pi
    set environment FOO = /home/pi
    

    and printing out the vars from my application, and FOO gets printed out correctly, but HOME is still empty. I can force HOME to get set via qputenv and that works. But I'd like to avoid doing that if possible. So my questions are:

    1. Why does the gdb environment setting not work for the HOME variable?
    2. Is there an environment variable that gets set only when debugging so I can at least qualify the qputenv with that? (i.e. perform the qputenv of HOME only when the app is being debugged).
    1 Reply Last reply
    0

    1/1

    12 Feb 2021, 23:35

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved