编译C code到MIPS汇编 [英] Compile code in C to MIPS assembly
问题描述
我写的,我需要看到它在MIPS汇编code A C程序。
如何安装或操作软件,需要* .c文件为* .txt或* .something_else看到它的MIPS汇编code?
我的操作系统是Linux操作系统。
非常感谢!
BTW我的code是:
的#include<&stdio.h中GT;
#包括LT&;&stdlib.h中GT;
#包括LT&;&string.h中GT;的#define SIZE 128诠释的main(){
焦炭mychar,串[SIZE]
INT I;
诠释计数= 0; 的printf(请输入您的字符串:\\ n \\ n);
与fgets(字符串,大小,标准输入); 的printf(请输入字符地发现:);
mychar =的getchar(); 对于(i = 0;字符串[我] ='\\ 0';!我++)
在(string [I] == mychar)
算上++; 的printf(该字符%C似乎%d次的\\ n,mychar,计数);
返回0;
}
你想要的是一个MIPS交叉编译器,除非你在一个MIPS中,在这种情况下,你要经常MIPS编译运行Linux。 这里是建立在Linux上交叉编译一个HOWTO。
一旦你编译它,你会希望看到MIPS拆卸。 objdump的可以帮助你。
I wrote a C program that I need to see it in MIPS assembly code.
How do I install or operate a software that takes *.c file to be *.txt or *.something_else to see its MIPS assembly code ?
My OS is Linux.
Thanks a lot !!
BTW my code is:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 128
int main ()
{
char mychar , string [SIZE];
int i;
int count =0 ;
printf ("Please enter your string: \n\n");
fgets (string, SIZE, stdin);
printf ("Please enter char to find: ");
mychar = getchar();
for (i=0 ; string[i] != '\0' ; i++ )
if ( string[i] == mychar )
count++;
printf ("The char %c appears %d times\n" ,mychar ,count);
return 0;
}
What you want is a MIPS cross-compiler, unless you're running Linux on a MIPS box, in which case you want a regular MIPS compiler. Here is a howto for setting up a cross compiler on Linux.
Once you've compiled it, you'll want to see the MIPS disassembly. objdump can help you there.
这篇关于编译C code到MIPS汇编的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!