Permalink
Browse files

Add a copyright and license (GNU GPL v2 to match the valgrind license).

Give a MV_ prefix to names in mv_ipc.h.


git-svn-id: svn+ssh://truffle/home/andrew/repo/memview@132 6d4121a9-3ab8-48c6-8db9-97dca464e206
  • Loading branch information...
ajclinto committed Jan 14, 2013
1 parent 1b9bf97 commit 6605033b954d30a23b7210bb1ba97aa14448c652
Showing with 862 additions and 110 deletions.
  1. +340 −0 COPYING
  2. +24 −0 Color.h
  3. +24 −0 DisplayLayout.C
  4. +24 −0 DisplayLayout.h
  5. +24 −0 GLImage.h
  6. +46 −22 Loader.C
  7. +26 −2 Loader.h
  8. +24 −0 Math.h
  9. +30 −6 MemoryState.C
  10. +26 −2 MemoryState.h
  11. +24 −0 StackTraceMap.C
  12. +24 −0 StackTraceMap.h
  13. +24 −0 StopWatch.h
  14. +24 −0 Window.C
  15. +24 −0 Window.h
  16. +24 −0 main.C
  17. +49 −25 tool/mv_ipc.h
  18. +81 −53 tool/mv_main.c
View
340 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
View
24 Color.h
@@ -1,3 +1,27 @@
+/*
+ This file is part of memview, a real-time memory trace visualization
+ application.
+
+ Copyright (C) 2013 Andrew Clinton
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#ifndef Color_H
#define Color_H
View
@@ -1,3 +1,27 @@
+/*
+ This file is part of memview, a real-time memory trace visualization
+ application.
+
+ Copyright (C) 2013 Andrew Clinton
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#include "DisplayLayout.h"
#include "MemoryState.h"
#include "StopWatch.h"
View
@@ -1,3 +1,27 @@
+/*
+ This file is part of memview, a real-time memory trace visualization
+ application.
+
+ Copyright (C) 2013 Andrew Clinton
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#ifndef DisplayLayout_H
#define DisplayLayout_H
View
@@ -1,3 +1,27 @@
+/*
+ This file is part of memview, a real-time memory trace visualization
+ application.
+
+ Copyright (C) 2013 Andrew Clinton
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#ifndef GLIMAGE_H
#define GLIMAGE_H
View
@@ -1,3 +1,27 @@
+/*
+ This file is part of memview, a real-time memory trace visualization
+ application.
+
+ Copyright (C) 2013 Andrew Clinton
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#include "Loader.h"
#include "MemoryState.h"
#include "StackTraceMap.h"
@@ -80,21 +104,21 @@ Loader::openPipe(int argc, char *argv[])
}
- if (ftruncate(shm_fd, sizeof(SharedData)) == -1)
+ if (ftruncate(shm_fd, sizeof(MV_SharedData)) == -1)
{
fprintf(stderr, "ftruncate failed\n");
return false;
}
- mySharedData = (SharedData *)mmap(NULL, sizeof(SharedData),
+ mySharedData = (MV_SharedData *)mmap(NULL, sizeof(MV_SharedData),
PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
if (mySharedData == MAP_FAILED)
{
fprintf(stderr, "mmap failed\n");
return false;
}
- memset(mySharedData, 0, sizeof(SharedData));
+ memset(mySharedData, 0, sizeof(MV_SharedData));
}
int fd[2];
@@ -218,7 +242,7 @@ Loader::run()
rval = loadFromTest();
break;
case LACKEY:
- rval = loadFromLackey(theBlockSize);
+ rval = loadFromLackey(MV_BlockSize);
break;
case MEMVIEW_PIPE:
rval = loadFromPipe();
@@ -270,10 +294,10 @@ Loader::loadFromLackey(int max_read)
switch (type_str[0])
{
- case 'L': type = theTypeRead; break;
+ case 'L': type = MV_TypeRead; break;
case 'S':
- case 'M': type = theTypeWrite; break;
- case 'I': type = theTypeInstr; break;
+ case 'M': type = MV_TypeWrite; break;
+ case 'I': type = MV_TypeInstr; break;
default: continue;
}
@@ -305,9 +329,9 @@ Loader::loadFromLackey(int max_read)
static inline void
decodeAddr(uint64 &addr, uint64 &size, uint64 &type)
{
- size = addr >> theSizeShift,
- type = (addr & theTypeMask) >> theTypeShift;
- addr &= theAddrMask;
+ size = addr >> MV_SizeShift,
+ type = (addr & MV_TypeMask) >> MV_TypeShift;
+ addr &= MV_AddrMask;
}
bool
@@ -316,7 +340,7 @@ Loader::loadFromPipe()
if (!myPipe)
return false;
- TraceBlockHandle block(new TraceBlock);
+ TraceBlockHandle block(new MV_TraceBlock);
fd_set rfds;
@@ -340,21 +364,21 @@ Loader::loadFromPipe()
if (retval == 0)
return true;
- Header header;
- if (!read(myPipeFD, &header, sizeof(Header)))
+ MV_Header header;
+ if (!read(myPipeFD, &header, sizeof(MV_Header)))
return false;
if (header.myType == MV_BLOCK)
{
- if (read(myPipeFD, block.get(), sizeof(TraceBlock)))
+ if (read(myPipeFD, block.get(), sizeof(MV_TraceBlock)))
{
if (block->myEntries && loadBlock(block))
return true;
}
}
else if (header.myType == MV_STACKTRACE)
{
- StackInfo stack;
+ MV_StackInfo stack;
if (read(myPipeFD, &stack, header.mySize))
{
uint64 size, type;
@@ -380,13 +404,13 @@ Loader::loadFromTest()
static const uint64 theSize = 32*1024;
static uint64 theCount = 0;
- TraceBlockHandle block(new TraceBlock);
- block->myEntries = theBlockSize;
+ TraceBlockHandle block(new MV_TraceBlock);
+ block->myEntries = MV_BlockSize;
for (uint64 j = 0; j < block->myEntries; j++)
{
- block->myAddr[j] = theCount*theBlockSize + j;
- block->myAddr[j] |= (uint64)theTypeRead << theTypeShift;
- block->myAddr[j] |= (uint64)4 << theSizeShift;
+ block->myAddr[j] = theCount*MV_BlockSize + j;
+ block->myAddr[j] |= (uint64)MV_TypeRead << MV_TypeShift;
+ block->myAddr[j] |= (uint64)4 << MV_SizeShift;
}
loadBlock(block);
@@ -440,8 +464,8 @@ bool
Loader::loadBlock(const TraceBlockHandle &block)
{
// Basic semantic checking to ensure we received valid data
- uint64 type = (block->myAddr[0] & theTypeMask) >> theTypeShift;
- if (block->myEntries > theBlockSize || type > 7)
+ uint64 type = (block->myAddr[0] & MV_TypeMask) >> MV_TypeShift;
+ if (block->myEntries > MV_BlockSize || type > 7)
{
fprintf(stderr, "received invalid block (size %u, type %lld)\n",
block->myEntries, type);
View
@@ -1,3 +1,27 @@
+/*
+ This file is part of memview, a real-time memory trace visualization
+ application.
+
+ Copyright (C) 2013 Andrew Clinton
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#ifndef Loader_H
#define Loader_H
@@ -12,7 +36,7 @@ class MemoryState;
class StackTraceMap;
typedef std::shared_ptr<MemoryState> MemoryStateHandle;
-typedef std::shared_ptr<TraceBlock> TraceBlockHandle;
+typedef std::shared_ptr<MV_TraceBlock> TraceBlockHandle;
class Loader : public QThread {
public:
@@ -61,7 +85,7 @@ class Loader : public QThread {
// Shared memory. This interface is only available as a template for
// future work.
- SharedData *mySharedData;
+ MV_SharedData *mySharedData;
int myIdx;
// What are we loading from?
View
24 Math.h
@@ -1,3 +1,27 @@
+/*
+ This file is part of memview, a real-time memory trace visualization
+ application.
+
+ Copyright (C) 2013 Andrew Clinton
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#ifndef Math_H
#define Math_H
View
@@ -1,3 +1,27 @@
+/*
+ This file is part of memview, a real-time memory trace visualization
+ application.
+
+ Copyright (C) 2013 Andrew Clinton
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
#include "MemoryState.h"
#include "StopWatch.h"
#include "Color.h"
@@ -84,19 +108,19 @@ MemoryState::printStatusInfo(QString &message, uint64 addr)
const char *typestr = 0;
int type = entry.type();
- switch (type & ~theTypeFree)
+ switch (type & ~MV_TypeFree)
{
- case theTypeRead: typestr = "Read"; break;
- case theTypeWrite: typestr = "Written"; break;
- case theTypeInstr: typestr = "Instruction"; break;
- case theTypeAlloc: typestr = "Allocated"; break;
+ case MV_TypeRead: typestr = "Read"; break;
+ case MV_TypeWrite: typestr = "Written"; break;
+ case MV_TypeInstr: typestr = "Instruction"; break;
+ case MV_TypeAlloc: typestr = "Allocated"; break;
}
if (typestr)
{
tmp.sprintf("\t%12s: %d", typestr, entry.time());
message.append(tmp);
- if (type & theTypeFree)
+ if (type & MV_TypeFree)
message.append(" (freed)");
}
}
Oops, something went wrong.

0 comments on commit 6605033

Please sign in to comment.