* function instrumentation
[not found] <CAGZFCEEzkEH9SQ3+C9uuCfbZhJW2QqOKP58=kVpjrfcjmhSi2w@mail.gmail.com>
@ 2012-01-26 18:04 ` ratheesh kannoth
2012-01-27 7:08 ` Bert Wesarg
0 siblings, 1 reply; 2+ messages in thread
From: ratheesh kannoth @ 2012-01-26 18:04 UTC (permalink / raw)
To: linux-c-programming
Hi,
I would like to instrument cpp file using finstrument functions of gcc
(4.4.3) . I
have written all the files and build script.
I noticed that - the moment i add iostream header file into
test.cpp file , the program segmentaion faults.
What is the problem.
(gdb) r
Starting program: /home/fox/project_profile/a.out
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b65bd1 in std::ostream::sentry::sentry(std::ostream&) ()
from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0x00007ffff7b65bd1 in std::ostream::sentry::sentry(std::ostream&)
() from /usr/lib/libstdc++.so.6
#1 0x00007ffff7b664b8 in std::basic_ostream<char,
std::char_traits<char> >& std::__ostream_insert<char,
std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*, long) () from
/usr/lib/libstdc++.so.6
#2 0x00007ffff7b668bf in std::basic_ostream<char,
std::char_traits<char> >& std::operator<< <std::char_traits<char>
>(std::basic_ostream<char, std::char_traits<char> >&, char const*) ()
from /usr/lib/libstdc++.so.6
#3 0x00000000004008cf in helloworld () at possol.cpp:5
#4 0x00000000004008a9 in __cyg_profile_func_enter (func=0x4009e2,
caller=0x400ae6) at inst.cpp:13
#5 0x00000000004009f4 in global constructors keyed to main () at test.cpp:7
#6 0x0000000000400ae6 in __do_global_ctors_aux ()
#7 0x000000000040072b in _init ()
#8 0x00007fffffffe398 in ?? ()
#9 0x0000000000400a75 in __libc_csu_init ()
#10 0x00007ffff72cabe0 in __libc_start_main () from /lib/libc.so.6
#11 0x00000000004007d9 in _start ()
********************************* inst.cpp
*************************************
#include <stdio.h>
extern "C"
{
void __cyg_profile_func_enter (void *, void *)
__attribute__((no_instrument_function));
void __cyg_profile_func_exit (void *, void *)
__attribute__((no_instrument_function));
}
int helloworld();
void __cyg_profile_func_enter (void *func, void *caller)
{
helloworld() ;
}
void __cyg_profile_func_exit (void *func, void *caller)
{
}
************************** possol.cpp *************************************
#include <iostream>
int helloworld ()
{
std::cout << "hello " ;
}
******************************** test.cpp
***************************************
#inclde <iostream> /// You can avoid the segmentation fault, if u remove this.
int main()
{
return 0;
}
************************ build.sh *****************************
set -x
rm *.o
g++ -g -c inst.cpp
g++ -g -c possol.cpp
g++ -g -c test.cpp -finstrument-functions
g++ -g inst.o possol.o test.o
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: function instrumentation
2012-01-26 18:04 ` function instrumentation ratheesh kannoth
@ 2012-01-27 7:08 ` Bert Wesarg
0 siblings, 0 replies; 2+ messages in thread
From: Bert Wesarg @ 2012-01-27 7:08 UTC (permalink / raw)
To: ratheesh kannoth; +Cc: linux-c-programming
On Thu, Jan 26, 2012 at 19:04, ratheesh kannoth <ratheesh.ksz@gmail.com> wrote:
> Hi,
>
> I would like to instrument cpp file using finstrument functions of gcc
> (4.4.3) . I
> have written all the files and build script.
> I noticed that - the moment i add iostream header file into
> test.cpp file , the program segmentaion faults.
> What is the problem.
GCC also instruments inline functions, and iostream is probably full
of them. You could try to exclude them with the
-finstrument-functions-exclude-file-list=/usr/include flag.
Bert
>
> (gdb) r
> Starting program: /home/fox/project_profile/a.out
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff7b65bd1 in std::ostream::sentry::sentry(std::ostream&) ()
> from /usr/lib/libstdc++.so.6
> (gdb) bt
> #0 0x00007ffff7b65bd1 in std::ostream::sentry::sentry(std::ostream&)
> () from /usr/lib/libstdc++.so.6
> #1 0x00007ffff7b664b8 in std::basic_ostream<char,
> std::char_traits<char> >& std::__ostream_insert<char,
> std::char_traits<char> >(std::basic_ostream<char,
> std::char_traits<char> >&, char const*, long) () from
> /usr/lib/libstdc++.so.6
> #2 0x00007ffff7b668bf in std::basic_ostream<char,
> std::char_traits<char> >& std::operator<< <std::char_traits<char>
>>(std::basic_ostream<char, std::char_traits<char> >&, char const*) ()
> from /usr/lib/libstdc++.so.6
> #3 0x00000000004008cf in helloworld () at possol.cpp:5
> #4 0x00000000004008a9 in __cyg_profile_func_enter (func=0x4009e2,
> caller=0x400ae6) at inst.cpp:13
> #5 0x00000000004009f4 in global constructors keyed to main () at test.cpp:7
> #6 0x0000000000400ae6 in __do_global_ctors_aux ()
> #7 0x000000000040072b in _init ()
> #8 0x00007fffffffe398 in ?? ()
> #9 0x0000000000400a75 in __libc_csu_init ()
> #10 0x00007ffff72cabe0 in __libc_start_main () from /lib/libc.so.6
> #11 0x00000000004007d9 in _start ()
>
>
>
>
>
>
>
>
>
> ********************************* inst.cpp
> *************************************
> #include <stdio.h>
> extern "C"
> {
> void __cyg_profile_func_enter (void *, void *)
> __attribute__((no_instrument_function));
> void __cyg_profile_func_exit (void *, void *)
> __attribute__((no_instrument_function));
> }
>
> int helloworld();
> void __cyg_profile_func_enter (void *func, void *caller)
> {
> helloworld() ;
> }
> void __cyg_profile_func_exit (void *func, void *caller)
> {
> }
>
>
>
>
> ************************** possol.cpp *************************************
> #include <iostream>
> int helloworld ()
> {
> std::cout << "hello " ;
> }
>
>
>
> ******************************** test.cpp
> ***************************************
>
> #inclde <iostream> /// You can avoid the segmentation fault, if u remove this.
> int main()
> {
> return 0;
> }
>
>
> ************************ build.sh *****************************
>
> set -x
> rm *.o
> g++ -g -c inst.cpp
> g++ -g -c possol.cpp
> g++ -g -c test.cpp -finstrument-functions
> g++ -g inst.o possol.o test.o
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-27 7:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CAGZFCEEzkEH9SQ3+C9uuCfbZhJW2QqOKP58=kVpjrfcjmhSi2w@mail.gmail.com>
2012-01-26 18:04 ` function instrumentation ratheesh kannoth
2012-01-27 7:08 ` Bert Wesarg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.