This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug objc/20503] New: ObjC runtime debugging support is severely broken
- From: "gdb at crelg dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 22 Aug 2016 16:19:31 +0000
- Subject: [Bug objc/20503] New: ObjC runtime debugging support is severely broken
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=20503
Bug ID: 20503
Summary: ObjC runtime debugging support is severely broken
Product: gdb
Version: 7.11.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: objc
Assignee: unassigned at sourceware dot org
Reporter: gdb at crelg dot com
Target Milestone: ---
Created attachment 9467
--> https://sourceware.org/bugzilla/attachment.cgi?id=9467&action=edit
source + makefile
Component and OS
Component Version OS
--------- ------------ -----------------------
GDB 7.11.1 i686-w64-mingw32
GDB 7.6.1-80.el7 x86_64-redhat-linux-gnu (*)
(*) latest available through yum
Summary
ObjC runtime debugging support is severely broken. Can't
look up a class or invoke a method or pass a convenience
variable -- even a plain C string.
Description
1. Can't find classes. Objectve C classes are supposed to
be global variables. They are not available from the
GDB command line. That is like a C debugger that
doesn't let you call any functions.
2. Can't invoke methods. Trying [obj meth:arg] from the
command line no longer works. It crashes GDB in some
instances.
3. These things used to work in older versions of GDB.
Steps to reproduce
1. Compile and debug the attached program in GDB.
2. Type the following commands in GDB.
3. Show below each command are behaviors (a) expected and
(b) obtained.
(gdb) b main
(gdb) r
(gdb) n 3
(gdb) p pr
# Print a variable
# This works
# $1 = (struct objc_object *) 0x403040 <_OBJC_MetaClass_Printer>
# $1 = (struct objc_object *) 0x6020e0 <_OBJC_MetaClass_Printer>
(gdb) po pr
# Use po (which calls _NSPrintForDebugger)
# This works
<Object: 0x403040>
<Object: 0x6020e0>
(gdb) p [pr prn:"foo"]
# Send a known message to a known receiver with a convenience variable
# Expected: "Value is 'foo'"
# Windows: Can't find selector "prn:"
# Linux: Program received signal SIGSEGV, Segmentation fault.
__objc_responds_to (sel=<optimized out>, object=0x6020e0
<_OBJC_MetaClass_Printer>) at
/usr/src/debug/gcc-4.8.5-20150702/libobjc/sendmsg.c:397
397 res = sarray_get_safe (dtable, (size_t) sel->sel_id);
(gdb) p [Printer prn:"foo"]
# Send a known message to a known receiver with a convenience variable
# Expected: "Value is 'foo'"
# Windows: No symbol "Printer" in current context.
# Linux: Program received signal SIGSEGV, Segmentation fault.
__objc_responds_to (sel=<optimized out>, object=0x602160 <_OBJC_Class_Printer>)
at /usr/src/debug/gcc-4.8.5-20150702/libobjc/sendmsg.c:397
397 res = sarray_get_safe (dtable, (size_t) sel->sel_id);
(gdb) p [Printer evaporate]
# Invoke an unknown method
# Expected: Object (id) 0x403040 <Printer> does not respond to selector
"evaporate"
# Windows: Can't find selector "evaporate" (or any valid selector for that
matter)
# Linux: Program received signal SIGSEGV, Segmentation fault.
__objc_responds_to (sel=<optimized out>, object=0x602160 <_OBJC_Class_Printer>)
at /usr/src/debug/gcc-4.8.5-20150702/libobjc/sendmsg.c:397
397 res = sarray_get_safe (dtable, (size_t) sel->sel_id);
(gdb) p Printer
# Print an Objective C class (a global variable)
# Expected: $1 = (struct objc_object *) 0x403040 <_OBJC_MetaClass_Printer>
# Windows: No symbol "Printer" in current context.
# Linux: A syntax error in expression, near `Printer'.
(gdb) p [Printer class]
# Invoke a method on an object (an Objective C class which should be a global
variable)
# Expected: $1 = (struct objc_object *) 0x403040 <_OBJC_MetaClass_Printer>
# Windows: No symbol "Printer" in current context.
# Linux: Program received signal SIGSEGV, Segmentation fault.
__objc_responds_to (sel=<optimized out>, object=0x602160 <_OBJC_Class_Printer>)
at /usr/src/debug/gcc-4.8.5-20150702/libobjc/sendmsg.c:397
397 res = sarray_get_safe (dtable, (size_t) sel->sel_id);
(gdb) p getClass("Printer")
# Call a function with a convenience variable
# Expected: $1 = (struct objc_object *) 0x403040 <_OBJC_MetaClass_Printer>
# Win+Lin: $1 = (struct objc_object *) 0x0
(gdb) p "foo"
# Create a convenience variable
# Expected: $1 = (char *) "foo"
# Win+Lin: $1 = <error reading variable>
(gdb) p objc_getClass("Printer")
# Call a function with a convenience variable
# Expected: $1 = (struct objc_object *) 0x403040 <_OBJC_MetaClass_Printer>
# Windows: Program received signal SIGSEGV, Segmentation fault. 0x00000000 in
?? ()
# Linux: $1 = (struct objc_class *) 0x0
--
You are receiving this mail because:
You are on the CC list for the bug.