Compile and debug Vim source code


 
Thread Tools Search this Thread
Top Forums Programming Compile and debug Vim source code
# 1  
Old 03-23-2011
Compile and debug Vim source code

Hi,

I want to debug Vim source code with GDB but I can't get it. It seems to run without debugger.

Here is my try. I have supressed output of most commands. Tell me if you need them.

Code:
$ uname -mor
2.6.37-ARCH i686 GNU/Linux
$ mkdir ~/birei && cd ~/birei
$ wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
$ tar jxvf vim-7.3.tar.bz2 && cd vim73/src
$ cp Makefile Makefile.orig
$ # Change Makefile to request debugging info and install it in my home dir.
$ vim Makefile
$ diff Makefile Makefile.orig
540c540
< CFLAGS = -g
---
> #CFLAGS = -g
908c908
< prefix = ~/birei
---
> #prefix = $(HOME)
$ make
$ make test
...
Test results:
ALL DONE
...
$ make install
$ cd ~/birei/bin/
$ gdb ./vim
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from ~/birei/bin/vim...(no debugging symbols found)...done.
(gdb) s
The program is not being run.
(gdb) b main
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (main) pending.
(gdb) run
...

At this point Vim runs but without stopping in any point of the source code. How can I stop it in first line of code??

Regards,
Birei
# 2  
Old 03-23-2011
It doesn't know where the source code is so most of the debugging information's missing. Try gdb -d /path/to/source

Also make sure your makefile didn't strip the debugging information out of it at any point.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 03-24-2011
Thanks Corona668,

I got it, there was a line in the Makefile which it stripped the binary. I commented it and now it works. Here my modifications to the original Makefile.

Code:
$ vim Makefile
$ diff Makefile Makefile.orig
540c540
< CFLAGS = -g
---
> #CFLAGS = -g
908c908
< prefix = ~/birei
---
> #prefix = $(HOME)
1852c1852
< #    $(STRIP) $(DEST_BIN)/$(VIMTARGET)
---
>     $(STRIP) $(DEST_BIN)/$(VIMTARGET)

And after 'make && make test && make install'

Code:
$ gdb ./vim
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from ~/birei/bin/vim...done.
(gdb) b main
Breakpoint 1 at 0x80c7e47: file main.c, line 168.
(gdb) run
Starting program: /home/dcgub/Public/devvim/bin/vim 

Breakpoint 1, main (argc=1, argv=0xbffff444) at main.c:168
168    {
(gdb)

Regards,
Birei
This User Gave Thanks to birei For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Source IP not in my ftpd debug logs

I have random connections coming into my FTP server, but the source IP is not showing up in my logs. Here is what my logs look for me trying to connect as a "whatever" user that doesn't exist. You can see there is no source IP telling me where this connection came from: Jun 27 10:13:40... (4 Replies)
Discussion started by: kah00na
4 Replies

2. Shell Programming and Scripting

How to compile or debug line by line in shell script?

I know about bash -x, set -x and -v but disappears from Command Line Interface in fraction of second ...... I am looking for a command or script ..complies each line and shows the output after executing each line ....( similar what we have in C ) Thanks in Advance (2 Replies)
Discussion started by: frintocf
2 Replies

3. AIX

How to compile a package in AIX when we download its source?

How to compile a package surce in AIX when we download its source? (2 Replies)
Discussion started by: johnveslin
2 Replies

4. Programming

Compile a proc/c++ file in debug mode.

Hi, I'm using the following commands to execute a proc file, but I'm unable to debug the program. What modifications do I need to make in the command options to debug the program created. I have a proc1.pc file, using the following three steps to generate the proc1 exe. After the proc1 exe... (2 Replies)
Discussion started by: ehari
2 Replies

5. Solaris

Error when compile source code

Hello,I'm trying to compile source code for Nmap. My $PATH /usr/sbin:/usr/bin:/usr/openwin/bin:/usr/ucb:/usr/local/bin:/usr/css/bin I type ./configure and all goes great.When I type ./make or ./make it says make not found.Why?I need a correct path for make?Thanks in advance. (2 Replies)
Discussion started by: bgf0
2 Replies

6. UNIX and Linux Applications

How to compile from source code?

Hi all, I downloaded the source code for a pkg. But i dont know how to build from it? I have no prior experience in building from source,so could you pls help me? I tried ./configure(after entering into the dir containing the src codes) but it generated some errors!!!!! Some files... (1 Reply)
Discussion started by: wrapster
1 Replies

7. SuSE

How do I compile source undfer Suse Linux?

I've been usuing Suse 9.1 & 10 on 2 different machines for a while and have so far relied on ready compiled versions of programs in RPMs in order to install them. I'm unclear what is envolved in compiling from the source code myself. I did a general google on the topic and found some unclear... (3 Replies)
Discussion started by: Mark Ward
3 Replies

8. Programming

How to debug C source file using GVD debugger

Anyone pls. help !!! I want to debug C source file using GVD debugger. However, I am unable to find the way to debug source files. Thanks in advance (2 Replies)
Discussion started by: argupta
2 Replies

9. Programming

error trying to compile a c++ source file

i tried to compile a c++ file using the g++ command: g++ <filename>.cpp -out <output_file> and i received the following error message: ld.so.1: gcc: fatal: relocation error: file gcc: symbol bindtextdomain: referenced symbol not found Killed is it that i am using incorrectly the... (1 Reply)
Discussion started by: ldrojasm
1 Replies

10. Programming

compile rpm-4.0 source

Hello Unix experts, I downloaded rpm-4.0 source from ftp.redhat.com and tried to make it. There are something I could not understand. - Makefile.in and Makefile.am instead of Makefile - file INSTALL doesn't show clearly the steps of compiling What are these 2 files, Makefile.in and... (2 Replies)
Discussion started by: eddie
2 Replies
Login or Register to Ask a Question

Featured Tech Videos