+2020-05-20 Simon Marchi <simon.marchi@efficios.com>
+
+ PR gdb/26016
+ * gdb.base/coredump-filter.c (do_mmap): Check mmap ret val
+ against MAP_FAILED.
+ * gdb.base/coremaker.c (mmapdata): Likewise.
+ * gdb.base/jit-reader-host.c (main): Likewise.
+ * gdb.base/sym-file-loader.c (load): Likewise.
+ (load_shlib): Likewise.
+
2020-05-20 Tom Tromey <tromey@adacore.com>
* gdb.ada/array_char_idx.exp: Recognize initialized array.
{
void *ret = mmap (addr, size, prot, flags, fd, offset);
- assert (ret != NULL);
+ assert (ret != MAP_FAILED);
return ret;
}
/* Now map the file into our address space as buf2 */
buf2 = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
- if (buf2 == (char *) -1)
+ if (buf2 == (char *) MAP_FAILED)
{
perror ("mmap failed");
return;
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
char *code_end = code;
+ assert (code != MAP_FAILED);
+
/* "JIT" function_stack_mangle. */
memcpy (code_end, jit_function_stack_mangle_code,
sizeof (jit_function_stack_mangle_code));
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
+#include <assert.h>
#include "sym-file-loader.h"
mapped_addr = (uint8_t *) mmap ((void *) GETADDR (phdr, p_vaddr),
GET (phdr, p_memsz), perm,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ assert (mapped_addr != MAP_FAILED);
+
mapped_size = GET (phdr, p_memsz);
from = (void *) (addr + GET (phdr, p_offset));
}
addr = (uint8_t *) mmap (NULL, fsize, PROT_READ, MAP_PRIVATE, fd, 0);
- if (addr == (uint8_t *) -1)
+ if (addr == MAP_FAILED)
{
perror ("mmap failed.");
return NULL;