BUS_ADRALN 에러 관련하여 질문있습니다.
글쓴이: musfield / 작성시간: 목, 2009/10/08 - 4:28오후
pjsip 라고 오픈소스 sip 스택을 solaris 10에 64bit 컴파일해서 깔려고 합니다.근데 빌드는 잘되는데, 런타임 때 다음과 같은 에러가 뜨면서 코어덤프가 나네요.32bit 으로 컴파일 했을 때는 문제가 없습니다.
truss 로 살펴보면..
Incurred fault #5, FLTACCESS %pc = 0x10002EF50
siginfo: SIGBUS BUS_ADRALN addr=0x10014CD94
Received signal #10, SIGBUS [default]
siginfo: SIGBUS BUS_ADRALN addr=0x10014CD94
문제가 되는 코드를 간략하게 보여드리면
struct pj_hash_table_t { pj_hash_entry **table; unsigned count, rows; pj_hash_iterator_t iterator; }; PJ_DEF(pj_hash_table_t*) pj_hash_create(pj_pool_t *pool, unsigned size) { pj_hash_table_t *h; unsigned table_size; ........................................... <span>h = PJ_POOL_ALLOC_T(pool, pj_hash_table_t);</span> h->count = 0; PJ_LOG( 6, ("hashtbl", "hash table %p created from pool %s", h, pj_pool_getobjname(pool))); /* size must be 2^n - 1. round-up the size to this rule, except when size is 2^n, then size will be round-down to 2^n-1. */ table_size = 8; do { table_size <<= 1; } while (table_size < size); table_size -= 1; h->rows = table_size; <span>h->table = (pj_hash_entry**)pj_pool_calloc(pool, table_size+1, sizeof(pj_hash_entry*));</span> return h; }
위에서 두번째로, 굵은 글씨로 표기된 부분이 문제가 되는 부분입니다. h->table 변수에, pj_pool_calloc 으로 얻어진 메모리 주소값을 allign 하는 과정에서 코어가 발생합니다.
참고로 위의 truss 에서 addr=0x10014CD94 이 h->table 변수의 주소값입니다.
PJ_POOL_ALLOC_T , pj_pool_calloc 모두 내부 pool 에 할당된 size 만큼의 메모리 공간의 주소를 리턴해주는 내부 함수입니다.
pj_hash_entry **temp = (pj_hash_entry**)pj_pool_calloc(pool, table_size+1, sizeof(pj_hash_entry*));
이런 식으로 했을 때는 문제가 되지 않는데요.
BUS_ADRALN SIGBUS 에러가 어떤 경우에 발생하는 에러인가요?
pj_hash_create를 호출할 때마다 코어덤프가 발생하는 것이 아니고, pj_hash_create를 한 세번 정도 호출한 뒤에 발생합니다.
32bit 으로 빌드했을 때 전혀 문제가 되지 않는데 왜 이런 문제가 발생하는지 도무지 감이 안 오네요.귀찮으시겠지만 좀 살펴봐주시고 의견 좀 부탁드립니다 ㅠㅠ
Forums:
댓글 달기