Need to write call stack in running program in C [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I need to print a call stack in log file in a running program (in C) as I need to check the flow,
I have to send traces to other environment and I can't debug, Is there any way to do it in C.

If the platform is linux (and I believe in OSX too), you could use backtrace and backtrace_symbols to achieve what you want.
As per the notes section of backtrace
The symbol names may be unavailable without the use of special linker
options. For systems using the GNU linker, it is necessary to use the
-rdynamic linker option. Note that names of "static" functions are not exposed, and won't be available in the backtrace.

Related

Need to write a program that takes an assembly-language program and produces the corresponding machine language [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am very new to programming and I need to write a program that takes an assembly-language program and produces the corresponding machine language.
I need to write the program in C
Does anyone know any good tutorials I can find to create this program?
What you would want to do is finding a datasheet which describes the different op codes for the assembly instructions you're writing. Try ISA "your processor name" - this might come up with something useful.
It probably will be hard and you will run into a lot of problems, but you'll probably learn something from it.

How to encrypt header files in C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
We need to have a good way to encrypt our C source. We need the header files to be unreadable by the another one (Codevision or Winavr Compiler).
For example I Drived One GSM Module For Send And recive SMS ... But I need no anyone access to my source and only can use them .. Is there any solution to this problem?
How Can I Make a Compiled Header File ???
You can encrypt your source with any good encryption tool, of course.
But obviously you can't compile it anymore ...
But perhaps a library could help you.
You can build a library which contains your GSM stuff.
Then you and others can call the functions from the library, the only file you have to distribute, is the *.h file where the declarations are.

having issue printing data out to output file [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm having a problem with getting this code to print out to file due to some undefined behavior. It seems that when I test it the output file opened but was empty. can anyone run it on their system and tell me if it work on your system or is it not working at all. Also can you provide me with the output file if you run it.
here is the code
http://ideone.com/ku7qc
and the data for the file
http://ideone.com/TY1U8
thanks
Per the code comments:
The compiler is supposed to be gcc, the system("PAUSE") won't "work" in most UNIXes. It looks like it is meant to be compiled under cygwin running on a Windows PC, or under Linux. Not Windows. The PAUSE part makes very little sense, since that is largely a DOS command. You had to have copied the code from someone, it looks like the code scores competing ice skaters. The probability that it is production code is low.
Where did you get the code, and what assignment is this supposed to be for?
Suggestion:
See www.cygwin.com to install cygwin on your PC.

Parse Linux static Libraries (.a) in C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to know how to parse a linux static librarie (.a) to get content of each files.
Thank's to help me !
In addition to objdump mentioned, you can use nm to list the content of a dot-a file, both what is defined inside (as well as which file.c defined them, when not stripped), as well as extern (which needs to be satisfied by other libraries).

calling convention in c [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
some one please tell me
how to change the default calling convention in c?
Calling conventions are not specified by the language. They are extensions to your compiler.
That said, commonly you do something like:
void __fastcall my_func(void);
But this is completely dependent on your compiler and platform.
This largely depends on your compiler, toolchain, and platform. You will need to be more specific on what your environment is, and what you wish to change to.

Resources