Menu

stm8-gdb, TUI mode is not supported

2017-08-19
2017-08-19
  • Jaromir Sukuba

    Jaromir Sukuba - 2017-08-19

    I built recent "stm8-binutils-gdb-sources-2017-05-25.tar.gz" as per https://stm8-binutils-gdb.sourceforge.io/
    Everything works flawlessly in classic GDB mode, but I can't start GDB in TUI mode. As soon as I enter
    stm8-gdb blinky.elf --tui
    I receive response
    stm8-gdb: TUI mode is not supported
    To me it looks like the TUI mode isn't enabled during compilation. I tried to check this in compilation config files, but honestly I'm a bit lost in it, so I better didn't touch it.

    How can I chceck whether TUI is enabled in config, or why it isn't supported in resulting GDB binary, please?

     
    • akre

      akre - 2017-08-19

      Gdb is configured depending on the different libraries available. For TUI to work you would need curses or ncurses. Check your config.log for searched libraries. The documentation does not mention all the required libraries but here is a starting point:

      https://sourceware.org/gdb/onlinedocs/gdb/Requirements.html#Requirements

       
      • Jaromir Sukuba

        Jaromir Sukuba - 2017-08-20

        I checked that I have or installed expat, zlib and iconv, as per GDB requirements, as well as ncurses

        # apt list --installed | grep curses
        
        WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
        
        lib32ncurses5/xenial,now 6.0+20160213-1ubuntu1 amd64 [installed]
        libncurses5/xenial,now 6.0+20160213-1ubuntu1 amd64 [installed]
        libncurses5-dev/xenial,now 6.0+20160213-1ubuntu1 amd64 [installed]
        libncursesw5/xenial,now 6.0+20160213-1ubuntu1 i386 [installed]
        ncurses-base/xenial,xenial,now 6.0+20160213-1ubuntu1 all [installed]
        ncurses-bin/xenial,now 6.0+20160213-1ubuntu1 amd64 [installed]
        ncurses-term/xenial,xenial,now 6.0+20160213-1ubuntu1 all [installed]
        

        and there is header file

        # dpkg -S curses.h
        autoconf-archive: /usr/share/doc/autoconf-archive/html/ax_005fwith_005fcurses.html
        libncurses5-dev:amd64: /usr/include/ncurses.h
        libpython2.7-dev:amd64: /usr/include/python2.7/py_curses.h
        libncurses5-dev:amd64: /usr/include/curses.h
        

        but when I rerun ./configure_binutils.sh, then make and make install, I can't start TUI mode either.
        I checked config.log in gdb directory and found this

        configure:7918: checking for library containing waddstr
        configure:7966: result: no
        configure:7993: WARNING: no enhanced curses library found; disabling TUI
        

        and this

        configure:10769: checking for curses.h
        configure:10769: result: no
        configure:10769: checking for cursesX.h
        configure:10769: result: no
        configure:10769: checking for ncurses.h
        configure:10769: result: no
        configure:10769: checking for ncurses/ncurses.h
        configure:10769: result: no
        configure:10769: checking for ncurses/term.h
        configure:10769: result: no
        configure:10782: checking for term.h
        configure:10782: result: no
        

        looks like here lies my problem, but ncurses library is apparently installed and other GDB debuggers (like arm-none-eabi) happily use it in TUI mode.
        My google-fu is failing here.

         

        Last edit: Jaromir Sukuba 2017-08-20
        • akre

          akre - 2017-08-20

          If you look in the config.log you also find the failing test snippet with compilation/linker errors causing the test to fail. It might give you some clues.

           
          • Jaromir Sukuba

            Jaromir Sukuba - 2017-08-20

            Ake, thank you for your support.

            The part of searching for ncurses.h, for example goes probably like this

            for ac_header in curses.h cursesX.h ncurses.h ncurses/ncurses.h ncurses/term.h
            do :
              as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
            ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
            eval as_val=\$$as_ac_Header
               if test "x$as_val" = x""yes; then :
              cat >>confdefs.h <<_ACEOF
            #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
            _ACEOF
            
            fi
            
            done
            

            My limited scripting knowledge (favorite programming language of mine is solder) tells me it's testing for existence of given header files in "ac_header", but I'm lost at the part where "ac_header" is actually defined or where it came from.
            The same goes for checking of the library curses et al in "ac_lib":

            for ac_lib in '' ncurses cursesX curses; do
              if test -z "$ac_lib"; then
                ac_res="none required"
              else
                ac_res=-l$ac_lib
                LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
              fi
              if ac_fn_c_try_link "$LINENO"; then :
              ac_cv_search_waddstr=$ac_res
            fi
            

            Again, I'm somehow lost in configure file(s) structure. I believe the paths to search for the files are not correct, so configure script can't find it where it's searching for, despite it's being present somewhere else on my system - but I can't figure out how to change it.

             
            • akre

              akre - 2017-08-20

              I guess this comes from configure? It does not make much sense since it is generated from autoconf tools. You should be looking in config.log.

              It looks like this:

              configure:7918: checking for library containing waddstr
              configure:7949: gcc -o conftest.exe -g -O2  -static-libstdc++ -static-libgcc -Wl,--stack,12582912 conftest.c -lm  >&5
              /tmp/ccZsY0de.o: In function `main':
              /cygdrive/c/akre/stm8/project/binutils-gdb/gdb/conftest.c:54: undefined reference to `waddstr'
              /cygdrive/c/akre/stm8/project/binutils-gdb/gdb/conftest.c:54:(.text.startup+0xa): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `waddstr'
              collect2: error: ld returned 1 exit status
              configure:7949: $? = 1
              configure: failed program was:
              | /* confdefs.h */
              | #define PACKAGE_NAME ""
              | #define PACKAGE_TARNAME ""
              | #define PACKAGE_VERSION ""
              .
              .
              .
              .
              
               
              • akre

                akre - 2017-08-20

                Better example:

                configure:10521: checking for libipt
                configure:10540: gcc -o conftest.exe -g -O2  -static-libstdc++ -static-libgcc -Wl,--stack,12582912 conftest.c -lncurses -lm  -lipt >&5
                conftest.c:54:22: fatal error: intel-pt.h: No such file or directory
                compilation terminated.
                configure:10540: $? = 1
                configure: failed program was:
                | /* confdefs.h */
                | #define PACKAGE_NAME ""
                | #define PACKAGE_TARNAME ""
                | #define PACKAGE_VERSION ""
                | #define PACKAGE_STRING ""
                | #define PACKAGE_BUGREPORT ""
                | #define PACKAGE_URL ""
                | #define STDC_HEADERS 1
                | #define HAVE_SYS_TYPES_H 1
                | #define HAVE_SYS_STAT_H 1
                | #define HAVE_STDLIB_H 1
                | #define HAVE_STRING_H 1
                | #define HAVE_MEMORY_H 1
                | #define HAVE_STRINGS_H 1
                | #define HAVE_INTTYPES_H 1
                | #define HAVE_STDINT_H 1
                | #define HAVE_UNISTD_H 1
                | #define __EXTENSIONS__ 1
                | #define _ALL_SOURCE 1
                | #define _GNU_SOURCE 1
                | #define _POSIX_PTHREAD_SEMANTICS 1
                | #define _TANDEM_SOURCE 1
                | #define HAVE_DLFCN_H 1
                | #define HAVE_WINDOWS_H 1
                | #define ENABLE_NLS 1
                | #define PACKAGE "gdb"
                | #define DEBUGDIR "/usr/local/lib/debug"
                | #define DEBUGDIR_RELOCATABLE 1
                | #define BINDIR "/usr/local/bin"
                | #define GDB_DATADIR "/usr/local/share/gdb"
                | #define GDB_DATADIR_RELOCATABLE 1
                | #define AUTO_LOAD_DIR "$debugdir:$datadir/auto-load"
                | #define AUTO_LOAD_SAFE_PATH "$debugdir:$datadir/auto-load"
                | #define DEFAULT_BFD_ARCH bfd_stm8_arch
                | #define DEFAULT_BFD_VEC stm8_elf32_vec
                | #define HAVE_ETEXT 1
                | #define PKGVERSION "(GDB) "
                | #define REPORT_BUGS_TO "<http://www.gnu.org/software/gdb/bugs/>"
                | #define HAVE_LIBM 1
                | #define HAVE_ICONV 1
                | #define ICONV_CONST 
                | #define SIZEOF_UNSIGNED_LONG_LONG 8
                | #define SIZEOF_UNSIGNED_LONG 8
                | #define SIZEOF_UNSIGNED___INT128 16
                | #define JIT_READER_DIR "/usr/local/lib/gdb"
                | #define JIT_READER_DIR_RELOCATABLE 1
                | #define HAVE_LIBEXPAT 1
                | #define HAVE_XML_STOPPARSER 1
                | #define HAVE_LIBPYTHON2_7 1
                | #define WITH_PYTHON_PATH "/usr"
                | #define PYTHON_PATH_RELOCATABLE 0
                | #define HAVE_PYTHON 1
                | /* end confdefs.h.  */
                | #include "intel-pt.h"
                | int
                | main ()
                | {
                | pt_insn_alloc_decoder (0);
                |   ;
                |   return 0;
                | }
                configure:10550: result: no
                configure:10577: WARNING: libipt is missing or unusable; some features may be unavailable.
                
                 
                • akre

                  akre - 2017-08-20

                  Have you seen this?
                  https://sourceware.org/bugzilla/show_bug.cgi?id=11267

                  readline, termcap libs missing?

                   

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.