touch-packages team mailing list archive
-
touch-packages team
-
Mailing list archive
-
Message #35254
[Bug 1390905] Re: gdb list not from the first line
here is a test case:
```c
#include <stdio.h>
int maxsubsum(const int a[], int left, int right)
{
int maxleftsum, maxrightsum;
int maxleftbordersum, maxrightbordersum;
int leftbordersum, rightbordersum;
int center, i;
if (left == right) {
// base case
if (a[left] > 0) {
return a[left];
} else {
return (0);
}
}
center = (left + right)/2;
maxleftsum = maxsubsum(a, left, center);
maxrightsum = maxsubsum(a, center, right);
maxleftbordersum = 0;
leftbordersum = 0;
for (i = center; i >= left; i--) {
leftbordersum += a[i];
if( leftbordersum > maxleftbordersum ) {
maxleftbordersum = leftbordersum;
}
}
maxrightbordersum = 0;
rightbordersum = 0;
for (i = center+i; i <= right; i++) {
rightbordersum += a[i];
if (rightbordersum > maxrightbordersum) {
maxrightbordersum = rightbordersum;
}
}
return max_in3(maxleftsum, maxrightsum, maxleftbordersum+maxrightbordersum);
}
int max_subsequence_sum(const int a[], int n)
{
return maxsubsum(a, 0, n-1);
}
int max_in3(int a, int b, int c)
{
a = a > b? a: b;
a = a > c? a: c;
return a;
}
int main(void)
{
int nums[] = { 1, 2, 3, -7, 8 };
max_subsequence_sum(nums, 5);
return 0;
}
```
first, compile it with -g option: `gcc -g max_sub.c`, and then debug
`gdb ./a.out`
when I type list command in gdb, it will display:
```shell
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...done.
(gdb) list
49 int max_in3(int a, int b, int c)
50 {
51 a = a > b? a: b;
52 a = a > c? a: c;
53 return a;
54 }
55
56 int main(void)
57 {
58 int nums[] = { 1, 2, 3, -7, 8 };
(gdb)
```
it's not list from the 1st line.
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to gdb in Ubuntu.
https://bugs.launchpad.net/bugs/1390905
Title:
gdb list not from the first line
Status in “gdb” package in Ubuntu:
Incomplete
Bug description:
when I use gdb list command, it does not list source code from the
first line.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/1390905/+subscriptions
References