Ejemplo n.º 1
0
def parse_general():
    global jeheap

    try:
        jeheap.narenas = dbg.to_int(dbg.get_value('narenas'))
    except:
        print('[shadow] error: symbol narenas not found')
        sys.exit()

    try:
        jeheap.nbins = dbg.to_int(dbg.get_value('nbins'))
    except:
        # XXX: these are firefox specific, we must add support for more
        #      jemalloc variants in the future
        if sys.platform == 'darwin' or sys.platform == 'win32':
            jeheap.ntbins = dbg.to_int(dbg.get_value('ntbins'))
            jeheap.nsbins = dbg.to_int(dbg.get_value('nsbins'))
            jeheap.nqbins = dbg.to_int(dbg.get_value('nqbins'))
            jeheap.nbins = jeheap.ntbins + jeheap.nsbins + jeheap.nqbins
        else:
            if jeheap.DWORD_SIZE == 4:
                jeheap.nbins = 36
            elif jeheap.DWORD_SIZE == 8:
                jeheap.nbins = 35

    # XXX: figure out how to calculate the chunk size correctly, this is
    #      firefox specific
    jeheap.chunk_size = 1 << 20
Ejemplo n.º 2
0
def parse_general():
    global jeheap

    try:
        jeheap.narenas = dbg.to_int(dbg.get_value("narenas"))
    except:
        print("[shadow] error: symbol narenas not found")
        sys.exit()

    try:
        jeheap.nbins = dbg.to_int(dbg.get_value("nbins"))
    except:
        # XXX: these are firefox specific, we must add support for more
        #      jemalloc variants in the future
        if sys.platform == "darwin" or sys.platform == "win32":
            jeheap.ntbins = dbg.to_int(dbg.get_value("ntbins"))
            jeheap.nsbins = dbg.to_int(dbg.get_value("nsbins"))
            jeheap.nqbins = dbg.to_int(dbg.get_value("nqbins"))
            jeheap.nbins = jeheap.ntbins + jeheap.nsbins + jeheap.nqbins
        else:
            if jeheap.DWORD_SIZE == 4:
                jeheap.nbins = 36
            elif jeheap.DWORD_SIZE == 8:
                jeheap.nbins = 35

    # XXX: figure out how to calculate the chunk size correctly, this is
    #      firefox specific
    jeheap.chunk_size = 1 << 20
Ejemplo n.º 3
0
def parse_options():
    global jeheap

    # thread magazine caches (disabled on firefox)
    try:
        opt_mag = dbg.get_value('opt_mag')
    except:
        opt_mag = 0

    try:
        opt_tcache = dbg.get_value('opt_tcache')
    except:
        opt_tcache = 0

    try:
        opt_lg_tcache_nslots = \
            dbg.get_value('opt_lg_tcache_nslots')
    except:
        opt_lg_tcache_nslots = 0

    if opt_mag != 0 or opt_tcache != 0 or opt_lg_tcache_nslots != 0:
        jeheap.MAGAZINES = true

    if jeheap.MAGAZINES == true:
        try:
            mag_rag_t_size = dbg.sizeof('mag_rack_t')
            bin_mags_t_size = dbg.sizeof('bin_mags_t')

            jeheap.magrack_size = \
                    mag_rag_t_size + (bin_mags_t_size * (jeheap.nbins - 1))

        except:
            # standalone variant
            jeheap.STANDALONE = true

            tcache_t_size = dbg.sizeof('tcache_t')
            tcache_bin_t_size = dbg.sizeof('tcache_bin_t')

            jemalloc.magrack_size = \
                    tcache_t_size + (tcache_bin_t_size * (jeheap.nbins - 1))
Ejemplo n.º 4
0
def parse_options():
    global jeheap

    # thread magazine caches (disabled on firefox)
    try:
        opt_mag = dbg.get_value('opt_mag')
    except:
        opt_mag = 0

    try:
        opt_tcache = dbg.get_value('opt_tcache')
    except:
        opt_tcache = 0

    try:
        opt_lg_tcache_nslots = \
            dbg.get_value('opt_lg_tcache_nslots')
    except:
        opt_lg_tcache_nslots = 0

    if opt_mag != 0 or opt_tcache != 0 or opt_lg_tcache_nslots != 0:
        jeheap.MAGAZINES = true

    if jeheap.MAGAZINES == true:
        try:
            mag_rag_t_size = dbg.sizeof('mag_rack_t')
            bin_mags_t_size = dbg.sizeof('bin_mags_t')
                
            jeheap.magrack_size = \
                    mag_rag_t_size + (bin_mags_t_size * (jeheap.nbins - 1))

        except:
            # standalone variant
            jeheap.STANDALONE = true

            tcache_t_size = dbg.sizeof('tcache_t')
            tcache_bin_t_size = dbg.sizeof('tcache_bin_t')

            jemalloc.magrack_size = \
                    tcache_t_size + (tcache_bin_t_size * (jeheap.nbins - 1))