summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatsuDrag92018-06-20 10:11:49 +0530
committerNatsuDrag92018-06-20 10:11:49 +0530
commite25480293be793d0ab8c78038ff9ef6aa27a8c50 (patch)
tree9f59958647e98f1dfbba5d6dd81d4376fbe9cda4
parent7ee6d232a84e011ce51313912fa547058985987c (diff)
downloadLDMicroGtk-e25480293be793d0ab8c78038ff9ef6aa27a8c50.tar.gz
LDMicroGtk-e25480293be793d0ab8c78038ff9ef6aa27a8c50.tar.bz2
LDMicroGtk-e25480293be793d0ab8c78038ff9ef6aa27a8c50.zip
NewProgram () Segmentation fault
-rw-r--r--ldmicro/circuit.cpp10
-rw-r--r--ldmicro/lib/linuxUI/linuxLD.cpp5
-rw-r--r--ldmicro/miscutil.cpp6
-rw-r--r--ldmicro/undoredo.cpp3
4 files changed, 22 insertions, 2 deletions
diff --git a/ldmicro/circuit.cpp b/ldmicro/circuit.cpp
index 1d9d3d7..ff598e3 100644
--- a/ldmicro/circuit.cpp
+++ b/ldmicro/circuit.cpp
@@ -24,9 +24,11 @@
#include <linuxUI.h>
#include <stdio.h>
#include <stdlib.h>
+#include <iostream>
#include "ldmicro.h"
+using namespace std;
static ElemSubcktSeries *LoadSeriesFromFile(FILE *f);
@@ -35,10 +37,12 @@ static ElemSubcktSeries *LoadSeriesFromFile(FILE *f);
//-----------------------------------------------------------------------------
ElemLeaf *AllocLeaf(void)
{
+ cout << "Inside AlocLeaf" << "\n";
return (ElemLeaf *)CheckMalloc(sizeof(ElemLeaf));
}
ElemSubcktSeries *AllocSubcktSeries(void)
{
+ cout << "Inside AllocSub" << "\n";
return (ElemSubcktSeries *)CheckMalloc(sizeof(ElemSubcktSeries));
}
ElemSubcktParallel *AllocSubcktParallel(void)
@@ -638,7 +642,7 @@ void FreeCircuit(int which, void *any)
//-----------------------------------------------------------------------------
void FreeEntireProgram(void)
{
- ForgetEverything();
+ // ForgetEverything();
int i;
for(i = 0; i < Prog.numRungs; i++) {
@@ -742,11 +746,15 @@ void DeleteSelectedRung(void)
//-----------------------------------------------------------------------------
static ElemSubcktSeries *AllocEmptyRung(void)
{
+ cout << "Inside AllocEmpty" << "\n";
ElemSubcktSeries *s = AllocSubcktSeries();
+ cout << "Checking series count" << "\n";
s->count = 1;
+ cout << "Series count done" << "\n";
s->contents[0].which = ELEM_PLACEHOLDER;
ElemLeaf *l = AllocLeaf();
s->contents[0].d.leaf = l;
+ cout << "Exiting AllocEmpty" << "\n";
return s;
}
diff --git a/ldmicro/lib/linuxUI/linuxLD.cpp b/ldmicro/lib/linuxUI/linuxLD.cpp
index cdeb190..8778154 100644
--- a/ldmicro/lib/linuxUI/linuxLD.cpp
+++ b/ldmicro/lib/linuxUI/linuxLD.cpp
@@ -1,4 +1,7 @@
#include "linuxUI.h"
+#include <iostream>
+
+using namespace std;
std::vector<HEAPRECORD> HeapRecords;
@@ -23,6 +26,7 @@ HANDLE HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes)
{
+ cout << "Inside HeapAlloc" << "\n";
if (hHeap == NULL)
{
// printf("Alloc**********NULL HEAP***************\n");
@@ -64,6 +68,7 @@ LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes)
chunck.Chunck = p;
chunck.dwSize = dwBytes;
(*it).Element.push_back(chunck);
+ cout << "Exiting HeapAlloc" << "\n";
return p;
}
diff --git a/ldmicro/miscutil.cpp b/ldmicro/miscutil.cpp
index 092f606..8f63398 100644
--- a/ldmicro/miscutil.cpp
+++ b/ldmicro/miscutil.cpp
@@ -23,9 +23,11 @@
#include "linuxUI.h"
#include <stdio.h>
#include <stdlib.h>
-
+#include <iostream>
#include "ldmicro.h"
+using namespace std;
+
// We should display messages to the user differently if we are running
// interactively vs. in batch (command-line) mode.
BOOL RunningInBatchMode = FALSE;
@@ -158,8 +160,10 @@ void CheckHeap(char *file, int line)
//-----------------------------------------------------------------------------
void *CheckMalloc(size_t n)
{
+ cout << "Inside CheckMalloc" << "\n";
ok();
void *p = HeapAlloc(MainHeap, HEAP_ZERO_MEMORY, n);
+ cout << "Exiting CheckMalloc" << "\n";
return p;
}
void CheckFree(void *p)
diff --git a/ldmicro/undoredo.cpp b/ldmicro/undoredo.cpp
index 69831d8..2a3c2fd 100644
--- a/ldmicro/undoredo.cpp
+++ b/ldmicro/undoredo.cpp
@@ -25,9 +25,12 @@
#include "linuxUI.h"
#include <stdio.h>
#include <stdlib.h>
+#include <iostream>
#include "ldmicro.h"
+using namespace std;
+
// Store a `deep copy' of the entire program before every change, in a
// circular buffer so that the first one scrolls out as soon as the buffer
// is full and we try to push another one.