aboutsummaryrefslogtreecommitdiff
path: root/gdb/make-init-c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2025-05-21 10:16:08 +0100
committerAndrew Burgess <aburgess@redhat.com>2025-05-22 19:14:01 +0100
commitebed2c2c43aeaa6e4e603d07e930eceda510c02d (patch)
treec1b61b96dc07e415eade0d13017d57030627ab07 /gdb/make-init-c
parent2711e4754fc4d9ed594491d3e87a37d0ffa165ed (diff)
downloadbinutils-ebed2c2c43aeaa6e4e603d07e930eceda510c02d.zip
binutils-ebed2c2c43aeaa6e4e603d07e930eceda510c02d.tar.gz
binutils-ebed2c2c43aeaa6e4e603d07e930eceda510c02d.tar.bz2
gdb: reorder checks in validate_exec_file
While reviewing another patch I was briefly confused by a call to target_pid_to_exec_file coming from validate_exec_file while attaching to a process when I had not previously set an executable. The current order of actions in validate_exec_file is: 1. Get name of current executable. 2. Get name of executable from the current inferior. 3. If either of (1) or (2) return NULL, then there's nothing to check, early return. I think it would be cleaner if we instead did this: 1. Get name of current executable. 3. If (1) returned NULL then there's nothing to check, early return. 3. Get name of executable from the current inferior. 4. If (3) returned NULL then there's nothing to check, early return. This does mean there's an extra step, but I don't think the code is any more complex really, and we now avoid trying to extract the name of the executable from the current inferior unless we really need it. This avoids the target_pid_to_exec_file call that I was seeing, which for remote targets does avoid a packet round trip (not that I'm selling this as an "optimisation", just noting the change). There should be no user visible changes after this commit. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/make-init-c')
0 files changed, 0 insertions, 0 deletions