Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Make options for debugging
Forum Updated to NodeBB v4.3 + New Features

Make options for debugging

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 4 Posters 8.2k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    ad5xj
    wrote on 27 Nov 2010, 18:52 last edited by
    #1

    Is there any way to pass options to either g++ or make to produce a cross reference listing of variables used and the address location of elements within the program like classes, line numbers and functions within the application similar to the "map" option of COBOL?

    This may be a stupid question but I have not seen anything referenced.

    It would be very convenient when debugging and valgrind or gdb gives an address rather than a symbol to reference the location of the error or to locate where a variable has been used (or not used).

    Ken AD5XJ

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on 28 Nov 2010, 08:15 last edited by
      #2

      I am not aware of a tool to generate a mapping of memory locations to source code (be it variable names or line numbers).

      Is the debug information included with your application not enough for you (provided you did a debug build)? GDB, valgrind and other tools will use that information to produce the information you want on demand (e.g. when reporting errors).

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GordonSchumacher
        wrote on 8 Dec 2010, 15:42 last edited by
        #3

        Sorry for the late reply...
        Yes, you can do that with the linker - pass "-Wl,-Map=myfile.map":http://sourceware.org/binutils/docs/ld/Options.html#index-g_t_002dMap_003d_0040var_007bmapfile_007d-183 to GCC.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ad5xj
          wrote on 8 Dec 2010, 19:19 last edited by
          #4

          so where does the -Wl,-Map-myfile.map go in QtCreator? Under the Make chain?

          Ken AD5XJ

          1 Reply Last reply
          0
          • G Offline
            G Offline
            GordonSchumacher
            wrote on 8 Dec 2010, 20:54 last edited by
            #5

            You will want to set it in QMAKE_LFLAGS (or if you want it only on debug builds, then in QMAKE_LFLAGS_DEBUG). You could put it in the qmake arguments as "QMAKE_LFLAGS+=-Wl,-Map=mapfile" (please note the equals sign, instead of a dash!), but then it will only apply when you build from Creator. A better way would be to put it directly into the .pro file.

            1 Reply Last reply
            2
            • S Offline
              S Offline
              Sprezzatura
              wrote on 9 Jul 2021, 14:16 last edited by Sprezzatura 7 Sept 2021, 14:17
              #6

              If you're using MS Visual Studio, it's QMAKE_LFLAGS += /MAP:myProject.map in the .PRO file

              1 Reply Last reply
              0

              • Login

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