Skip to content
Snippets Groups Projects
Commit 1b418604 authored by Miguel Espino's avatar Miguel Espino
Browse files

gdb stuff

parent 95e4ad5f
No related branches found
No related tags found
No related merge requests found
#------------------------------------#
# Miguel Espino
# ll352639
# lfc083
#------------------------------------#
(gdb) run
Starting program: /student/lfc083/cmpt332-lfc083-lab0/myQsort
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) n
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Usage: perror. wrong number of arguments: Success
[Inferior 1 (process 20823) exited with code 0377]
Missing debuginfo, try: dnf debuginfo-install glibc-2.39-22.fc40.x86_64
(gdb) run 1
Starting program: /student/lfc083/cmpt332-lfc083-lab0/myQsort 1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
123
321
12
12
12
Program received signal SIGSEGV, Segmentation fault.
0x00000000004016ea in main (argc=2, argv=0x7fffffffdb48) at sortMain.c:48
48 if ((nlines = *(int *)readlines(lineptr, MAXLINES)) >=0)
(gdb) b readlines
Breakpoint 1 at 0x401405: file input-routines.c, line 33.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) yes
Starting program: /student/lfc083/cmpt332-lfc083-lab0/myQsort 1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 1, readlines (lineptr=0x404080 <lineptr>,
maxlines=100) at input-routines.c:33
33 nlines=0;
(gdb) c
Continuing.
12
12
12
Program received signal SIGSEGV, Segmentation fault.
0x00000000004016ea in main (argc=2, argv=0x7fffffffdb48) at sortMain.c:48
48 if ((nlines = *(int *)readlines(lineptr, MAXLINES)) >=0)
(gdb) b 47
Breakpoint 2 at 0x4016db: file sortMain.c, line 48.
(gdb) d readlines
(gdb) run 1
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /student/lfc083/cmpt332-lfc083-lab0/myQsort 1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 2, main (argc=2, argv=0x7fffffffdb48) at sortMain.c:48
48 if ((nlines = *(int *)readlines(lineptr, MAXLINES)) >=0)
(gdb) n
Breakpoint 1, readlines (lineptr=0x404080 <lineptr>,
maxlines=100) at input-routines.c:33
33 nlines=0;
(gdb) s
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd970 "@", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd970 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd970 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb) info local
c = 10
i = 0
Breakpoint 1, main (argc=2, argv=0x7fffffffd9d8) at sortMain.c:48
48 if ((nlines = *(int *)readlines(lineptr, MAXLINES)) >=0)
(gdb)
(gdb) s
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:33
33 nlines=0;
(gdb) s
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "@", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb) s
18 if (c == '\n')
(gdb)
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb)
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb) info local
c = 10
i = 0
(gdb)
c = 10
i = 0
(gdb)
c = 10
i = 0
(gdb)
c = 10
i = 0
(gdb)
c = 10
i = 0
(gdb)
c = 10
i = 0
(gdb)
c = 10
i = 0
(gdb)
c = 10
i = 0
(gdb) s
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb)
40 line [len-1] = '\0';
(gdb) info local
len = 1
nlines = 11
p = 0x405810 ""
line = "\n\000\000\000\000\000\000\000\b\000\000\000\000\000\000\000\000\200\0
00\000\000\000\000\000\000\b\000\000\000\000\000\000\000\b", '\000' <repeats 14
times>, "\316\335\377\377\377\177\000\000\001\000\000\000\000\000\000\005\000\
001\000\000\000\000\000\000\330\331\377\377\377\177\000\000\002", '\000'
<repeats 16 times>, "\320\377", <incomplete sequence \367>
(gdb)
len = 1
nlines = 11
p = 0x405810 ""
line = "\n\000\000\000\000\000\000\000\b\000\000\000\000\000\000\000\000\200\00
0\000\000\000\000\000\000\b\000\000\000\000\000\000\000\b", '\000' <repeats 14
times>, "\316\335\377\377\377\177\000\000\001\000\000\000\000\000\000\005\000\
001\000\000\000\000\000\000\330\331\377\377\377\177\000\000\002", '\000'
<repeats 16 times>, "\320\377", <incomplete sequence \367>
(gdb) s
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb) info local
c = 0
i = 0
(gdb) s
41 memmove(p, line, len);
(gdb)
42 lineptr[nlines++] = p;
(gdb)
34 while ((len = myGetline(line, MAXLEN)) > 0)
(gdb)
myGetline (s=0x7fffffffd800 "\r", lim=100) at input-routines.c:16
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
123
17 s[i] = c;
(gdb)
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb) info lcoal
Undefined info command: "lcoal". Try "help info".
(gdb) info local
c = 49
i = 0
(gdb)
c = 49
i = 0
(gdb) s
17 s[i] = c;
(gdb) info local
c = 50
i = 1
(gdb) s
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
17 s[i] = c;
(gdb)
16 for (i=0;i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
(gdb)
18 if (c == '\n')
(gdb) info local
c = 10
i = 3
(gdb) s
20 s[i] = c;
(gdb)
21 ++i;
(gdb)
23 return i;
(gdb)
25 }
(gdb)
readlines (lineptr=0x404080 <lineptr>, maxlines=100) at input-routines.c:36
36 if (nlines >= maxlines || (p = (char *)malloc(len)) == NULL)
(gdb) info local
len = 4
nlines = 2
p = 0x4056d0 "\r"
line = "123\n\000\000\000\000\b\000\000\000\000\000\000\000\000\200\000\000\00
0\000\000\000\000\b\000\000\000\000\000\000\000\b", '\000' <repeats 14 times>,
"\316\335\377\377\377\177\000\000\001\000\000\000\000\000\000\005\000\001\000
\000\000\000\000\000\330\331\377\377\377\177\000\000\002", '\000'
<repeats 16 times>, "\320\377", <incomplete sequence \367>
(gdb) p p
$1 = 0x4056d0 "\r"
(gdb) p *p
$2 = 13 '\r'
(gdb) s
40 line [len-1] = '\0';
(gdb) info local
len = 4
nlines = 2
p = 0x4056f0 ""
line = "123\n\000\000\000\000\b\000\000\000\000\000\000\000\000\200\000\000\00
0\000\000\000\000\b\000\000\000\000\000\000\000\b", '\000' <repeats 14 times>,
"\316\335\377\377\377\177\000\000\001\000\000\000\000\000\000\005\000\001\000\
000\000\000\000\000\330\331\377\377\377\177\000\000\002", '\000'
<repeats 16 times>, "\320\377", <incomplete sequence \367>
(gdb) p line
$3 = "123\n\000\000\000\000\b\000\000\000\000\000\000\000\000\200\000\000\000
\000\000\000\000\b\000\000\000\000\000\000\000\b", '\000' <repeats 14 times>,
"\316\335\377\377\377\177\000\000\001\000\000\000\000\000\000\005\000\001\00
0\000\000\000\000\000\330\331\377\377\377\177\000\000\002", '\000'
<repeats 16 times>, "\320\377", <incomplete sequence \367>
(gdb) p *line
$4 = 49 '1'
Breakpoint 1, main (argc=2, argv=0x7fffffffd9d8) at sortMain.c:48
48 if ((nlines = readlines(lineptr, MAXLINES)) >=0)
Missing debuginfo, try: dnf debuginfo-install glibc-2.39-22.fc40.x86_64
(gdb) c
Continuing.
123
21
123
1
2
UNSORTED ORDER
Program received signal SIGSEGV, Segmentation fault.
(gdb) b 55
Breakpoint 1 at 0x40172d: file sortMain.c, line 55.
(gdb) c
The program is not being run.
(gdb) run 1
Starting program: /student/lfc083/cmpt332-lfc083-lab0/myQsort 1
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) n
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
12
321
12
1
12
3
UNSORTED ORDER
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7e24e5d in __strlen_avx2 () from /lib64/libc.so.6
Missing debuginfo, try: dnf debuginfo-install glibc-2.39-22.fc40.x86_64
(gdb) s
Single stepping until exit from function __strlen_avx2,
which has no line number information.
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) quit
(gdb) b 50
Breakpoint 1 at 0x4016f3: file sortMain.c, line 50.
(gdb) s
The program is not being run.
(gdb) run 1
Starting program: /student/lfc083/cmpt332-lfc083-lab0/myQsort 1
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) n
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
s
123
321
123
2
2
1
2
Breakpoint 1, main (argc=2, argv=0x7fffffffd9d8) at sortMain.c:50
50 printf("UNSORTED ORDER\n");
Missing debuginfo, try: dnf debuginfo-install glibc-2.39-22.fc40.x86_64
(gdb) s
UNSORTED ORDER
51 writelines(*lineptr, nlines);
(gdb)
writelines (lineptr=0x4056b0, nlines=8) at input-routines.c:51
warning: Source file is more recent than executable.
51 while (nlines-- >0)
(gdb)
52 printf("%s\n", *lineptr++);
(gdb)
Program received signal SIGSEGV, Segmentation fault.
(gdb) b 53
Breakpoint 1 at 0x40170c: file sortMain.c, line 53.
(gdb) run 1
Starting program: /student/lfc083/cmpt332-lfc083-lab0/myQsort 1
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) n
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
s
123
123
12
1
UNSORTED ORDER
s
123
123
12
1
Breakpoint 1, main (argc=2, argv=0x7fffffffd9d8) at sortMain.c:53
53 myQsort ((void **)lineptr, 0, nlines-1, comparing);
Missing debuginfo, try: dnf debuginfo-install glibc-2.39-22.fc40.x86_64
(gdb) s
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:23
23 if (left >= right)
(gdb)
26 (*swap)(v, left, (left + right)/2);
(gdb)
swap (v=0x404080 <lineptr>, i=0, j=2) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:27
27 last = left;
(gdb)
29 for (index = left+1; index < right; index++)
(gdb) info local
index = 0
last = 0
(gdb)
index = 0
last = 0
(gdb)
index = 0
last = 0
(gdb) s
31 if ((*comp)(v[index],v[left]) < 0)
(gdb)
compareInt (first=0x4056d0, second=0x4056f0) at intComp.c:21
21 iFirst = *(int*)first;
(gdb)
22 iSecond = *(int*)second;
(gdb)
24 if(iFirst < iSecond){
(gdb)
25 return -1;
(gdb)
31 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:32
32 (*swap)(v, ++last, index);
(gdb) info local
index = 1
last = 0
(gdb)
index = 1
last = 0
(gdb)
index = 1
last = 0
(gdb)
index = 1
last = 0
(gdb)
index = 1
last = 0
(gdb)
index = 1
last = 0
(gdb) s
swap (v=0x404080 <lineptr>, i=1, j=1) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:29
29 for (index = left+1; index < right; index++)
(gdb)
31 if ((*comp)(v[index],v[left]) < 0)
(gdb)
compareInt (first=0x4056b0, second=0x4056f0) at intComp.c:21
21 iFirst = *(int*)first;
(gdb)
22 iSecond = *(int*)second;
(gdb)
24 if(iFirst < iSecond){
(gdb)
25 return -1;
(gdb)
31 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:32
32 (*swap)(v, ++last, index);
(gdb)
swap (v=0x404080 <lineptr>, i=2, j=2) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:29
29 for (index = left+1; index < right; index++)
(gdb)
31 if ((*comp)(v[index],v[left]) < 0)
(gdb)
compareInt (first=0x405710, second=0x4056f0) at intComp.c:21
21 iFirst = *(int*)first;
(gdb)
22 iSecond = *(int*)second;
(gdb)
24 if(iFirst < iSecond){
(gdb)
27 return (iFirst > iSecond);
(gdb)
31 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:29
29 for (index = left+1; index < right; index++)
(gdb)
31 if ((*comp)(v[index],v[left]) < 0)
(gdb)
compareInt (first=0x405730, second=0x4056f0) at intComp.c:21
21 iFirst = *(int*)first;
(gdb)
22 iSecond = *(int*)second;
(gdb)
24 if(iFirst < iSecond){
(gdb)
25 return -1;
(gdb)
31 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>
) at qsort.c:32
32 (*swap)(v, ++last, index);
(gdb)
swap (v=0x404080 <lineptr>, i=3, j=4) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb) info local
temp = 0x405710
(gdb) p *temp
Attempt to dereference a generic pointer.
(gdb) p (int) temp
$1 = 4216592
(gdb) s
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:29
29 for (index = left+1; index < right; index++)
(gdb)
35 (*swap)(v, left, last);
(gdb)
swap (v=0x404080 <lineptr>, i=0, j=3) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:36
36 myQsort(v, left, last-1, comp);
(gdb) info local
index = 5
last = 3
(gdb) s
myQsort (v=0x404080 <lineptr>, left=0, right=2, comp=0x401344 <compareInt>)
at qsort.c:23
23 if (left >= right)
(gdb) s
26 (*swap)(v, left, (left + right)/2);
(gdb)
swap (v=0x404080 <lineptr>, i=0, j=1) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=2, comp=0x401344 <compareInt>
) at qsort.c:27
27 last = left;
(gdb)
29 for (index = left+1; index < right; index++)
(gdb)
31 if ((*comp)(v[index],v[left]) < 0)
(gdb)
compareInt (first=0x405730, second=0x4056d0) at intComp.c:21
21 iFirst = *(int*)first;
(gdb)
22 iSecond = *(int*)second;
(gdb) info local
iFirst = 12849
iSecond = 4216624
(gdb) s
24 if(iFirst < iSecond){
(gdb)
27 return (iFirst > iSecond);
(gdb)
31 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=2, comp=0x401344 <compareInt>)
at qsort.c:29
29 for (index = left+1; index < right; index++)
(gdb)
35 (*swap)(v, left, last);
(gdb)
swap (v=0x404080 <lineptr>, i=0, j=0) at swap.c:12
12 temp = v[i];
(gdb) info local
temp = 0x323100000000
(gdb) s
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=2, comp=0x401344 <compareInt>)
at qsort.c:36
36 myQsort(v, left, last-1, comp);
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=-1, comp=0x401344 <compareInt>)
at qsort.c:23
23 if (left >= right)
(gdb)
24 return;
(gdb)
38 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=2, comp=0x401344 <compareInt>)
at qsort.c:37
37 myQsort(v, last+1, right, comp);
(gdb)
myQsort (v=0x404080 <lineptr>, left=1, right=2, comp=0x401344 <compareInt>
) at qsort.c:23
23 if (left >= right)
(gdb)
26 (*swap)(v, left, (left + right)/2);
(gdb)
swap (v=0x404080 <lineptr>, i=1, j=1) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=1, right=2, comp=0x401344 <compareInt>)
at qsort.c:27
27 last = left;
(gdb)
29 for (index = left+1; index < right; index++)
(gdb)
35 (*swap)(v, left, last);
(gdb)
swap (v=0x404080 <lineptr>, i=1, j=1) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=1, right=2, comp=0x401344 <compareInt>)
at qsort.c:36
36 myQsort(v, left, last-1, comp);
(gdb)
myQsort (v=0x404080 <lineptr>, left=1, right=0, comp=0x401344 <compareInt>)
at qsort.c:23
23 if (left >= right)
(gdb)
24 return;
(gdb)
38 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=1, right=2, comp=0x401344 <compareInt>)
at qsort.c:37
37 myQsort(v, last+1, right, comp);
(gdb)
myQsort (v=0x404080 <lineptr>, left=2, right=2, comp=0x401344 <compareInt>)
at qsort.c:23
23 if (left >= right)
(gdb)
24 return;
(gdb)
38 }
(gdb)
38 }
(gdb)
38 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=0, right=5, comp=0x401344 <compareInt>)
at qsort.c:37
37 myQsort(v, last+1, right, comp);
(gdb)
myQsort (v=0x404080 <lineptr>, left=4, right=5, comp=0x401344 <compareInt>)
at qsort.c:23
23 if (left >= right)
(gdb)
26 (*swap)(v, left, (left + right)/2);
(gdb)
swap (v=0x404080 <lineptr>, i=4, j=4) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=4, right=5, comp=0x401344 <compareInt>)
at qsort.c:27
27 last = left;
(gdb)
29 for (index = left+1; index < right; index++)
(gdb)
35 (*swap)(v, left, last);
(gdb)
swap (v=0x404080 <lineptr>, i=4, j=4) at swap.c:12
12 temp = v[i];
(gdb)
13 v[i] = v[j];
(gdb)
14 v[j] = temp;
(gdb)
15 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=4, right=5, comp=0x401344 <compareInt>)
at qsort.c:36
36 myQsort(v, left, last-1, comp);
(gdb)
myQsort (v=0x404080 <lineptr>, left=4, right=3, comp=0x401344 <compareInt>)
at qsort.c:23
23 if (left >= right)
(gdb)
24 return;
(gdb)
38 }
(gdb)
myQsort (v=0x404080 <lineptr>, left=4, right=5, comp=0x401344 <compareInt>
) at qsort.c:37
37 myQsort(v, last+1, right, comp);
(gdb)
myQsort (v=0x404080 <lineptr>, left=5, right=5, comp=0x401344 <compareInt>)
at qsort.c:23
23 if (left >= right)
(gdb)
24 return;
(gdb)
38 }
(gdb)
38 }
(gdb)
38 }
(gdb)
main (argc=2, argv=0x7fffffffd9d8) at sortMain.c:55
55 printf("\nSORTED ORDER \n");
(gdb)
SORTED ORDER
57 writelines(lineptr, nlines);
(gdb)
writelines (lineptr=0x404080 <lineptr>, nlines=6) at input-routines.c:51
51 while (nlines-- >0)
(gdb)
52 printf("%s\n", *lineptr++);
(gdb)
51 while (nlines-- >0)
(gdb)
52 printf("%s\n", *lineptr++);
(gdb)
12
51 while (nlines-- >0)
(gdb)
52 printf("%s\n", *lineptr++);
(gdb)
s
51 while (nlines-- >0)
(gdb)
52 printf("%s\n", *lineptr++);
(gdb)
123
51 while (nlines-- >0)
(gdb)
52 printf("%s\n", *lineptr++);
(gdb)
123
51 while (nlines-- >0)
(gdb)
52 printf("%s\n", *lineptr++);
(gdb)
1
51 while (nlines-- >0)
(gdb)
53 }
(gdb)
main (argc=2, argv=0x7fffffffd9d8) at sortMain.c:58
58 return 0;
(gdb)
65 }
(gdb)
0x00007ffff7cdf088 in __libc_start_call_main () from /lib64/libc.so.6
(gdb)
Single stepping until exit from function __libc_start_call_main,
which has no line number information.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment