Skip to content

preAttachCommands list executed after GDB connect to GDB Server (openOCD) #953

@Upsylonbare

Description

@Upsylonbare

I am trying to translate this gdbscript to a launch.json file in order to attach gdb to my target regardingly to ST advice using this script.

Before the line that connects to the target, there is those two line that set memory attributes.

I need to set this two line before, the connection to the gdb-server (OpenOCD) in my case.
So I interested in the attributes preAttachCommands preLaunchCommands :
To me preAttachCommands means a set of commands runs before a remote connection as I have not seen any other attributes to do that.

But the fact is that I saw in the documentation that the description for the two attributes are the same :

Attribute Type Launch/ Attach Description
preAttachCommands string[] Attach Additional GDB Commands to be executed at the start of the main attach sequence (immediately after attaching to target).
preLaunchCommands string[] Launch Additional GDB Commands to be executed at the start of the main launch sequence (immediately after attaching to target).

And after the setup of my configuration I saw that commands from preAttachCommands are not even send (from preAttachCommands), and the command I want to send just after the connection are correctly send (from preLaunchCommands).

Extract from my launch json :

"preAttachCommands": [
	// "set confirm off",
	"set mem inaccessible-by-default",
	"mem 0 4 ro 8 nocache"
],
"preLaunchCommands": [
	"set remote hardware-breakpoint-limit 6",
	"set remote hardware-watchpoint-limit 4",
	"monitor cortex_a smp off",
	"monitor if {[target current] == \"stm32mp15x.cpu1\"} {targets stm32mp15x.cpu0}",
]

Logs :

11-target-select extended-remote localhost:50011
.....
-> 11^connected
12-interpreter-exec console "set mem inaccessible-by-default"
-> 12^done

Do I use the wrong attributes for my purpose ? Is there a way to "enable" preAttachCommands ? How can I help there ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions