Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging PMDebugger into Pmemcheck #83

Open
wants to merge 11 commits into
base: pmem-3.15
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
*.o

# /
Expand Down
14 changes: 14 additions & 0 deletions pmemcheck/pmc_include.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@

#ifndef PMC_INCLUDE_H
#define PMC_INCLUDE_H
/** Metadata structure for store information array */
struct arr_md {
UWord end_index; //Index of current free metadata
Addr min_addr;
Addr max_addr;
UWord start_index;
enum flushed_state
{
NO_FLUSHED,
PART_FLUSHED,
ALL_FLUSHED,
} state;
};


/** Single store to memory. */
struct pmem_st {
Expand Down
24 changes: 23 additions & 1 deletion pmemcheck/pmc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,22 @@
/** Max allowable path length */
#define MAX_PATH_SIZE 4096

/** Max allowable length of store information array*/
#define MAX_ARRAY_NUM 100000000UL
pbalcer marked this conversation as resolved.
Show resolved Hide resolved

/** defining store information array structure*/
struct pmem_stores_array
{
UWord m_index;//Index of current metadata
struct pmem_st *pmem_stores;
struct arr_md* m_data; // Address of metadata array
pbalcer marked this conversation as resolved.
Show resolved Hide resolved
};

/** Holds parameters and runtime data */
static struct pmem_ops {
/** Array of stores to persistent memory*/
struct pmem_stores_array info_array;

/** Set of stores to persistent memory. */
OSet *pmem_stores;

Expand Down Expand Up @@ -810,7 +824,6 @@ trace_pmem_store(Addr addr, SizeT size, UWord value)
{
if (LIKELY(!is_pmem_access(addr, size)))
return;

struct pmem_st *store = VG_(OSetGen_AllocNode)(pmem.pmem_stores,
(SizeT) sizeof (struct pmem_st));
store->addr = addr;
Expand Down Expand Up @@ -2033,6 +2046,15 @@ pmc_process_cmd_line_option(const HChar *arg)
static void
pmc_post_clo_init(void)
{
pmem.info_array.pmem_stores = VG_(malloc)("pmc.main.cpci.7",
pbalcer marked this conversation as resolved.
Show resolved Hide resolved
MAX_ARRAY_NUM * sizeof(struct pmem_st));
pmem.info_array.m_index = 0;
pmem.info_array.m_data = VG_(malloc)("pmc.main.cpci.8",
MAX_ARRAY_NUM * sizeof(struct arr_md));
pmem.info_array.m_data[0].min_addr = pmem.info_array.m_data[0].max_addr = -1;
pmem.info_array.m_data[0].state = NO_FLUSHED;
pmem.info_array.m_data[0].end_index=pmem.info_array.m_data[0].start_index=0;

pmem.pmem_stores = VG_(OSetGen_Create)(/*keyOff*/0, cmp_pmem_st,
VG_(malloc), "pmc.main.cpci.1", VG_(free));

Expand Down