From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yYEXOf+aF2HfOQAAWB0awg (envelope-from ) for ; Sat, 14 Aug 2021 06:29:19 -0400 Received: by simark.ca (Postfix, from userid 112) id B7B521EDFB; Sat, 14 Aug 2021 06:29:19 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C56611E813 for ; Sat, 14 Aug 2021 06:29:18 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 867503885C3D for ; Sat, 14 Aug 2021 10:29:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 867503885C3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628936957; bh=NY6DoIe9x68lJf7O04VKmMoCrwWmyVa8VvecmgYFPhc=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=CSHhk/oHkm8Q0I8fV5HXbfY6SgGlWhXllGHMywLyZd++V/ijeTRjVpGNnHZwuT/Z0 6cyw/y3eZJEMX/GZmZxqVyfNxUZkSEZUe0Kt/7MvZAU4/YmzgMXpBClavo5FfpVYoY 9ku33stHOqJ04BpsyWxEHOFjy3FpRkgUNrt7Dfn0= Received: from h2828900.stratoserver.net (h2828900.stratoserver.net [81.169.236.69]) by sourceware.org (Postfix) with ESMTP id 178243858401 for ; Sat, 14 Aug 2021 10:28:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 178243858401 Received: from [192.168.0.251] (ip5f5accc7.dynamic.kabel-deutschland.de [95.90.204.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: max@schneidersoft.net) by h2828900.stratoserver.net (Postfix) with ESMTPSA id BE36134044A for ; Sat, 14 Aug 2021 12:28:51 +0200 (CEST) Message-ID: Subject: GDB call and p func() on embedded target To: gdb@sourceware.org Date: Sat, 14 Aug 2021 11:28:46 +0100 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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: , From: Maximilian Schneider via Gdb Reply-To: Maximilian Schneider Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" Hello, I am trying to call a function from withing a gdb debugging session on an embedded target. However gdb never returns and when i stop it manually the program counter is in a strange place. It appears that gdb is not able to catch the return, and is continuing execution from before the core was halted... assume the function I want to call has prototype int32_t Init(void); If I set the pc manually I can step throught the function until the return without a problem. I can even set a breakpoint on Init and then use p Init(). The breakpoint will fire and I can step throught the code manually. eg. target remote localhost:3333 monitor reset halt monitor reset init file loader.elf load loader.elf set $sp=0x20010000 set $pc=&Init b Init p Init() n n n ... However without the breakpoint gdb never returns. Is this a known problem? Is there a workaround? Some background: The purpose of this entire excercise is to arrive at a tool/set of scripts that can be used to load and execute arbitrary code from RAM, to fi. manipulate external memories or run tests. Regards, M