<commit_before>/* **********************************************************
 * Copyright (c) 2010-2014 Google, Inc.  All rights reserved.
 * Copyright (c) 2007-2010 VMware, Inc.  All rights reserved.
 * **********************************************************/

/* Dr. Memory: the memory debugger
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License, and no later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Library General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/* Dr. Memory: the memory debugger
 * a.k.a. DRMemory == DynamoRIO Memory checker
 */

/* Features:
 * Reads of uninitialized memory
 *   Including register definedness tracking
 *   Including system call in/out params
 *   TODO: bit-level checking
 * Heap tracking:
 *   Access to unaddressable memory
 *     Redzones to catch overflow/underflow
 *   Access to freed memory: delay the actual free
 *   Double/invalid free
 *   Leaks
 *   TODO: app custom malloc interface
 * Access to un-reserved TLS slots
 */
/* TODO: Multiple threads:
 *
 *   - Pathological races between mallocs and frees can result in Dr. Memory's
 *     shadow memory structures becoming mis-aligned and subsequent false
 *     positives.  However, such a scenario will always be preceded by either
 *     an invalid free error or a double free error.
 *
 *   - General races between memory accesses and Dr. Memory's shadow memory
 *     can occur but errors will only occur with the presence of erroneous
 *     race conditions in the application.
 */

/***************************************************************************/

#include "dr_api.h"
#include "drwrap.h"
#include "drx.h"
#include "drmemory.h"
#include "readwrite.h"
#include "fastpath.h"
#include "report.h"
#include "shadow.h"
#include "syscall.h"
#include "alloc_drmem.h"
#include "alloc.h"
#include "heap.h"
#include "replace.h"
#include "leak.h"
#include "stack.h"
#include "perturb.h"
#include <stddef.h> /* for offsetof */
#include "pattern.h"
#include "frontend.h"
#ifdef WINDOWS
# include "handlecheck.h"
#endif /* WINDOWS */

#ifdef USE_DRSYMS
# include "drsyms.h" /* for pre-loading pdbs on Vista */
# include "drsymcache.h"
#endif

char logsubdir[MAXIMUM_PATH];
#ifndef USE_DRSYMS
file_t f_fork = INVALID_FILE;
#else
file_t f_results;
file_t f_missing_symbols;
file_t f_suppress;
file_t f_potential;
#endif
static uint num_threads;

#if defined(__DATE__) && defined(__TIME__)
static const char * const build_date = __DATE__ " " __TIME__;
#else
static const char * const build_date = "unknown";
#endif<commit_msg>Avoid disk error message on option error due to uninitialized f_results<commit_after>/* **********************************************************
 * Copyright (c) 2010-2014 Google, Inc.  All rights reserved.
 * Copyright (c) 2007-2010 VMware, Inc.  All rights reserved.
 * **********************************************************/

/* Dr. Memory: the memory debugger
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License, and no later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Library General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/* Dr. Memory: the memory debugger
 * a.k.a. DRMemory == DynamoRIO Memory checker
 */

/* Features:
 * Reads of uninitialized memory
 *   Including register definedness tracking
 *   Including system call in/out params
 *   TODO: bit-level checking
 * Heap tracking:
 *   Access to unaddressable memory
 *     Redzones to catch overflow/underflow
 *   Access to freed memory: delay the actual free
 *   Double/invalid free
 *   Leaks
 *   TODO: app custom malloc interface
 * Access to un-reserved TLS slots
 */
/* TODO: Multiple threads:
 *
 *   - Pathological races between mallocs and frees can result in Dr. Memory's
 *     shadow memory structures becoming mis-aligned and subsequent false
 *     positives.  However, such a scenario will always be preceded by either
 *     an invalid free error or a double free error.
 *
 *   - General races between memory accesses and Dr. Memory's shadow memory
 *     can occur but errors will only occur with the presence of erroneous
 *     race conditions in the application.
 */

/***************************************************************************/

#include "dr_api.h"
#include "drwrap.h"
#include "drx.h"
#include "drmemory.h"
#include "readwrite.h"
#include "fastpath.h"
#include "report.h"
#include "shadow.h"
#include "syscall.h"
#include "alloc_drmem.h"
#include "alloc.h"
#include "heap.h"
#include "replace.h"
#include "leak.h"
#include "stack.h"
#include "perturb.h"
#include <stddef.h> /* for offsetof */
#include "pattern.h"
#include "frontend.h"
#ifdef WINDOWS
# include "handlecheck.h"
#endif /* WINDOWS */

#ifdef USE_DRSYMS
# include "drsyms.h" /* for pre-loading pdbs on Vista */
# include "drsymcache.h"
#endif

char logsubdir[MAXIMUM_PATH];
#ifndef USE_DRSYMS
file_t f_fork = INVALID_FILE;
#else
file_t f_results = INVALID_FILE;
file_t f_missing_symbols;
file_t f_suppress;
file_t f_potential;
#endif
static uint num_threads;

#if defined(__DATE__) && defined(__TIME__)
static const char * const build_date = __DATE__ " " __TIME__;
#else
static const char * const build_date = "unknown";
#endif
{'fraction_non_alphanumeric': 0.14523618895116092, 'fraction_numerical': 0.009287429943955164, 'mean_word_length': 4.192019950124688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4850097', 'n_tokens_mistral': 1860, 'n_tokens_neox': 1766, 'n_words': 724}