Profiling of Cross Compiled Code


maybe my following question is off-topic but the posting to gnu.gcc had no success. But I am sure there are many people in this newsgroup who can help.

I want to do profiling of some C-code with gprof. I have a GCC 3.4.4 compiled as cross compiler for m68k. The code is running on an embedded system with no operating system. How can get the profiling information? As there is no OS there is no file system and thus there will be no gmon.out file. What do I have to do to get profiling information of my code? Reading the man page of the gnu tools didn't help me. Furthermore, in which library can I find the mcount function?

Thanks in advance for your help and sorry for maybe beeing off-topic.

Reply to
Karl-Heinz Rossmann
Loading thread data ...

Basically by hacking deep enough into the GCC and runtime library sources to find the source of mcount(), and modify it to write the counts to something else than a file --- any place which you can read out by some dedicated debug function later. It may be easier to use an emulator or simulator instead.

Of course it didn't. A man page is a thoroughly inadequate format to document a tool as complex as GCC in. Read the info instead. More to the point, you need to read the "GCC internals".

That depends on the target, but usually in libc.

Hans-Bernhard Broeker (
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

Or read the html manual on the gcc website - I find it nicer to work with than info (I don't know if it will help with your problems, however...)

I'd suggest a couple of alternative ideas. First, if you want to change a library function it is often easier to write your own version and link it into your code as a normal module before the library, rather than modifying and re-compiling the library - it shortens the code-compile-test cycle considerably. Secondly, it might be easier to implement some basic file functions so that the profiling functions are unchanged, but your gmon.out "file" is a buffer in the board's ram, or sent out on a serial port, or whatever is most convenient. Then you can re-create the gmon.out file on the host machine and use the results.

If you get anywhere with this, let us know - your experiences might be useful to other users of embedded gcc.

Reply to
David Brown

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.