This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] darwin: Don't use sbrk


*** TEST RESULTS FOR COMMIT 6242c6a690ce8e18aad711103902bfff00cc2757 ***

Author: Simon Marchi <simon.marchi@polymtl.ca>
Branch: master
Commit: 6242c6a690ce8e18aad711103902bfff00cc2757

darwin: Don't use sbrk

This patch gets rid of this warning on macOS:

    CXX    main.o
  /Users/simark/src/binutils-gdb/gdb/main.c:492:27: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations]
    lim_at_start = (char *) sbrk (0);
                            ^
  /usr/include/unistd.h:585:1: note: 'sbrk' has been explicitly marked deprecated here
  __deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
  ^
  /usr/include/sys/cdefs.h:176:37: note: expanded from macro '__deprecated'
  #define __deprecated    __attribute__((deprecated))
                                         ^

sbrk on macOS is not useful for our purposes, since sbrk(0) always
returns the same value.  From what I read, brk/sbrk on macOS is just an
emulation, it always returns a pointer in a 4MB section reserved for
that.

So instead of letting users use "maint set per-command space on" and
print silly results, I think we should just disable that feature for
this platform (as we do for platforms that don't have sbrk).

I defined a HAVE_USEFUL_SBRK macro and used that instead of HAVE_SBRK.

gdb/ChangeLog:

	* common/common-defs.h (HAVE_USEFUL_SBRK): Define.
	* main.c: Use HAVE_USEFUL_SBRK instead of HAVE_SBRK.
	* maint.c: Likewise.
	* top.c: Likewise.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]