blob: e7eeeebad0de4d39ad4340b76ebd598c23f3685a [file] [log] [blame]
sewardjaf44c822007-11-25 14:01:38 +00001/*
2 This file is part of drd, a data race detector.
3
sewardj85642922008-01-14 11:54:56 +00004 Copyright (C) 2006-2008 Bart Van Assche
sewardjaf44c822007-11-25 14:01:38 +00005 bart.vanassche@gmail.com
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307, USA.
21
22 The GNU General Public License is contained in the file COPYING.
23*/
24
25
26#ifndef __SEGMENT_H
27#define __SEGMENT_H
28
29
30// Segments and segment lists. A segment represents information about
31// a contiguous group of statements of a specific thread. There is a vector
32// clock associated with each segment.
33
34
35#include "drd_vc.h"
36#include "pub_drd_bitmap.h"
37#include "pub_tool_execontext.h" // ExeContext
38#include "pub_tool_stacktrace.h" // StackTrace
39
40
41typedef struct segment
42{
43 struct segment* next;
44 struct segment* prev;
barta2b6e1b2008-03-17 18:32:39 +000045 int refcnt;
sewardjaf44c822007-11-25 14:01:38 +000046 ExeContext* stacktrace;
47 VectorClock vc;
48 struct bitmap* bm;
49} Segment;
50
barta2b6e1b2008-03-17 18:32:39 +000051
barted866d82008-02-24 18:29:10 +000052Segment* sg_new(const ThreadId creator, const ThreadId created);
barta2b6e1b2008-03-17 18:32:39 +000053int sg_get_refcnt(const Segment* const sg);
54Segment* sg_get(Segment* const sg);
55void sg_put(Segment* const sg);
sewardjaf44c822007-11-25 14:01:38 +000056void sg_print(const Segment* const sg);
57Bool sg_get_trace(void);
barted866d82008-02-24 18:29:10 +000058void sg_set_trace(const Bool trace_segment);
bart7102f102008-03-17 17:37:53 +000059ULong sg_get_created_segments_count(void);
60ULong sg_get_alive_segments_count(void);
61ULong sg_get_max_alive_segments_count(void);
sewardjaf44c822007-11-25 14:01:38 +000062
63
64#endif // __SEGMENT_H