mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-24 01:51:54 +08:00
PR external/1568
* gdb.base/bigcore.exp: Check the size of the dumped core file. XFAIL if it is smaller than bytes_allocated. * gdb.base/bigcore.c (bytes_allocated): Make static and unsigned. (main): Make chunks_allocated unsigned. Correct comment.
This commit is contained in:
gdb/testsuite
@ -1,3 +1,11 @@
|
|||||||
|
2004-05-10 Daniel Jacobowitz <dan@debian.org>
|
||||||
|
|
||||||
|
PR external/1568
|
||||||
|
* gdb.base/bigcore.exp: Check the size of the dumped core file.
|
||||||
|
XFAIL if it is smaller than bytes_allocated.
|
||||||
|
* gdb.base/bigcore.c (bytes_allocated): Make static and unsigned.
|
||||||
|
(main): Make chunks_allocated unsigned. Correct comment.
|
||||||
|
|
||||||
2004-05-07 Joel Brobecker <brobecker@gnat.com>
|
2004-05-07 Joel Brobecker <brobecker@gnat.com>
|
||||||
|
|
||||||
* gdb.arch/powerpc-aix-prologue.c: New file.
|
* gdb.arch/powerpc-aix-prologue.c: New file.
|
||||||
|
@ -117,6 +117,8 @@ struct list
|
|||||||
static struct list dummy;
|
static struct list dummy;
|
||||||
static struct list heap = { &dummy, &dummy };
|
static struct list heap = { &dummy, &dummy };
|
||||||
|
|
||||||
|
static unsigned long bytes_allocated;
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
@ -151,14 +153,13 @@ main ()
|
|||||||
each section. The linking ensures that some, but not all, the
|
each section. The linking ensures that some, but not all, the
|
||||||
memory is allocated. NB: Some kernels handle this efficiently -
|
memory is allocated. NB: Some kernels handle this efficiently -
|
||||||
only allocating and writing out referenced pages leaving holes in
|
only allocating and writing out referenced pages leaving holes in
|
||||||
the file for unreferend pages - while others handle this poorly -
|
the file for unmodified pages - while others handle this poorly -
|
||||||
writing out all pages including those that wern't referenced. */
|
writing out all pages including those that weren't modified. */
|
||||||
|
|
||||||
print_string ("Alocating the entire heap ...\n");
|
print_string ("Alocating the entire heap ...\n");
|
||||||
{
|
{
|
||||||
size_t chunk_size;
|
size_t chunk_size;
|
||||||
long bytes_allocated = 0;
|
unsigned long chunks_allocated = 0;
|
||||||
long chunks_allocated = 0;
|
|
||||||
/* Create a linked list of memory chunks. Start with
|
/* Create a linked list of memory chunks. Start with
|
||||||
MAX_CHUNK_SIZE blocks of memory and then try allocating smaller
|
MAX_CHUNK_SIZE blocks of memory and then try allocating smaller
|
||||||
and smaller amounts until all (well at least most) memory has
|
and smaller amounts until all (well at least most) memory has
|
||||||
|
@ -105,9 +105,30 @@ gdb_test "tbreak $print_core_line"
|
|||||||
gdb_test continue ".*print_string.*"
|
gdb_test continue ".*print_string.*"
|
||||||
gdb_test next ".*0 = 0.*"
|
gdb_test next ".*0 = 0.*"
|
||||||
|
|
||||||
|
# Check that the corefile is plausibly large enough. We're trying to
|
||||||
|
# detect the case where the operating system has truncated the file
|
||||||
|
# just before signed wraparound. TCL, unfortunately, has a similar
|
||||||
|
# problem - so use catch. It can handle the "bad" size but not necessarily
|
||||||
|
# the "good" one. And we must use GDB for the comparison, similarly.
|
||||||
|
|
||||||
|
if {[catch {file size $corefile} core_size] == 0} {
|
||||||
|
set core_ok 0
|
||||||
|
gdb_test_multiple "print bytes_allocated < $core_size" "check core size" {
|
||||||
|
-re " = 1\r\n$gdb_prompt $" {
|
||||||
|
pass "check core size"
|
||||||
|
set core_ok 1
|
||||||
|
}
|
||||||
|
-re " = 0\r\n$gdb_prompt $" {
|
||||||
|
xfail "check core size (system does not support large corefiles)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if {$core_ok == 0} {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Traverse part of bigcore's linked list of memory chunks (forward or
|
# Traverse part of bigcore's linked list of memory chunks (forward or
|
||||||
# backward), saving each chunk's address. I don't know why but
|
# backward), saving each chunk's address.
|
||||||
# expect_out didn't work with gdb_test_multiple.
|
|
||||||
|
|
||||||
proc extract_heap { dir } {
|
proc extract_heap { dir } {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
@ -115,8 +136,7 @@ proc extract_heap { dir } {
|
|||||||
set heap ""
|
set heap ""
|
||||||
set test "extract ${dir} heap"
|
set test "extract ${dir} heap"
|
||||||
set lim 0
|
set lim 0
|
||||||
send_gdb "print heap.${dir}\n"
|
gdb_test_multiple "print heap.${dir}" "$test" {
|
||||||
gdb_expect {
|
|
||||||
-re " = \\(struct list \\*\\) 0x0.*$gdb_prompt $" {
|
-re " = \\(struct list \\*\\) 0x0.*$gdb_prompt $" {
|
||||||
pass "$test"
|
pass "$test"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user