Educating yourself does not mean that you were stupid in the first place; it means that you are intelligent enough to know that there is plenty left to 'learn'. -Melanie Joy

Saturday, 26 January 2013

dbx: Error checking initialization failed ??

January 26, 2013 Posted by Dinesh , , , ,

How to Run:
                           dbx <binaryname>

Enabling access checking :   in dbx prompt enter :  check -access
Enabling memory leak checking: in dbx prompt enter: check -memuse
Enable all checks :  in dbx prompt enter : check -all

once this is done use run command with appropriate  command line arguments to run the program.
if there are any leaks are access errors present in the binary, an error file (binary.err) will be generated and all errors will be redirected to that file.

Some times if access/memory checks are enabled, system may give errors because of some libraries used by the binary.

Ex:

(dbx) check -access
access checking - ON
(dbx) run 1
Running: a.out 1
(process id 17010)
Reading rtcapihook.so
Reading rtcaudit.so
Reading libmapmalloc.so.1
Reading libc_psr.so.1
Reading rtcboot.so
Reading librtc.so
RTC: Enabling Error Checking...
dbx: internal warning: rtc: ld/st instruction uses %r6 at 0xd55c2388 in `/bghux018/bgh26882/AMS80/FSS_MDS/contrib/lib/libnnz10.so`SHATransform_SOL
dbx: system error: cannot recover; Access checking disabled
dbx: Error checking initialization failed.  All error checking disabled.
(dbx)

here because of libnnz10.so, access check is disabled by dbx. 
to tell dbx not use that library use 'rtc skip' command. and enable the access check and run the process.


(dbx) rtc skip libnnz10.so
RTC: please turn on access checking first
(dbx) check -access
access checking - ON
(dbx) rtc skip libnnz10.so
(dbx) run 1
Running: a.out 1
(process id 17046)
RTC: Enabling Error Checking...
RTC: Using UltraSparc trap mechanism
RTC: See `help rtc showmap' and `help rtc limitations' for details.
RTC: Running program...


When access checking is turned on, RTC detects and reports the following kinds of errors:
        baf     # Bad free
        duf     # Duplicate free
        maf    # Misaligned free
        mar    # Misaligned read
        maw   # Misaligned write
        oom    # Out of memory
        rua     # Read from unallocated memory
        rui      # Read from uninitialized memory
        wro    # Write to read-only memory
        wua    # Write to unallocated memory


With leaks checking, RTC will report the following kinds of errors:


        aib     # Possible memory leak - only pointer points in the middle of the block
        air     # Possible memory leak - pointer to the block exists only in register
        mel   # Memory leak - no pointers to the block


Memory errors can be suppressed. The following command suppress read from uninitialized (rui) in all functions in a.out
(dbx) suppress rui in a.out


RTC instruments memory access assembly instructions for access checking. You can exclude load objects, object files and functions from being instrumented. The following command
(dbx) rtc skippatch a.out -f main
excludes the function main from being instrumented.