DDD (gdb): No source: ../sysdeps/x86_64/elf/start.S: No such file bug; Missing XKeysymDB file bug

May 7, 2009 by V-Teq · Leave a Comment
Filed under: Debian 

I came across a strange bug, or better said, strange behavior of ddd today. I have tried to debug my program and I have got this error dialogue:

DDD: No source
/home/v-teq/…/sysdeps/x86_64/elf/start.S: No such file or directory

Missing XKeysymDB file

I have tried to find out where was the problem:

v-teq@v-teq-laptop:~$ ddd --check-configuration
Checking for XKeysymDB... (none)
Warning: The `XKeysymDB' file is not in the default X file search path.
    If ddd was not compiled on this machine, ddd
    may not run properly (lots of warnings for unknown keysym names).
    and install it into your X project root (typically `/usr/lib/X11')
    or have the XKEYSYMDB environment variable point at it.

But as you can see, I found another error message that was ddd printing out – it couldn’t find XKeysymDB file. The solution was quite easy – only to find the XKeysymDB file in my /usr directory, because default /usr/lib/X11 path doesn’t exist anymore on my Debian based machine.

v-teq@v-teq-laptop:~$ find /usr -name XKeysymDB
/usr/share/X11/XKeysymDB

So the answer was /usr/share/X11/XKeysymDB in my case.

Now it’s easy to set environment variable and get ddd working again:

v-teq@v-teq-laptop:~$ XKEYSYMDB=/usr/share/X11/XKeysymDB ddd --check-configuration
Checking for XKeysymDB... /usr/share/X11/XKeysymDB

You can set variable pernamently of course (or you can echo this line into your ~/.bashrc or such file).
For sh, ksh or bash:

export XKEYSYMDB="/usr/share/X11/XKeysymDB"

For csh:

setenv XKEYSYMDB "/usr/share/X11/XKeysymDB"

DDD: No source: ../sysdeps/x86_64/elf/start.S

Now back to the first problem – error dialogue that said I didn’t compiled debugging information to my executables, so debuggers (ddd, gdb) weren’t able to use symbols from source files.

Take care if you have compiled your binary files (executables or libraries) really with debugging information (eg. -g option in gcc). My problem was, that my Makefile created executables from libraries with -g option, but libraries themselves were compiled without this option automatically (there was no rule to make *.o files in Makefile).

So my advice is to double check your Makefile, or command line if you’re compiling project manually, if you have really set the -g option. For example:

gcc -g -o main main.c

Or if you want to create *.o file before linking to final executable, don’t forget to check -g option in both cases:

gcc -g -c -o main.o main.c
gcc -g -o main main.o

You can also add something like that to your Makefile to compile *.o files with -g debugging option automatically:

CC=gcc
CFLAGS=-g
 
%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

Transfer files using Secure Copy (scp)

October 29, 2008 by V-Teq · 2 Comments
Filed under: Linux Notes 

Transfer file/directory from remote host to localhost:

$ scp [<USER>@]<HOST>:<REMOTE_PATH> <LOCAL_PATH>

Usage example:

$ scp v-teq@v-teq.com:~/.vimrc ~/.vimrc # copy .vimrc file from remote host to the local one
$ scp user@example.com:/etc/resolv.conf /tmp/dns.txt

Transfer file from localhost to remote host:

$ scp <file/directory> user@example.com:~/remote/directory

Transfer file/directory from localhost to remote host:

$ scp file.txt user@example.com:~/remote/directory

Screen

October 19, 2008 by V-Teq · 2 Comments
Filed under: Linux Notes 

screen – screen manager with VT100/ANSI terminal emulation

Create new screen window

  $ screen # open screen manager with new window
  ^A c # create new window

Kill screen window

  ^A k // kill current window
  ^A :quit // kill all the session (also ^A ^\)

Detach screen session

  $ screen -d
  ^A d

Re-attach the screen session

  $ screen -list # shows current sessions
  $ screen -r # when only one avaible session is running
  $ screen -r  #  from list of current sessions
  $ screen -r / # multiuser session
  $ screen -d -r  # detach session first

Allow multiuser mode

  $ chmod u+s /usr/bin/screen # first time only
  $ chmod 755 /var/run/screen # first time only
  ^A: multiuser on
  ^A: acladd  StHAdPdbENeKq // the 2nd argument is crypted password (created by mkpasswd)

Managing screen windows

  ^A A // rename current window
  ^A " // list of windows
  ^A S // split current window horizontally
  ^A [0-9] // quick access window #No.[0-9]