nccgroup / asafw

Set of scripts to deal with Cisco ASA firmware [pack/unpack etc.]
BSD 3-Clause "New" or "Revised" License
96 stars 29 forks source link

how to configure gdbserver port when enable gdb in GNS3 mode? #6

Closed cq674350529 closed 6 years ago

cq674350529 commented 6 years ago

Hi, Recently I have read your great posts about Cisco ASA. When I do experiments with GNS3, I came accross some problems.

  1. Since a GNS3 instance will be debugged over TCP/IP(telnet), why still need to enable and change "/dev/ttyS1" to "/dev/ttyS0" in rcS script when patch the qcow2 image? Why not use -n instead? (-n : gdb ethernet device, eg, 'eth0'). I have tried use -n option and made some corresponding changes, but it didn't work.

  2. When use asadbg to debug, a asacfg file is needed. In GNS3 mode, we have to specify a gns3_port filed (in your case, use 12005 instead). But during patching the qcow2 image, I can't find the corresponding port. Is it the default port used by gdbserver? How can I configure that port when enable gdb?

Now I get the following at the boot (default console type is vnc), but I don't know which port to use in gdb (target remote < GNS3's ip>:<which port???>).

asa_boot

Any advice would be appricated! Thanks in advance.

saidelike commented 6 years ago

Hi,

Hi, Recently I have read your great posts about Cisco ASA. When I do experiments with GNS3, I came accross some problems.

  1. Since a GNS3 instance will be debugged over TCP/IP(telnet), why still need to enable and change "/dev/ttyS1" to "/dev/ttyS0" in rcS script when patch the qcow2 image? Why not use -n instead? (-n : gdb ethernet device, eg, 'eth0'). I have tried use -n option and made some corresponding changes, but it didn't work.

We still patch rcS to use "/dev/ttyS0" (instead of "/dev/ttyUSB0" because QEMU will redirect the serial port internally to a TCP port externally. So we access it from the external world (our machine) with gdb using a TCP/IP port but it will be redirected inside qemu to the serial port.

  1. When use asadbg to debug, a asacfg file is needed. In GNS3 mode, we have to specify a gns3_port filed (in your case, use 12005 instead). But during patching the qcow2 image, I can't find the corresponding port. Is it the default port used by gdbserver? How can I configure that port when enable gdb?

See above for the same reason. We don't need to specify it when we build the qcow2 as all it is aware of/using is the serial port. We only require the TCP port when attaching with gdb.

Now I get the following at the boot (default console type is vnc), but I don't know which port to use in gdb (target remote < GNS3's ip>:<which port???>).

We can get this information from the GNS3 window or GNS3 project file, see tutorial.md.

asa_boot

Any advice would be appricated! Thanks in advance.

cq674350529 commented 6 years ago

@saidelike Thanks. Got it. I figured out the ip configured in env.sh is also just used for debug purpose later.

saidelike commented 6 years ago

Closing as you seem to agree it is fixed.