Au secours (language C)
Fermé
meftahie
Messages postés
21
Date d'inscription
samedi 8 décembre 2007
Statut
Membre
Dernière intervention
17 juillet 2008
-
8 déc. 2007 à 22:37
meftahie Messages postés 21 Date d'inscription samedi 8 décembre 2007 Statut Membre Dernière intervention 17 juillet 2008 - 8 déc. 2007 à 22:54
meftahie Messages postés 21 Date d'inscription samedi 8 décembre 2007 Statut Membre Dernière intervention 17 juillet 2008 - 8 déc. 2007 à 22:54
1 réponse
meftahie
Messages postés
21
Date d'inscription
samedi 8 décembre 2007
Statut
Membre
Dernière intervention
17 juillet 2008
1
8 déc. 2007 à 22:54
8 déc. 2007 à 22:54
voila donc mon programme:
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include "elfLoader.h"
#include "architecture.h"
unsigned int *affich(int a , ElfSection *section)
{
archi A;
int i,c;
printf("Section : %s\n", section -> name);
for(i=0 ; i<section->nbOfBytes ;i++)
c=a+i;
printf("adresse : %d instruction:%d\n", &(A.memoire[c]),A.memoire[c]);
}
ma fonction main:
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include "architecture.h"
#include "elfLoader.h"
int calc(int, int);
main(int argc, char *argv[] )
{ char * filename = NULL;
Elf *e = NULL;
ElfSection *textSection = NULL;
ElfSection *dataSection = NULL;
ElfSymbolTable *symTable = NULL;
archi A;
if ((argc < 2) || (argc > 2)) {
printf("Usage: %s <fichier_elf> \n", argv[0]);
exit(1);
}
printf("Opening File %s...\n", argv[1]);
filename = argv[1];
if ((e = openElfFile(filename)) != NULL) {
/* get everything */
getTextSection(e, &textSection);
getDataSection(e, &dataSection);
getSymbolTable(e, &symTable);
int a = calc(a,textSection->nbOfBytes);
affich(0 , &textSection);
affich(a , &dataSection);
}
printf("That's all folks!\n");
}
mais ce programme va m'afficher le contenu de tous les registres à la fois, et moi je cherche à afficher juste le contenu du registe que l utilisateur va lui demander.
merci
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include "elfLoader.h"
#include "architecture.h"
unsigned int *affich(int a , ElfSection *section)
{
archi A;
int i,c;
printf("Section : %s\n", section -> name);
for(i=0 ; i<section->nbOfBytes ;i++)
c=a+i;
printf("adresse : %d instruction:%d\n", &(A.memoire[c]),A.memoire[c]);
}
ma fonction main:
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include "architecture.h"
#include "elfLoader.h"
int calc(int, int);
main(int argc, char *argv[] )
{ char * filename = NULL;
Elf *e = NULL;
ElfSection *textSection = NULL;
ElfSection *dataSection = NULL;
ElfSymbolTable *symTable = NULL;
archi A;
if ((argc < 2) || (argc > 2)) {
printf("Usage: %s <fichier_elf> \n", argv[0]);
exit(1);
}
printf("Opening File %s...\n", argv[1]);
filename = argv[1];
if ((e = openElfFile(filename)) != NULL) {
/* get everything */
getTextSection(e, &textSection);
getDataSection(e, &dataSection);
getSymbolTable(e, &symTable);
int a = calc(a,textSection->nbOfBytes);
affich(0 , &textSection);
affich(a , &dataSection);
}
printf("That's all folks!\n");
}
mais ce programme va m'afficher le contenu de tous les registres à la fois, et moi je cherche à afficher juste le contenu du registe que l utilisateur va lui demander.
merci