Regarding requirement - yes. I believe that it would be a powerful debugging tool to develop. It would be so powerful for analyzing code flow of flows for very large projects - that an ordinary developer can understand code in minutes. Say I have 100,000,00 Lines of code. Debugging using GDB or any other mechanism would be really difficult that I know. If I have after each statement
print("%s %d\n", __FILE__, __LINE__); I can know where my code is flowing during execution. I a firm believer that this tool will help developers a lot for debugging / analyzing and profiling code. Regards, Prakash On Tue, Jun 12, 2012 at 12:43 PM, Mailaripillai, Kannan Jeganathan <kanna...@hp.com> wrote: > Hi Prakash, > >> statement ; print("%s %d\n", __FILE__, __LINE__); >> So that when program is running I know which file which line of my program >> is getting executed. > > Just curious to know. Is there any real world application/product where this > will help? Can you give more context to this requirement. > > Regards, > Kannan > > -----Original Message----- > From: gcc-ow...@gcc.gnu.org [mailto:gcc-ow...@gcc.gnu.org] On Behalf Of Satya > Prakash Prasad > Sent: Tuesday, June 12, 2012 12:05 PM > To: Ian Lance Taylor > Cc: gcc@gcc.gnu.org > Subject: Re: GCC Making a new PASS > > Thanks to all my issue got resolved. > > I placed the code in 'if block' checking cfun is NULL or not and > removed gcc_assert. It worked fine for me. > > My idea is to print the lines of source code gcc is compiling. Further > to that I want to update the statement with > > statement ; print("%s %d\n", __FILE__, __LINE__); > > So that when program is running I know which file which line of my > program is getting executed. I tried printing statements in > pass_remove_useless_stmts pass but I think these are internal GCC > stages. I see statements of code like: > > if (D.3886 > 0) > { > D.3887 = obj->funcs; > D.3888 = D.3887->close; > D.3886 = obj->next_input; > D.3888 (obj, D.3886); > } > > So please let me know how can I achieve the objective and which pass > should I make use of? > > Regards, > Prakash > > On Tue, Jun 12, 2012 at 11:06 AM, Ian Lance Taylor <i...@google.com> wrote: >> Satya Prakash Prasad <satyaprakash.pra...@gmail.com> writes: >> >>> But the compilation process fails further on: >>> >>> gcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/xgcc >>> -Bgcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ >>> -B/usr/local/x86_64-unknown-linux-gnu/bin/ >>> -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem >>> /usr/local/x86_64-unknown-linux-gnu/include -isystem >>> /usr/local/x86_64-unknown-linux-gnu/sys-include -O2 -O2 -g -O2 >>> -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes >>> -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC >>> -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -msse -c >>> \ >>> ../.././gcc/config/i386/crtfastmath.c \ >>> -o crtfastmath.o >>> ../.././gcc/config/i386/crtfastmath.c:110: internal compiler error: >>> Segmentation fault >>> Please submit a full bug report, >>> with preprocessed source if appropriate. >>> See <URL:http://gcc.gnu.org/bugs.html> for instructions. >>> make[2]: *** [crtfastmath.o] Error 1 >>> make[2]: Leaving directory `gcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc' >>> make[1]: *** [all-gcc] Error 2 >>> make[1]: Leaving directory `gcc/gcc-4.1.2' >>> make: *** [all] Error 2 >>> gcc/gcc-4.1.2 1223> >>> >>> Any help - why the issue is occurring and how can I achieve the objective? >> >> The straightforward approach will be to pull out the debugger and see >> what is going on when the compiler crashes. It may help to look at >> http://gcc.gnu.org/wiki/DebuggingGCC . >> >> Ian