Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] 'continue' executed via gdb.post_event() breaks run control inside Eclipse
  • From: Adrian Oltean <adrian.oltean@xxxxxxx>
  • Date: Thu, 23 Apr 2020 15:55:07 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+DfxUKqLz57sVwjLVEcblx2FAA0KwSZYkDTn5tMgHqc=; b=IOtHq9u3tFFffWHFPW3Ho1FEYnOX8lcxqV3bZtE6T1ACEeFHmPWRBe5E6Wd+FDKb6rKdJD4csU1hQ+gW3BJIGaFM+i/p2e7cwzp82w9FsCn11teV/9BS2xUY+5yhPNL1tw6IIhIEogO0lwldJHKMv3hEQeEtVRuBGs7EHvg3/YdBrDBvFr33KaTPLcBXS7zANpuj7wizUSqANgoue4HqrWblDvD/bvJIeYZzj8UvE6ku1wzLFUsydCjxppYvModPyRfIX45uoL4hcndqO9NvhQ5RA9XjpkgmkfnJUT2jLJSvxOT6HpQKjaj+OBWNokOimLSrFUiPPOSSvJpnYNH2Qw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CFKXPrQD2QinxQuzQZH/FUt2ibIRkV+RKgdC88reUE5wbTstFvZwtu2W0MrO8co0GfaL5hUjVRf1/PNpKl4lyOEN+Ph4NWCNuuz2q4K7TcrHgaKSTi3U591ILu4sSETY5og1qyTT9QsPqzeS5Tq8/xVTxkFvNNWb69K6ML/GFtUlHNUiUxOj9W4BAa43yGzKQ5uJRJYsEyE3Ox9hwouIGYoVH6RKc+LXXgNU7VRdnaBA2qTgeQLSOsMd7DPEpp65U7q/r4FB46ztBxDE1gHwkY+pPvqnHIXZi/Ny572qFjSODsNg8oI/cRR/D2EWdCW6SOkonP7YzA7duRjfGyUZ4g==
  • Delivered-to: cdt-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/cdt-dev>
  • List-help: <mailto:cdt-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/cdt-dev>, <mailto:cdt-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AdYZh3NDIYBdsRyeTJaz7HWYpswXww==
  • Thread-topic: 'continue' executed via gdb.post_event() breaks run control inside Eclipse

Hi everyone,

 

I’m currently experiencing some problems with regards to how CDT behaves

in the use case described in detail below. Looks like a 'continue' executed

via GDB's python API (see gdb.post_event(event)) somehow confuses Eclipse.

 

How to easily reproduce the problem:

1. Use an Ubuntu/Windows host;

2. Install Eclipse C/C++ 2019.12;

3. Create a C 'hello world' app for testing; add an infinite loop in 'main';

4. Build the app;

5. Create a python script (e.g. post_event.py) and paste the following code.

Make sure to properly indent it if it gets messed-up in this email;

import gdb

 

class CustomEvent(object):

    def __init__(self, command):

        self.command = command

 

    def __call__(self):

        print("Executing <%s>" % self.command)

        gdb.execute(self.command, False, False)

 

counter = 0

def suspend_handler(event):

    global counter

    if counter % 2 == 0:

        gdb.post_event(CustomEvent("continue"))

    counter = counter + 1

 

# This is not part of the suspend_handler...

gdb.events.stop.connect(suspend_handler)

 

6. Start local debug; use GDB 8+ in all-stop mode;

7. Run the py script using the Debugger Console - 'source post_event.py';

8. Resume the app from 'main'

9. Suspend execution - note that a 'continue' will (eventually) be executed

from the script. We have two behaviors, depending on the host OS:

  a. On Linux ('enhanced' console supported), Eclipse ends-up in a weird

state, Debug view showing the app suspended (with empty stack frames) whilst

the actual app is running. Suspend button is now disabled. If I try to resume,

I obviously get an error - 'selected thread is running';

  b. On Windows (no 'enhanced' debugger console support, thus no mi-async,

nor target-sync enabled), suspend operation fails with 'operation timeout'. Things

get really messy if trying other operations afterwards.

10. Repeat steps 8 and 9 if problem not reproduced after the first attempt. Seems

to be more reliable on Linux hosts but consistently failing on Windows;

 

I'm mentioning the 'enhanced' console support because problems seem to be related

to how app/target is interrupted - '-exec-interrupt' vs. kill(SIGINT).

 

From my experiments, if I switch to non-stop mode GDB, behavior on Linux does not

change, whereas on Windows I no longer see any issues. But on Windows, my setup

involves an ARM-based target, a custom GDB server and JTAG debugging. On my

Ubuntu 18.04 I simply debug a host Linux app.

 

Anyone else seeing this? Any hints on how to make CDT properly deal with

'continue' executed from a gdb.post_event()?

 

Thank you,

Adrian

 


Back to the top