From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from muller.mulle-kybernetik.com (muller.mulle-kybernetik.com [138.201.123.71]) by sourceware.org (Postfix) with ESMTPS id 31A40385AC33 for ; Fri, 25 Feb 2022 00:28:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 31A40385AC33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=mulle-kybernetik.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mulle-kybernetik.com Received: (qmail 43646 invoked from network); 25 Feb 2022 01:28:36 +0100 Received: from unknown (HELO ?192.168.2.99?) (nat@138.201.123.71) by mail.mulle-kybernetik.com with ESMTPS (TLS_AES_128_GCM_SHA256 encrypted); 25 Feb 2022 01:28:36 +0100 Message-ID: Date: Fri, 25 Feb 2022 01:28:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-US To: gdb@sourceware.org From: Nat! Subject: How to add a second "this" (sort of, or maybe do something totally different) X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, BODY_8BITS, HTML_FONT_FACE_BAD, HTML_MESSAGE, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2022 00:28:40 -0000 Hi my problem is this: I have lots of functions (actually compiled Objective-C methods), that look very similiar: void     *foo1( id self, unsigned int _cmd, struct { int a; void * b;}  *_param); void     *foo2( id self, unsigned int _cmd, struct { double a; void * b;}  *_param); void     *foo3( id self, unsigned int _cmd, struct { int a; int b; int c; }  *_param); and so on. The first two parameters are always the same. The actual method parameters are accessed indirectly through "_param".  So the functions may have looked like this in the Objective-C source code: int     foo1:(int) a :(void *) b; void foo2:(double) a :(void *) b; char  *foo3:(int) a :(int) b :(int) c; As the programmer passes "a", "b" and not "_param", it would be nice to get the debugger to print "_param->a", if the user enters "p a". gdb can already do this expansion for "this" or "self". As it's Objective-C, the "this" for the debugger is taken and it's "self". The user doesn't have to type "p self->_ivar" but can use "p _ivar" to access instance variables. That's nice, but doesn't extend to "_param". I am looking for the least effort route to support something like this for "_param" as well, in gdb. What would be really great, would be to also show the struct fields in the stack trace instead of "_param". Ciao    Nat! P.S. Getting the compiler to output some fake dwarf "DW_TAG_formal_parameter" for each struct field with a computed dwarf expression, is maybe the proper way it could be done. But that's not least effort for me by a long shot.