Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SeerMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) {
QObject::connect(visualizerImageAction, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbImageVisualizer);

QObject::connect(gdbWidget->gdbMonitor(), &GdbMonitor::astrixTextOutput, runStatus, &SeerRunStatusIndicator::handleText);
QObject::connect(gdbWidget->gdbMonitor(), &GdbMonitor::equalTextOutput, runStatus, &SeerRunStatusIndicator::handleText);
QObject::connect(gdbWidget->gdbMonitor(), &GdbMonitor::astrixTextOutput, this, &SeerMainWindow::handleText);
QObject::connect(gdbWidget->gdbMonitor(), &GdbMonitor::caretTextOutput, this, &SeerMainWindow::handleText);
QObject::connect(gdbWidget->gdbMonitor(), &GdbMonitor::equalTextOutput, this, &SeerMainWindow::handleText);
Expand Down
12 changes: 10 additions & 2 deletions src/SeerRunStatusIndicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ void SeerRunStatusIndicator::handleText (const QString& text) {

}else if (text.startsWith("*stopped")) {

//^connected,frame={level=\"0\",addr=\"0x00007f48351f80c1\",func=\"read\",args=[],from=\"/lib64/libc.so.6\",arch=\"i386:x86-64\"}"
setRunStatus(SeerRunStatusIndicator::Stopped);

//^connected,frame={level=\"0\",addr=\"0x00007f48351f80c1\",func=\"read\",args=[],from=\"/lib64/libc.so.6\",arch=\"i386:x86-64\"}"
return;
}else if (text.startsWith("=thread-exited")) {

//=thread-exited,id="1",group-id="i1"
setRunStatus(SeerRunStatusIndicator::Stopped);

}else if (text.startsWith("=thread-group-exited")) {

//=thread-group-exited,id="i1"
setRunStatus(SeerRunStatusIndicator::Stopped);

}else{
// All other text is ignored by this widget.
Expand Down
1 change: 1 addition & 0 deletions src/resource.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<file>resources/help/Skips.md</file>
<file>resources/mi-python/MIEcho.py</file>
<file>resources/mi-python/MISkip.py</file>
<file>resources/mi-python/MIKill.py</file>
</qresource>
</RCC>

38 changes: 38 additions & 0 deletions src/resources/mi-python/MIKill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import re

#
# Python MI command to support gdb's "kill" commands.
#
# https://sourceware.org/bugzilla/show_bug.cgi?id=31090
# https://stackoverflow.com/questions/9669025/gdb-exit-program-without-exiting-gdb


class MIKill(gdb.MICommand):
"""
Run the 'kill' command.

-exec-kill Kill the child process in which your program is running under GDB.
-exec-kill-inferiors Kill the inferior or inferiors identified by GDB inferior number(s) infno.

See:
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Kill-Process.html
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Inferiors-Connections-and-Programs.html#Inferiors-Connections-and-Programs
"""

def __init__(self, name, mode):
self._mode = mode
super(MIKill, self).__init__(name)

def invoke(self, argv):
if self._mode == "kill":
gdb.execute ("kill" + " ".join(argv), to_string=True)
return None
elif self._mode == "killinferiors":
gdb.execute ("kill inferiors" + " ".join(argv), to_string=True)
return None
else:
raise gdb.GdbError("kill: Invalid parameter: %s" % self._mode)

MIKill("-exec-kill", "kill")
MIKill("-exec-kill-inferiors", "killinferiors")

1 change: 1 addition & 0 deletions tests/hellofft/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hellofft
38 changes: 38 additions & 0 deletions tests/hellofft/MIKill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import re

#
# Python MI command to support gdb's "kill" commands.
#
# https://sourceware.org/bugzilla/show_bug.cgi?id=31090
# https://stackoverflow.com/questions/9669025/gdb-exit-program-without-exiting-gdb


class MIKill(gdb.MICommand):
"""
Run the 'kill' command.

-exec-kill Kill the child process in which your program is running under GDB.
-exec-kill-inferiors Kill the inferior or inferiors identified by GDB inferior number(s) infno.

See:
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Kill-Process.html
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Inferiors-Connections-and-Programs.html#Inferiors-Connections-and-Programs
"""

def __init__(self, name, mode):
self._mode = mode
super(MIKill, self).__init__(name)

def invoke(self, argv):
if self._mode == "kill":
gdb.execute ("kill" + " ".join(argv), to_string=True)
return None
elif self._mode == "killinferiors":
gdb.execute ("kill inferiors" + " ".join(argv), to_string=True)
return None
else:
raise gdb.GdbError("kill: Invalid parameter: %s" % self._mode)

MIKill("-exec-kill", "kill")
MIKill("-exec-kill-inferiors", "killinferiors")

10 changes: 10 additions & 0 deletions tests/hellofft/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: all
all: hellofft

hellofft: hellofft.c
gcc -g -o hellofft hellofft.c -lm

.PHONY: clean
clean:
rm -f hellofft

34 changes: 34 additions & 0 deletions tests/hellofft/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

After -exec-kill

^done
^running
*running,thread-id="all"
^done,thread-ids={thread-id="1"},current-thread-id="1",number-of-threads="1"
^done,threads=[{id="1",target-id="Thread 0x7ffff7eb0b80 (LWP 9413)",name="hellofft",state="running",core="6"}],current-thread-id="1"
^error,msg="Selected thread is running."
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1"
^done
^done,thread-ids={},number-of-threads="0"
^done,threads=[]
^error,msg="No registers."

Exiting normally

=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1",exit-code="0"
*stopped,reason="exited-normally"
^done,thread-ids={},number-of-threads="0"
^done,threads=[]
^error,msg="No registers."
^done,thread-ids={},number-of-threads="0"
^done,threads=[]
^done,threads=[]
^error,msg="No registers."
^error,msg="No registers."
^done,thread-ids={},number-of-threads="0"
^done,threads=[]
^error,msg="No registers."
^error,msg="No registers."

142 changes: 142 additions & 0 deletions tests/hellofft/hellofft.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/* Factored discrete Fourier transform, or FFT, and its inverse iFFT */

#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

#define q 15 /* for 2^3 points */
#define N (1<<q) /* N-point FFT, iFFT */

typedef float real;
typedef struct{real Re; real Im;} complex;

#ifndef PI
# define PI 3.14159265358979323846264338327950288
#endif


/* Print a vector of complexes as ordered pairs. */
static void print_vector( const char *title, complex *x, int n) {

int i;

printf("%s (dim=%d):", title, n);

for(i=0; i<(n<8?n:8); i++ ) {
printf(" %5.2f,%5.2f ", x[i].Re,x[i].Im);
}

putchar('\n');

return;
}

/*
fft(v,N):
[0] If N==1 then return.
[1] For k = 0 to N/2-1, let ve[k] = v[2*k]
[2] Compute fft(ve, N/2);
[3] For k = 0 to N/2-1, let vo[k] = v[2*k+1]
[4] Compute fft(vo, N/2);
[5] For m = 0 to N/2-1, do [6] through [9]
[6] Let w.re = cos(2*PI*m/N)
[7] Let w.im = -sin(2*PI*m/N)
[8] Let v[m] = ve[m] + w*vo[m]
[9] Let v[m+N/2] = ve[m] - w*vo[m]
*/
void fft( complex *v, int n, complex *tmp ) {

if(n>1) { /* otherwise, do nothing and return */
int k,m; complex z, w, *vo, *ve;
ve = tmp; vo = tmp+n/2;
for(k=0; k<n/2; k++) {
ve[k] = v[2*k];
vo[k] = v[2*k+1];
}
fft( ve, n/2, v ); /* FFT on even-indexed elements of v[] */
fft( vo, n/2, v ); /* FFT on odd-indexed elements of v[] */
for(m=0; m<n/2; m++) {
w.Re = cos(2*PI*m/(double)n);
w.Im = -sin(2*PI*m/(double)n);
z.Re = w.Re*vo[m].Re - w.Im*vo[m].Im; /* Re(w*vo[m]) */
z.Im = w.Re*vo[m].Im + w.Im*vo[m].Re; /* Im(w*vo[m]) */
v[ m ].Re = ve[m].Re + z.Re;
v[ m ].Im = ve[m].Im + z.Im;
v[m+n/2].Re = ve[m].Re - z.Re;
v[m+n/2].Im = ve[m].Im - z.Im;
}
}
return;
}

/*
ifft(v,N):
[0] If N==1 then return.
[1] For k = 0 to N/2-1, let ve[k] = v[2*k]
[2] Compute ifft(ve, N/2);
[3] For k = 0 to N/2-1, let vo[k] = v[2*k+1]
[4] Compute ifft(vo, N/2);
[5] For m = 0 to N/2-1, do [6] through [9]
[6] Let w.re = cos(2*PI*m/N)
[7] Let w.im = sin(2*PI*m/N)
[8] Let v[m] = ve[m] + w*vo[m]
[9] Let v[m+N/2] = ve[m] - w*vo[m]
*/
void ifft( complex *v, int n, complex *tmp ) {

if(n>1) { /* otherwise, do nothing and return */
int k,m; complex z, w, *vo, *ve;
ve = tmp; vo = tmp+n/2;
for(k=0; k<n/2; k++) {
ve[k] = v[2*k];
vo[k] = v[2*k+1];
}
ifft( ve, n/2, v ); /* FFT on even-indexed elements of v[] */
ifft( vo, n/2, v ); /* FFT on odd-indexed elements of v[] */
for(m=0; m<n/2; m++) {
w.Re = cos(2*PI*m/(double)n);
w.Im = sin(2*PI*m/(double)n);
z.Re = w.Re*vo[m].Re - w.Im*vo[m].Im; /* Re(w*vo[m]) */
z.Im = w.Re*vo[m].Im + w.Im*vo[m].Re; /* Im(w*vo[m]) */
v[ m ].Re = ve[m].Re + z.Re;
v[ m ].Im = ve[m].Im + z.Im;
v[m+n/2].Re = ve[m].Re - z.Re;
v[m+n/2].Im = ve[m].Im - z.Im;
}
}
return;
}

int main(void) {

complex v[N], v1[N], scratch[N];
int k;

for (int x=0; x<10000; x++) {
/* Fill v[] with a function of known FFT: */
for(k=0; k<N; k++) {
v[k].Re = 0.125 * cos(2*PI*k/(double)N);
v[k].Im = 0.125 * sin(2*PI*k/(double)N);
v1[k].Re = 0.3 * cos(2*PI*k/(double)N);
v1[k].Im = -0.3 * sin(2*PI*k/(double)N);
}

/* FFT, iFFT of v[]: */
print_vector("Orig", v, N);
fft( v, N, scratch );
print_vector(" FFT", v, N);
ifft( v, N, scratch );
print_vector("iFFT", v, N);

/* FFT, iFFT of v1[]: */
print_vector("Orig", v1, N);
fft( v1, N, scratch );
print_vector(" FFT", v1, N);
ifft( v1, N, scratch );
print_vector("iFFT", v1, N);
}

exit(EXIT_SUCCESS);
}

24 changes: 24 additions & 0 deletions tests/hellofft/project.seer
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"seerproject": {
"executable": "hellofft",
"postgdbcommands": [
""
],
"pregdbcommands": [
""
],
"startmode": {
"arguments": "",
"breakinfunction": false,
"breakinfunctionname": "",
"breakinmain": true,
"breakpointsfile": "",
"nobreak": false,
"nonstopmode": false,
"randomizestartaddress": false,
"showassemblytab": false
},
"symbolfile": "",
"workingdirectory": ""
}
}