|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Jan 2004
Città: Montignoso(MS)
Messaggi: 9456
|
[C] Ancora Bus Error...
Ciao, nessuno che sappia indicarmi una possibile "fonte" di bus error nel codice (Quando eseguito) di questa funzione ?
(Supponendo che i moduli chiamanti e quelli "chiamati" siano a posto...) thks
__________________
"Il Meglio che si possa ottenere è evitare il peggio." I.C. |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Dovresti allegare un qualche codice che consente di riprodurre il problema e debuggare in locale...
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
|
|
|
|
|
#3 | |
|
Senior Member
Iscritto dal: Jan 2004
Città: Montignoso(MS)
Messaggi: 9456
|
Quote:
Comunque il codice che causa l'errore e' questo ma ancora non ho capito il motivo... Codice:
...
//fd0 e' un descrittore di dile
//fd e' un "descrittore di pipe"
int ps = getpagesize();
char * p = mmap(NULL, ((((a.st_size)/ps)+1)*ps), PROT_READ, MAP_SHARED, fd0, 0);
if (p == NULL)
{
perror("fileAllString_3: mmap");
f = FAILURE;
return f;
}
/*p e' il puntatore all'area di memoria dove...*/\
/*Posso gia' chiudere il file...*/
if ((close(fd0)) == -1)
perror("fileAllString_3: error closeing file");
/*Cerco subString all'interno di p*/
char * firstOcc = strstr(p, subString);
if (firstOcc != NULL)
{/*Sottostringa trovata*/
int pos = firstOcc - p ;
if (munmap(p, ((((a.st_size)/ps)+1)*ps)) == -1)
perror("fileAllString_3: error on munmap");
...
if (write(fd, &pos, sizeof(int)) != sizeof(int))
{
perror("fileAllString_3: error writing on client pipe" );
f = FAILURE;
return f;
}
f = TRUE;
return f;
}
/*Altrimenti faccio solo la munmap*/
if (munmap(p, ((((a.st_size)/ps)+1)*ps)) == -1)
perror("fileAllString_3: error on munmap");
...
thks
__________________
"Il Meglio che si possa ottenere è evitare il peggio." I.C. |
|
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
intanto correggi questo:
Codice:
char * p = mmap(NULL, ((((a.st_size)/ps)+1)*ps), PROT_READ, MAP_SHARED, fd0, 0);
if (p == NULL)...
^^^^^^^^^^^^^^^^^
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
|
|
|
|
|
#5 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Roma
Messaggi: 15625
|
Il resto sembra corretto, dovresti investigare con gdb su quale è la funzione che fallisce.
__________________
0: or %edi, %ecx; adc %eax, (%edx); popf; je 0b-22; pop %ebx; fadds 0x56(%ecx); lds 0x56(%ebx), %esp; mov %al, %al andeqs pc, r1, #147456; blpl 0xff8dd280; ldrgtb r4, [r6, #-472]; addgt r5, r8, r3, ror #12 |
|
|
|
|
|
#6 | |
|
Senior Member
Iscritto dal: Jan 2004
Città: Montignoso(MS)
Messaggi: 9456
|
Quote:
__________________
"Il Meglio che si possa ottenere è evitare il peggio." I.C. |
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 00:48.



















