help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help regarding DDD break points


From: Colin S. Miller
Subject: Re: help regarding DDD break points
Date: Mon, 27 Mar 2006 22:38:23 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20051002)

doshirushabh@hotmail.com wrote:
Hi
   I am using linux 7.3. I have a code which is like

File :  main.cpp
------------------------------------------------------------
#include <stdio.h>
void main() {

int a = 0;
#include "test.cpp"
printf(" hi \n");

}


File test.cpp
--------------------------------------------------------------------------
printf("hello world\n");
---------------------------------------------------------------------------

I compile main.cpp with -g option and gdb the a.out file. I am trying
to set the break point at #include "test.cpp".  But its never
recognized. Is there any way i can step in test.cpp ??

Kindly help out
Regards
Rushabh


Rushabh,


#include  is used to pull in header files (*.h), not source files.

A header file provides information about other source files;
they list what functions the other source files provide, not
how these function work.

In general, you can't set a break point on an #include <> line.


Try this code

file: main.cpp

#include <stdio.h>
#include "test.h"

int main(int argc, char**argv)
{
  testFn();
  printf("Hi\n");
}


file: test.h

extern void testFn(void);

file: test.c

#include <stdio.h>
#include "test.h"

void testFn(void)
{
  printf("hello world.\n");
}


and compile with
gcc -g main.c -o main.o
gcc -g test.c -o test.o
gcc -g test.o main.o



HTH,
Colin S. Miller


--
Replace the obvious in my email address with the first three letters of the 
hostname to reply.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]